Skip to content

Commit

Permalink
feat: 账号概览增加区分编年史token过期和未填写的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
fzls committed Feb 3, 2025
1 parent 150118c commit 7cbc7b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 8 additions & 3 deletions djc_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4576,10 +4576,15 @@ def query_dnf_helper_chronicle_info(self) -> DnfHelperChronicleUserActivityTopIn
res = self.dzhu_post("活动基础状态信息", "getUserActivityTopInfo", self.get_common_params())
return DnfHelperChronicleUserActivityTopInfo().auto_update_config(res.get("data", {}))

@try_except(show_exception_info=False, return_val_on_except=DnfHelperChronicleUserTaskList())
def query_dnf_helper_chronicle_user_task_list(self) -> DnfHelperChronicleUserTaskList:
@try_except(show_exception_info=False, return_val_on_except=(DnfHelperChronicleUserTaskList(), True))
def query_dnf_helper_chronicle_user_task_list(self) -> tuple[DnfHelperChronicleUserTaskList, bool]:
res = self.dzhu_post("任务信息", "getUserTaskList", self.get_common_params())
return DnfHelperChronicleUserTaskList().auto_update_config(res.get("data", {}))

user_task_info = DnfHelperChronicleUserTaskList().auto_update_config(res.get("data", {}))
# {'result': 0, 'returnCode': -30003, 'returnMsg': '登录态失效,请重新登录'}
token_expired = res.get("returnCode", 0) == -30003

return user_task_info, token_expired

@try_except(return_val_on_except=False)
def check_dnf_helper_chronicle_auto_match(self, user_buy_info: BuyInfo, print_waring=True) -> bool:
Expand Down
8 changes: 7 additions & 1 deletion main_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,10 +948,16 @@ def get_account_status(idx: int, account_config: AccountConfig, common_config: C
levelInfo, chronicle_points = djcHelper.query_dnf_helper_chronicle_info().get_level_info_and_points_to_show()

partner_Info = ""
user_task_info = djcHelper.query_dnf_helper_chronicle_user_task_list()
user_task_info, token_expired = djcHelper.query_dnf_helper_chronicle_user_task_list()
if user_task_info.hasPartner:
partner_Info = user_task_info.get_partner_info(account_config.dnf_helper_info)

if token_expired:
if account_config.dnf_helper_info.token != "":
levelInfo = "token已过期"
else:
levelInfo = "token未配置"

user_info_db = (
DnfHelperChronicleUserActivityTopInfoDB().with_context(djcHelper.get_dnf_helper_chronicle_db_key()).load()
)
Expand Down

0 comments on commit 7cbc7b9

Please sign in to comment.