Skip to content

Commit

Permalink
fix: 某些情况下获取用户等级失败导致出错
Browse files Browse the repository at this point in the history
  • Loading branch information
chen310 committed Mar 5, 2022
1 parent 9043e8e commit 40de372
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions user.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,21 @@ def userInfo(self):
self.taskInfo('歌单总收藏数', resp['profile']['playlistBeSubscribedCount'])

resp = self.music.user_level()
self.full = resp['full']
if not self.full:
self.taskInfo('距离下级还需播放', str(
resp['data']['nextPlayCount'] - resp['data']['nowPlayCount']) + '首歌')
self.taskInfo('距离下级还需登录', str(
resp['data']['nextLoginCount'] - resp['data']['nowLoginCount']) + '天')
if resp['data']['nowPlayCount'] >= 20000:
self.songFull = True
if 'full' in resp:
self.full = resp['full']
else:
if 'data' in resp and 'level' in resp['data']:
self.full = (resp['data']['level'] == 10)
else:
print('获取用户等级失败:' + str(resp))
if 'data' in resp:
if not self.full:
self.taskInfo('距离下级还需播放', str(
resp['data']['nextPlayCount'] - resp['data']['nowPlayCount']) + '首歌')
self.taskInfo('距离下级还需登录', str(
resp['data']['nextLoginCount'] - resp['data']['nowLoginCount']) + '天')
if resp['data']['nowPlayCount'] >= 20000:
self.songFull = True
self.finishTask()

def resize(self, total):
Expand Down

0 comments on commit 40de372

Please sign in to comment.