add mai2 UserIntimateApi

This commit is contained in:
ppc
2024-09-16 17:56:22 +01:00
parent 77aa1afaa0
commit d8169e37cc
3 changed files with 103 additions and 0 deletions

View File

@@ -264,6 +264,11 @@ class Mai2DX(Mai2Base):
if "user2pPlaylog" in upsert:
await self.data.score.put_playlog_2p(user_id, upsert["user2pPlaylog"])
# added in BUDDiES+
if "userIntimateList" in upsert and len(upsert["userIntimateList"]) > 0:
for intimate in upsert["userIntimateList"]:
await self.data.profile.put_intimacy(user_id, intimate["partnerId"], intimate["intimateLevel"], intimate["intimateCountRewarded"])
return {"returnCode": 1, "apiName": "UpsertUserAllApi"}
async def handle_get_user_data_api_request(self, data: Dict) -> Dict:
@@ -713,6 +718,24 @@ class Mai2DX(Mai2Base):
ret['loginId'] = ret.get('loginCount', 0)
return ret
# Intimate api added in BUDDiES+
async def handle_get_user_intimate_api_request(self, data: Dict) -> Dict:
intimate = await self.data.profile.get_intimacy(data["userId"])
if intimate is None:
return {}
partner_list = [{
"partnerId": i["partnerId"],
"intimateLevel": i["intimateLevel"],
"intimateCountRewarded": i["intimateCountRewarded"]
} for i in intimate]
return {
"userId": data["userId"],
"length": len(partner_list),
"userIntimateList": partner_list
}
# CardMaker support added in Universe
async def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict:
p = await self.data.profile.get_profile_detail(data["userId"], self.version)