Skip to content

Commit

Permalink
feat: 七圣召唤赛事状态检测
Browse files Browse the repository at this point in the history
Signed-off-by: Womsxd <[email protected]>
  • Loading branch information
Womsxd committed Aug 28, 2024
1 parent 9055295 commit 681ec6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions competition.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def set_hk4e_token(self, hk4e_token: str):
"""
self.headers['Cookie'] = f'e_hk4e_token={hk4e_token}'

def get_status(self):
response = self.http.get(setting.genius_invokation_status, params=self.params, headers=self.headers)
if response.status_code != 200:
return None
data = response.json()
if data['retcode'] == -521030: # 系统正在维护中
return False
return True

def get_info(self):
"""
获取账号信息
Expand Down Expand Up @@ -193,6 +202,9 @@ def run_task(self):
log.warning("账号没有绑定任何原神账号!")
result += "账号没有绑定任何原神账号!"
return result
if not self.get_status():
log.warning("七圣赛事维护中")
return result
self.get_task_list()
time.sleep(random.randint(3, 8))
task_config = config.config['competition']['genius_invokation']
Expand Down
1 change: 1 addition & 0 deletions setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
hk4e_token_get_info_url = f'{web_api}/common/badge/v1/login/info'
# 获取hk4e token
get_hk4e_token_url = f'{web_api}/common/badge/v1/login/account'
genius_invokation_status = f'{hk4e_api_base_url}/event/geniusinvokationtcg/rd_info'
# 获取任务列表
genius_invokation_task_url = f'{hk4e_api_base_url}/event/geniusinvokationtcg/adventure_task_list'
# 领取任务奖励
Expand Down

0 comments on commit 681ec6e

Please sign in to comment.