mirror of
https://github.com/PaiGramTeam/FixMiYouShe.git
synced 2024-11-24 09:15:34 +00:00
feat: support os channel
All checks were successful
Docker Build / docker build and publish (push) Successful in 1m14s
All checks were successful
Docker Build / docker build and publish (push) Successful in 1m14s
This commit is contained in:
parent
62fa646257
commit
664a47ad6e
@ -6,12 +6,14 @@ from typing import Any, List, Optional, Dict
|
||||
from pydantic import BaseModel, PrivateAttr, Field, AliasChoices
|
||||
|
||||
GAME_ID_MAP = {"bh3": 1, "ys": 2, "bh2": 3, "wd": 4, "dby": 5, "sr": 6, "zzz": 8}
|
||||
GAME_STR_MAP = {1: "bh3", 2: "ys", 3: "bh2", 4: "wd", 5: "dby", 6: "sr", 8: "zzz"}
|
||||
GAME_STR_MAP = {v: k for k, v in GAME_ID_MAP.items()}
|
||||
CHANNEL_MAP = {"ys": "yuanshen", "sr": "HSRCN", "zzz": "ZZZ_Game"}
|
||||
CHANNEL_OS_MAP = {"ys": "GenshinOverseas", "sr": "HSRCN", "zzz": "ZZZ_Game"}
|
||||
__all__ = (
|
||||
"GAME_ID_MAP",
|
||||
"GAME_STR_MAP",
|
||||
"CHANNEL_MAP",
|
||||
"CHANNEL_OS_MAP",
|
||||
"clean_url",
|
||||
"get_images_params",
|
||||
"PostStat",
|
||||
|
@ -3,17 +3,17 @@
|
||||
{
|
||||
"id": "2",
|
||||
"icon": "https://fastcdn.hoyoverse.com/static-resource-v2/2023/11/08/9db76fb146f82c045bc276956f86e047_6878380451593228482.png",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/05/30/45f550e5d5bf4f216011450466453a74_2229377313645390599.jpg?x-oss-process=image%2Fauto-orient%2C0%2Finterlace%2C1%2Fformat%2Cwebp%2Fquality%2Cq_70",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/07/11/af3fa25fb0cac1959da97b6b867fdb57_6289156149732603194.jpg?x-oss-process=image/auto-orient,0/interlace,1/format,webp/quality,q_70",
|
||||
"name": "原神",
|
||||
"bg_color": "#9DAF77",
|
||||
"bg_color": "#244C74",
|
||||
"focus_channel_id": "30"
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"icon": "https://hyl-static-res-prod.hoyolab.com/communityweb/business/starrail_hoyoverse.png",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/06/07/97ff3a94b16fc6623851731407eefff1_3539500584346988147.jpg?x-oss-process=image%2Fauto-orient%2C0%2Finterlace%2C1%2Fformat%2Cwebp%2Fquality%2Cq_70",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/07/31/8981eebc4cd223331a0eedaca9b73f19_928166619611008481.jpg?x-oss-process=image/auto-orient,0/interlace,1/format,webp/quality,q_70",
|
||||
"name": "崩坏:星穹铁道",
|
||||
"bg_color": "#5D0AC9",
|
||||
"bg_color": "#101521",
|
||||
"focus_channel_id": "42"
|
||||
},
|
||||
{
|
||||
@ -27,25 +27,25 @@
|
||||
{
|
||||
"id": "1",
|
||||
"icon": "https://fastcdn.hoyoverse.com/static-resource-v2/2024/02/29/3d96534fd7a35a725f7884e6137346d1_3942255444511793944.png",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/06/04/28e9275e92f4362d4909770009304971_5774434829021569250.jpg?x-oss-process=image%2Fauto-orient%2C0%2Finterlace%2C1%2Fformat%2Cwebp%2Fquality%2Cq_70",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/07/24/c6e8a685963be61470df222b71e28a3f_2653988210193011390.jpg?x-oss-process=image/auto-orient,0/interlace,1/format,webp/quality,q_70",
|
||||
"name": "Honkai Impact 3rd",
|
||||
"bg_color": "#0A2966",
|
||||
"bg_color": "#581312",
|
||||
"focus_channel_id": "0"
|
||||
},
|
||||
{
|
||||
"id": "4",
|
||||
"icon": "https://hyl-static-res-prod.hoyolab.com/communityweb/business/nxx_hoyoverse.png",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/07/12/6884e4a2d1200dac51ac55391b377a74_8800404318031699849.png?x-oss-process=image/auto-orient,0/interlace,1/format,webp/quality,q_70",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2023/10/24/d97b3eb5763dba18bc137929ce53ba24_8118580296436267822.png",
|
||||
"name": "未定事件簿",
|
||||
"bg_color": "#1D1D1F",
|
||||
"bg_color": "#2E3857",
|
||||
"focus_channel_id": "0"
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"icon": "https://webstatic.hoyoverse.com/upload/static-resource/2022/08/04/8a31e3d6bce7684556cd45b1e1c309bf_1216320235452608527.png",
|
||||
"bg": "https://fastcdn.hoyoverse.com/static-resource-v2/2023/08/01/f9d8c5df30c96d6d5c50aa10e201b171_429483834205307540.jpg",
|
||||
"bg": "https://upload-os-bbs.hoyolab.com/upload/2024/08/09/1e4a3ac09f82fd7f7702c3ec19dc38fd_7412144515818250508.jpg?x-oss-process=image/auto-orient,0/interlace,1/format,webp/quality,q_70",
|
||||
"name": "HoYoLAB",
|
||||
"bg_color": "#24479B",
|
||||
"bg_color": "#61C1F2",
|
||||
"focus_channel_id": "0"
|
||||
}
|
||||
]
|
||||
|
@ -12,6 +12,7 @@ from src.api.models import (
|
||||
PostType,
|
||||
PostRecommend,
|
||||
CHANNEL_MAP,
|
||||
CHANNEL_OS_MAP,
|
||||
GAME_ID_MAP,
|
||||
get_images_params,
|
||||
clean_url,
|
||||
@ -162,9 +163,10 @@ def get_public_data(
|
||||
related_posts: Callable[[PostInfo, I18n], List[PostRecommend]],
|
||||
i18n: I18n,
|
||||
) -> Dict:
|
||||
channel_map = CHANNEL_OS_MAP if post_info.hoyolab else CHANNEL_MAP
|
||||
return {
|
||||
"published_time": post_info.created_at.strftime("%Y-%m-%dT%H:%M:%S.%fZ"),
|
||||
"channel": CHANNEL_MAP.get(post_info.game_id_str, "HSRCN"),
|
||||
"channel": channel_map.get(post_info.game_id_str, "HSRCN"),
|
||||
"stat": parse_stat(post_info.stat),
|
||||
"post": post_info,
|
||||
"author": post_info["post"]["user"],
|
||||
|
Loading…
Reference in New Issue
Block a user