Skip to content

Commit

Permalink
<jx3>[feat]update serendipity info source
Browse files Browse the repository at this point in the history
  • Loading branch information
HornCopper committed Sep 16, 2024
1 parent b9ae4f1 commit 3fede54
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins/jx3/horse/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def parse_info(raw_msg: str, flush_time: str):
chitu_flushed = False
if is_in_current_cycle(ct_data["data"]["list"][0]["time"]):
chitu_flushed = True
dl_data = await get_api(f"https://next2.jx3box.com/api/game/reporter/horse?pageIndex=1&pageSize=50&server{server}&type=dilu-horse&subtype=share_msg")
dl_data = await get_api(f"https://next2.jx3box.com/api/game/reporter/horse?pageIndex=1&pageSize=50&server={server}&type=dilu-horse&subtype=share_msg")
dilu_flushed = False
if is_in_current_week(dl_data["data"]["list"][0]["time"]):
dilu_flushed = True
Expand Down
19 changes: 18 additions & 1 deletion src/plugins/jx3/serendipity/without_jx3api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from src.tools.config import Config
from src.tools.utils.request import post_url, get_api, get_url
from src.tools.basic.jx3 import gen_ts, gen_xsk, format_body
from src.tools.basic.server import Zone_mapping
from src.tools.utils.path import ASSETS

from src.plugins.jx3.bind import get_player_local_data, Player
Expand All @@ -27,6 +28,7 @@ def __init__(self):
self.tl = []
self.my = []
self.jx3pet = []
self.jx3mm = []

def get_serendipity_level(self, serendipity_name: str) -> int:
if serendipity_name.find("宠物奇缘") != -1:
Expand Down Expand Up @@ -120,8 +122,23 @@ async def get_jx3pet_data(self, server: str, name: str):
)
self.jx3pet = serendipities

async def get_jx3mm_data(self, server: str, name: str):
final_url = f"https://www.jx3mm.com/home/qyinfo?m=1&R={Zone_mapping(server)}&S={server}&t=&u=&n={name}"
data = await get_api(final_url)
serendipities = []
for serendipity in data["result"]:
serendipities.append(
{
"name": serendipity["serendipity"],
"level": self.get_serendipity_level(serendipity["serendipity"]),
"time": serendipity["time"]
}
)
self.jx3mm = serendipities

async def integration(self, server: str, name: str):
await self.get_tuilan_data(server, name)
await self.get_my_data(server, name)
await self.get_jx3pet_data(server, name)
return sort_list_of_dicts(merge_dict_lists(merge_dict_lists(self.tl, self.my), self.jx3pet), "time")[::-1]
await self.get_jx3mm_data(server, name)
return sort_list_of_dicts(merge_dict_lists(merge_dict_lists(merge_dict_lists(self.tl, self.my), self.jx3pet), self.jx3mm), "time")[::-1]

0 comments on commit 3fede54

Please sign in to comment.