mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-06 03:33:45 +08:00
✨添加国际服每日签到功能 (#51)
* 添加国际服每日签到功能
* 🚨 `pre-commit-ci`修复格式错误
* fix server name
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
67d1615754
commit
f93ddbd885
@ -1,12 +1,16 @@
|
||||
# flake8: noqa
|
||||
OLD_URL = "https://api-takumi.mihoyo.com"
|
||||
NEW_URL = 'https://api-takumi-record.mihoyo.com'
|
||||
OS_URL = "https://sg-public-api.hoyolab.com"
|
||||
|
||||
STAR_RAIL_SIGN_INFO_URL = f'{OLD_URL}/event/luna/info'
|
||||
STAR_RAIL_SIGN_INFO_URL_OS = f'{OS_URL}/event/luna/os/info'
|
||||
STAR_RAIL_SIGN_LIST_URL = f'{OLD_URL}/event/luna/home'
|
||||
STAR_RAIL_SIGN_LIST_URL_OS = f'{OS_URL}/event/luna/os/home'
|
||||
STAR_RAIL_SIGN_EXTRA_INFO_URL = f'{OLD_URL}/event/luna/extra_info'
|
||||
STAR_RAIL_SIGN_EXTRA_REWARD_URL = f'{OLD_URL}/event/luna/extra_reward'
|
||||
STAR_RAIL_SIGN_URL = f'{OLD_URL}/event/luna/sign'
|
||||
STAR_RAIL_SIGN_URL_OS = f'{OS_URL}/event/luna/os/sign'
|
||||
STAR_RAIL_MONTH_INFO_URL = f'{OLD_URL}/event/srledger/month_info' # 开拓阅历接口
|
||||
STAR_RAIL_MONTH_DETAIL_URL = (
|
||||
f'{OLD_URL}/event/srledger/month_detail' # 开拓阅历详情接口
|
||||
|
@ -23,11 +23,11 @@ from ..sruid_utils.api.mys.models import (
|
||||
RECOGNIZE_SERVER = {
|
||||
'1': 'prod_gf_cn',
|
||||
'2': 'prod_gf_cn',
|
||||
# '5': 'cn_qd01',
|
||||
# '6': 'os_usa',
|
||||
# '7': 'os_euro',
|
||||
# '8': 'os_asia',
|
||||
# '9': 'os_cht',
|
||||
'5': 'prod_qd_cn',
|
||||
'6': 'prod_official_usa',
|
||||
'7': 'prod_official_euro',
|
||||
'8': 'prod_official_asia',
|
||||
'9': 'prod_official_cht',
|
||||
}
|
||||
|
||||
|
||||
@ -35,6 +35,9 @@ class MysApi(_MysApi):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def check_os(self, uid: str) -> bool:
|
||||
return False if int(str(uid)[0]) < 6 else True
|
||||
|
||||
async def create_qrcode_url(self) -> Union[Dict, int]:
|
||||
device_id: str = ''.join(random.choices(ascii_letters + digits, k=64))
|
||||
app_id: str = '8'
|
||||
@ -126,13 +129,13 @@ class MysApi(_MysApi):
|
||||
return data
|
||||
|
||||
async def get_sign_list(self, uid) -> Union[SignList, int]:
|
||||
# is_os = self.check_os(uid)
|
||||
is_os = False
|
||||
is_os = self.check_os(uid)
|
||||
if is_os:
|
||||
params = {
|
||||
'act_id': 'e202304121516551',
|
||||
'act_id': 'e202303301540311',
|
||||
'lang': 'zh-cn',
|
||||
}
|
||||
|
||||
else:
|
||||
params = {
|
||||
'act_id': 'e202304121516551',
|
||||
@ -147,19 +150,17 @@ class MysApi(_MysApi):
|
||||
|
||||
async def get_sign_info(self, uid) -> Union[SignInfo, int]:
|
||||
# server_id = RECOGNIZE_SERVER.get(str(uid)[0])
|
||||
# is_os = self.check_os(uid)
|
||||
is_os = False
|
||||
is_os = self.check_os(uid)
|
||||
if is_os:
|
||||
# TODO
|
||||
params = {
|
||||
'act_id': 'e202304121516551',
|
||||
'act_id': 'e202303301540311',
|
||||
'lang': 'zh-cn',
|
||||
'region': 'prod_gf_cn',
|
||||
'uid': uid,
|
||||
}
|
||||
header = {
|
||||
'DS': generate_os_ds(),
|
||||
}
|
||||
HEADER = copy.deepcopy(self._HEADER_OS)
|
||||
HEADER['Cookie'] = await self.get_ck(uid, 'OWNER')
|
||||
HEADER['DS'] = generate_os_ds()
|
||||
header = HEADER
|
||||
else:
|
||||
params = {
|
||||
'act_id': 'e202304121516551',
|
||||
@ -227,7 +228,19 @@ class MysApi(_MysApi):
|
||||
},
|
||||
)
|
||||
else:
|
||||
data = -99
|
||||
HEADER = copy.deepcopy(self._HEADER_OS)
|
||||
HEADER['Cookie'] = ck
|
||||
HEADER['DS'] = generate_os_ds()
|
||||
HEADER.update(header)
|
||||
data = await self._mys_request(
|
||||
url=_API['STAR_RAIL_SIGN_URL_OS'],
|
||||
method='POST',
|
||||
header=HEADER,
|
||||
data={
|
||||
'act_id': 'e202303301540311',
|
||||
'lang': 'zh-cn',
|
||||
},
|
||||
)
|
||||
if isinstance(data, Dict):
|
||||
data = cast(MysSign, data['data'])
|
||||
return data
|
||||
|
Loading…
x
Reference in New Issue
Block a user