mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2025-04-12 23:29:37 +08:00
修复私人ck到上限的处理问题
This commit is contained in:
parent
659d8bdf1c
commit
ab7ca08575
@ -20,7 +20,10 @@ async def get_abyss_data(user_id, uid, schedule_type = "1", use_cache=True):
|
|||||||
headers = get_headers(q=f'role_id={uid}&schedule_type={schedule_type}&server={server_id}', cookie=cookie['cookie'])
|
headers = get_headers(q=f'role_id={uid}&schedule_type={schedule_type}&server={server_id}', cookie=cookie['cookie'])
|
||||||
res = await aiorequests.get(url=url, headers=headers, params=params)
|
res = await aiorequests.get(url=url, headers=headers, params=params)
|
||||||
data = await res.json()
|
data = await res.json()
|
||||||
if await check_retcode(data, cookie, uid):
|
check = await check_retcode(data, cookie, uid)
|
||||||
|
if check == '私人cookie达到了每日30次查询上限':
|
||||||
|
return check
|
||||||
|
elif check:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
@ -43,6 +46,7 @@ async def get_daily_note_data(uid):
|
|||||||
else:
|
else:
|
||||||
return f'你的uid{uid}的cookie已过期,需要重新绑定哦!'
|
return f'你的uid{uid}的cookie已过期,需要重新绑定哦!'
|
||||||
|
|
||||||
|
|
||||||
@cache(ttl=datetime.timedelta(hours=1))
|
@cache(ttl=datetime.timedelta(hours=1))
|
||||||
async def get_player_card_data(user_id, uid, use_cache=True):
|
async def get_player_card_data(user_id, uid, use_cache=True):
|
||||||
server_id = "cn_qd01" if uid[0] == '5' else "cn_gf01"
|
server_id = "cn_qd01" if uid[0] == '5' else "cn_gf01"
|
||||||
@ -57,8 +61,11 @@ async def get_player_card_data(user_id, uid, use_cache=True):
|
|||||||
return '现在派蒙没有可以用的cookie哦,可能是:\n1.公共cookie全都达到了每日30次上限\n2.公共池全都失效了或没有cookie\n让管理员使用 添加公共ck 吧!'
|
return '现在派蒙没有可以用的cookie哦,可能是:\n1.公共cookie全都达到了每日30次上限\n2.公共池全都失效了或没有cookie\n让管理员使用 添加公共ck 吧!'
|
||||||
headers = get_headers(q=f'role_id={uid}&server={server_id}', cookie=cookie['cookie'])
|
headers = get_headers(q=f'role_id={uid}&server={server_id}', cookie=cookie['cookie'])
|
||||||
res = await aiorequests.get(url=url, headers=headers, params=params)
|
res = await aiorequests.get(url=url, headers=headers, params=params)
|
||||||
data = await res.json()
|
data = await res.json()
|
||||||
if await check_retcode(data, cookie, uid):
|
check = await check_retcode(data, cookie, uid)
|
||||||
|
if check == '私人cookie达到了每日30次查询上限':
|
||||||
|
return check
|
||||||
|
elif check:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@cache(ttl=datetime.timedelta(hours=1))
|
@cache(ttl=datetime.timedelta(hours=1))
|
||||||
@ -77,7 +84,10 @@ async def get_chara_detail_data(user_id, uid, use_cache=True):
|
|||||||
headers = get_headers(b=json_data, cookie=cookie['cookie'])
|
headers = get_headers(b=json_data, cookie=cookie['cookie'])
|
||||||
res = await aiorequests.post(url=url, headers=headers, json=json_data)
|
res = await aiorequests.post(url=url, headers=headers, json=json_data)
|
||||||
data = await res.json()
|
data = await res.json()
|
||||||
if await check_retcode(data, cookie, uid):
|
check = await check_retcode(data, cookie, uid)
|
||||||
|
if check == '私人cookie达到了每日30次查询上限':
|
||||||
|
return check
|
||||||
|
elif check:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@cache(ttl=datetime.timedelta(hours=1))
|
@cache(ttl=datetime.timedelta(hours=1))
|
||||||
@ -96,7 +106,6 @@ async def get_chara_skill_data(uid, chara_id, use_cache=True):
|
|||||||
}
|
}
|
||||||
res = await aiorequests.get(url=url, headers=headers, params=params)
|
res = await aiorequests.get(url=url, headers=headers, params=params)
|
||||||
data = await res.json()
|
data = await res.json()
|
||||||
# TODO:待定,未知cookie对技能的影响
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@cache(ttl=datetime.timedelta(hours=1))
|
@cache(ttl=datetime.timedelta(hours=1))
|
||||||
@ -115,7 +124,10 @@ async def get_monthinfo_data(uid, month, use_cache=True):
|
|||||||
}
|
}
|
||||||
res = await aiorequests.get(url=url, headers=headers, params=params)
|
res = await aiorequests.get(url=url, headers=headers, params=params)
|
||||||
data = await res.json()
|
data = await res.json()
|
||||||
if await check_retcode(data, cookie, uid):
|
check = await check_retcode(data, cookie, uid)
|
||||||
|
if check == '私人cookie达到了每日30次查询上限':
|
||||||
|
return check
|
||||||
|
elif check:
|
||||||
return data
|
return data
|
||||||
else:
|
else:
|
||||||
return f'你的uid{uid}的cookie已过期,需要重新绑定哦!'
|
return f'你的uid{uid}的cookie已过期,需要重新绑定哦!'
|
||||||
@ -161,6 +173,8 @@ async def get_sign_info(uid):
|
|||||||
data = await res.json()
|
data = await res.json()
|
||||||
if await check_retcode(data, cookie, uid):
|
if await check_retcode(data, cookie, uid):
|
||||||
return data
|
return data
|
||||||
|
else:
|
||||||
|
return f'你的uid{uid}的cookie已过期,需要重新绑定哦!'
|
||||||
|
|
||||||
# 执行签到操作
|
# 执行签到操作
|
||||||
async def sign(uid):
|
async def sign(uid):
|
||||||
|
@ -73,6 +73,7 @@ async def check_retcode(data, cookie, uid):
|
|||||||
await delete_cookie_cache(cookie['cookie'], key='cookie')
|
await delete_cookie_cache(cookie['cookie'], key='cookie')
|
||||||
elif cookie['type'] == 'private':
|
elif cookie['type'] == 'private':
|
||||||
logger.info(f'用户{cookie["user_id"]}的uid{cookie["uid"]}私人cookie达到了每日30次查询上限')
|
logger.info(f'用户{cookie["user_id"]}的uid{cookie["uid"]}私人cookie达到了每日30次查询上限')
|
||||||
|
return '私人cookie达到了每日30次查询上限'
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
await update_cookie_cache(cookie['cookie'], uid, 'uid')
|
await update_cookie_cache(cookie['cookie'], uid, 'uid')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user