Skip to content

Commit

Permalink
音乐人任务获取失败时重试
Browse files Browse the repository at this point in the history
  • Loading branch information
chen310 committed Mar 21, 2022
1 parent c4f5cdc commit e2d7fd0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion user.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,12 +578,20 @@ def sign(self):

def get_missions(self):
cycle_result = self.music.mission_cycle_get()
if cycle_result['code'] != 200:
time.sleep(0.2)
cycle_result = self.music.mission_cycle_get()
time.sleep(0.5)
stage_result = self.music.mission_stage_get()
if stage_result['code'] != 200:
time.sleep(0.2)
stage_result = self.music.mission_stage_get()

missions = []
if cycle_result['code'] == 200:
missions.extend(cycle_result.get('data', {}).get('list', []))
else:
print('每日任务获取失败:', self.errMsg(cycle_result))
if stage_result['code'] == 200:
for mission in stage_result['data']['list']:
for target in mission['userStageTargetList']:
Expand All @@ -595,7 +603,8 @@ def get_missions(self):
if 'userMissionId' in target:
m['userMissionId'] = target['userMissionId']
missions.append(m)

else:
print('每周任务获取失败:', self.errMsg(stage_result))
return missions

def musician_task(self):
Expand Down

0 comments on commit e2d7fd0

Please sign in to comment.