Skip to content

Commit

Permalink
feat(kz_dash): 通用功能迁移
Browse files Browse the repository at this point in the history
  • Loading branch information
kingzeus committed Dec 14, 2024
1 parent a405357 commit cae9b8e
Show file tree
Hide file tree
Showing 31 changed files with 35 additions and 381 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "kz_dash"]
path = kz_dash
url = [email protected]:dash/kz_dash.git
4 changes: 2 additions & 2 deletions backend/apis/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from backend.apis.common import create_list_response_model, create_response_model
from models.account import ModelAccount, update_account
from models.database import delete_record, get_record, get_record_list, update_record
from utils.response import format_response
from utils.string_helper import get_uuid
from kz_dash.utility.response import format_response
from kz_dash.utility.string_helper import get_uuid

api = Namespace("accounts", description="账户相关操作")

Expand Down
2 changes: 1 addition & 1 deletion backend/apis/fund.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
update_record,
)
from models.fund_user import ModelFundPosition
from utils.response import format_response
from kz_dash.utility.response import format_response

api = Namespace("funds", description="基金相关操作")

Expand Down
4 changes: 2 additions & 2 deletions backend/apis/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from backend.apis.common import create_list_response_model, create_response_model
from models.account import ModelPortfolio
from models.database import delete_record, get_record, get_record_list, update_record
from utils.response import format_response
from utils.string_helper import get_uuid
from kz_dash.utility.response import format_response
from kz_dash.utility.string_helper import get_uuid

api = Namespace("portfolios", description="投资组合相关操作")

Expand Down
2 changes: 1 addition & 1 deletion backend/apis/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from backend.apis.common import create_response_model
from config import VERSION
from utils.response import format_response
from kz_dash.utility.response import format_response

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion backend/apis/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from models.task import ModelTask
from scheduler.job_manager import JobManager
from scheduler.tasks import TaskFactory
from utils.response import format_response
from kz_dash.utility.response import format_response

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion components/fund_code_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from config import DATA_SOURCE_DEFAULT
from data_source.proxy import DataSourceProxy
from utils.string_helper import get_uuid
from kz_dash.utility.string_helper import get_uuid

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions data_source/implementations/eastmoney.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

from data_source.interface import IDataSource
from scheduler.tasks.base import FundType
from utils.datetime_helper import format_date, get_timestamp, get_timestamp_ms
from utils.string_helper import (
from kz_dash.utility.datetime_helper import format_date, get_timestamp, get_timestamp_ms
from kz_dash.utility.string_helper import (
extract_number_with_unit,
generate_random_string,
get_json_from_jsonp_simple,
Expand Down
2 changes: 1 addition & 1 deletion data_source/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from config import DATA_SOURCE_DEFAULT
from data_source import DataSourceFactory
from utils.response import format_response
from kz_dash.utility.response import format_response

logger = logging.getLogger(__name__)
T = TypeVar("T") # 用于泛型返回类型
Expand Down
1 change: 1 addition & 0 deletions kz_dash
Submodule kz_dash added at 3f3ef4
2 changes: 1 addition & 1 deletion models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from peewee import BooleanField, CharField, ForeignKeyField

from models.base import BaseModel
from utils.string_helper import get_uuid
from kz_dash.utility.string_helper import get_uuid


class ModelAccount(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from peewee import DatabaseError, DateTimeField, Model, SqliteDatabase

from config import DATABASE_CONFIG
from utils.singleton import Singleton
from kz_dash.utility.singleton import Singleton

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions models/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from playhouse.shortcuts import update_model_from_dict

from utils.datetime_helper import format_datetime
from utils.string_helper import get_uuid
from kz_dash.utility.datetime_helper import format_datetime
from kz_dash.utility.string_helper import get_uuid

from .account import ModelAccount, ModelPortfolio
from .base import BaseModel, db_connection
Expand Down
2 changes: 1 addition & 1 deletion pages/account/portfolio_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from models.database import update_record
from pages.account.table import get_account_table_data
from pages.account.utils import validate_name
from utils.string_helper import get_uuid
from kz_dash.utility.string_helper import get_uuid


# 组合编辑弹窗模块
Expand Down
2 changes: 1 addition & 1 deletion pages/account/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from models.account import ModelAccount, ModelPortfolio
from models.database import get_record, get_record_list
from utils.datetime_helper import format_datetime
from kz_dash.utility.datetime_helper import format_datetime

from .utils import create_operation_buttons

Expand Down
4 changes: 2 additions & 2 deletions pages/task/task_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
)
from scheduler.job_manager import JobManager
from scheduler.tasks import TaskStatus
from utils.datetime_helper import format_datetime
from utils.string_helper import json_str_to_dict
from kz_dash.utility.datetime_helper import format_datetime
from kz_dash.utility.string_helper import json_str_to_dict

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pages/task/task_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
prepare_task_for_display,
)
from scheduler.job_manager import JobManager, TaskStatus
from utils.fac_helper import show_message
from kz_dash.utility.fac_helper import show_message

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pages/task/task_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from models.database import get_record_count, get_record_list
from models.task import ModelTask
from scheduler.job_manager import JobManager, TaskStatus
from utils.datetime_helper import format_datetime
from kz_dash.utility.datetime_helper import format_datetime

# ============= 状态常量 =============
STATUS_LABELS = {
Expand Down
4 changes: 2 additions & 2 deletions pages/transaction/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from models.fund import ModelFundNav
from models.fund_user import ModelFundTransaction
from scheduler.job_manager import JobManager
from utils.fac_helper import show_message
from utils.string_helper import get_uuid
from kz_dash.utility.fac_helper import show_message
from kz_dash.utility.string_helper import get_uuid

from .utils import build_cascader_options

Expand Down
4 changes: 2 additions & 2 deletions scheduler/job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from models.database import delete_record, get_record, get_record_list, update_record
from models.task import ModelTask
from scheduler.tasks import TaskFactory, TaskStatus
from utils.singleton import Singleton
from utils.string_helper import get_uuid
from kz_dash.utility.singleton import Singleton
from kz_dash.utility.string_helper import get_uuid

# 创建调度器实例
scheduler = APScheduler()
Expand Down
2 changes: 1 addition & 1 deletion scheduler/tasks/fund_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from data_source.proxy import DataSourceProxy
from models.database import update_record
from models.fund import ModelFundNav
from utils.datetime_helper import get_date_str_after_days, get_days_between_dates
from kz_dash.utility.datetime_helper import get_date_str_after_days, get_days_between_dates

from .base import PARAM_FUND_CODE, BaseTask

Expand Down
2 changes: 1 addition & 1 deletion scheduler/tasks/sync_fund_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from models.database import get_record
from models.fund import ModelFund
from scheduler.tasks.task_factory import TaskFactory
from utils.datetime_helper import get_date_str_after_days, get_days_between_dates
from kz_dash.utility.datetime_helper import get_date_str_after_days, get_days_between_dates

from .base import PARAM_FUND_TYPE, BaseTask

Expand Down
2 changes: 1 addition & 1 deletion scheduler/tasks/sync_fund_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from models.database import get_record
from models.fund import ModelFund
from scheduler.tasks.task_factory import TaskFactory
from utils.datetime_helper import get_date_str_after_days, get_days_between_dates
from kz_dash.utility.datetime_helper import get_date_str_after_days, get_days_between_dates

from .base import PARAM_FUND_CODE, PARAM_SUB_TASK_DELAY, BaseTask

Expand Down
2 changes: 1 addition & 1 deletion scheduler/tasks/task_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from config import DEBUG
from scheduler.tasks.base import BaseTask
from utils.singleton import Singleton
from kz_dash.utility.singleton import Singleton

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_datetime.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from datetime import date, datetime

from utils.datetime_helper import format_date, format_datetime
from kz_dash.utility.datetime_helper import format_date, format_datetime


class TestDatetimeFunctions(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from data_source.implementations.eastmoney import EastMoneyDataSource
from models.database import init_database
from scheduler.tasks.fund_detail import FundDetailTask
from utils.string_helper import get_uuid
from kz_dash.utility.string_helper import get_uuid


class TestFundDetailTasks(unittest.TestCase):
Expand Down
Loading

0 comments on commit cae9b8e

Please sign in to comment.