feat: add login test fun in unlock
This commit is contained in:
parent
30a7ab684e
commit
c6c00321b0
25
main.py
25
main.py
@ -202,11 +202,26 @@ def unlock_process():
|
||||
return jsonify({"apiName": "unlock", "apiInfo": "Unlock All DX Master Charts.", "apiUsage": "/unlock?userid=<userId>"})
|
||||
else:
|
||||
userId = int(userId)
|
||||
unlock(userId)
|
||||
returnCode = 200
|
||||
status = "200 OK"
|
||||
info = "Succeed."
|
||||
log = {"UserLoginApiStatus": 1, "UploadUserPlaylogApiStatus": 1, "UpsertUserAllApi": 1, "UserLogoutApiStatus": 1}
|
||||
timestamp = int(time.time())
|
||||
login_data = login(userId, timestamp)
|
||||
if login_data['returnCode'] == 102:
|
||||
returnCode = 403
|
||||
status = "403 Forbidden"
|
||||
info = "Unable to operate. Please refresh QrCode."
|
||||
log = {}
|
||||
elif login_data['returnCode'] == 100:
|
||||
returnCode = 403
|
||||
status = "403 Forbidden"
|
||||
info = "Unable to operate. Probably User has logged in."
|
||||
log = {}
|
||||
elif login_data['returnCode'] == 1:
|
||||
userdata_result = userdata(userId)
|
||||
logout(userId, timestamp)
|
||||
unlock(userId)
|
||||
returnCode = 200
|
||||
status = "200 OK"
|
||||
info = "Succeed."
|
||||
log = {"UserLoginApiStatus": 1, "UploadUserPlaylogApiStatus": 1, "UpsertUserAllApi": 1, "UserLogoutApiStatus": 1}
|
||||
data = jsonify({"status": status, "timestamp": timestamp, "info": info, "apiName": "unlock", "date": datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%a, %d %b %Y %H:%M:%S GMT+8'), "userId": userId})
|
||||
return data
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user