forked from Hay1tsme/artemis
add login state at preview
This commit is contained in:
@ -38,7 +38,7 @@ class ChuniBase:
|
|||||||
self.logger.warn(
|
self.logger.warn(
|
||||||
"User ID %d attempted to log in while having a profile lock expiring on %s.",
|
"User ID %d attempted to log in while having a profile lock expiring on %s.",
|
||||||
user_id, lock_result["expires_at"],
|
user_id, lock_result["expires_at"],
|
||||||
extra=lock_result["extra"]
|
extra=lock_result["extra"] or {}
|
||||||
)
|
)
|
||||||
return {"returnCode": 0}
|
return {"returnCode": 0}
|
||||||
|
|
||||||
@ -669,9 +669,12 @@ class ChuniBase:
|
|||||||
return bytes([ord(c) for c in src]).decode("utf-8")
|
return bytes([ord(c) for c in src]).decode("utf-8")
|
||||||
|
|
||||||
async def handle_get_user_preview_api_request(self, data: Dict) -> Dict:
|
async def handle_get_user_preview_api_request(self, data: Dict) -> Dict:
|
||||||
profile = await self.data.profile.get_profile_preview(data["userId"], self.version)
|
user_id = int(data["userId"])
|
||||||
|
profile = await self.data.profile.get_profile_preview(user_id, self.version)
|
||||||
|
|
||||||
if profile is None:
|
if profile is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
profile_character = await self.data.item.get_character(
|
profile_character = await self.data.item.get_character(
|
||||||
data["userId"], profile["characterId"]
|
data["userId"], profile["characterId"]
|
||||||
)
|
)
|
||||||
@ -683,10 +686,12 @@ class ChuniBase:
|
|||||||
chara.pop("id")
|
chara.pop("id")
|
||||||
chara.pop("user")
|
chara.pop("user")
|
||||||
|
|
||||||
|
lock_result = await self.data.user.check_lock_for_game(user_id, self.game)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"userId": data["userId"],
|
"userId": data["userId"],
|
||||||
# Current Login State
|
# Current Login State
|
||||||
"isLogin": False,
|
"isLogin": lock_result is not None,
|
||||||
"lastLoginDate": profile["lastPlayDate"],
|
"lastLoginDate": profile["lastPlayDate"],
|
||||||
# User Profile
|
# User Profile
|
||||||
"userName": profile["userName"],
|
"userName": profile["userName"],
|
||||||
|
@ -152,9 +152,12 @@ class ChuniNew(ChuniBase):
|
|||||||
return {"userId": data["userId"], "symbolCharInfoList": []}
|
return {"userId": data["userId"], "symbolCharInfoList": []}
|
||||||
|
|
||||||
async def handle_get_user_preview_api_request(self, data: Dict) -> Dict:
|
async def handle_get_user_preview_api_request(self, data: Dict) -> Dict:
|
||||||
profile = await self.data.profile.get_profile_preview(data["userId"], self.version)
|
user_id = int(data["userId"])
|
||||||
|
profile = await self.data.profile.get_profile_preview(user_id, self.version)
|
||||||
|
|
||||||
if profile is None:
|
if profile is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
profile_character = await self.data.item.get_character(
|
profile_character = await self.data.item.get_character(
|
||||||
data["userId"], profile["characterId"]
|
data["userId"], profile["characterId"]
|
||||||
)
|
)
|
||||||
@ -165,11 +168,13 @@ class ChuniNew(ChuniBase):
|
|||||||
chara = profile_character._asdict()
|
chara = profile_character._asdict()
|
||||||
chara.pop("id")
|
chara.pop("id")
|
||||||
chara.pop("user")
|
chara.pop("user")
|
||||||
|
|
||||||
|
lock_result = await self.data.user.check_lock_for_game(user_id, self.game)
|
||||||
|
|
||||||
data1 = {
|
data1 = {
|
||||||
"userId": data["userId"],
|
"userId": data["userId"],
|
||||||
# Current Login State
|
# Current Login State
|
||||||
"isLogin": False,
|
"isLogin": lock_result is not None,
|
||||||
"lastLoginDate": profile["lastPlayDate"],
|
"lastLoginDate": profile["lastPlayDate"],
|
||||||
# User Profile
|
# User Profile
|
||||||
"userName": profile["userName"],
|
"userName": profile["userName"],
|
||||||
|
Reference in New Issue
Block a user