Update medal API (#2341)

This commit is contained in:
the1812 2021-10-03 14:58:27 +08:00
parent dabda01846
commit 85442453f3
8 changed files with 32 additions and 15 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -176,7 +176,7 @@
"mdi.min.js": "8A22F2F37F88F74FC07CE2FECA7CE135182058BE24409BAF3DEF0D5845B0BE1A", "mdi.min.js": "8A22F2F37F88F74FC07CE2FECA7CE135182058BE24409BAF3DEF0D5845B0BE1A",
"medal-helper.min.css": "D27933BDA0CEAC6916271A9EAA0803342290207CC44AD1916B0244BE7BA3CBEE", "medal-helper.min.css": "D27933BDA0CEAC6916271A9EAA0803342290207CC44AD1916B0244BE7BA3CBEE",
"medal-helper.min.html": "5D7057259368BE97DED3375DD904695B245AA2BF338C5E18CB3CF61DD913617C", "medal-helper.min.html": "5D7057259368BE97DED3375DD904695B245AA2BF338C5E18CB3CF61DD913617C",
"medal-helper.min.js": "78B32AC5965B3C4A07571AB05AED7B3125F9CA33A67DFB7595FFBC2DB678FC8D", "medal-helper.min.js": "8EDA07A5DB9737437BAB9634712D536EE76B55F35DE758C126546849030B82F3",
"menu-repeat-video.min.js": "A8A8CE04FC9B8B4118A2358488DE1BF5A9F576A24A657861426696C565EC7197", "menu-repeat-video.min.js": "A8A8CE04FC9B8B4118A2358488DE1BF5A9F576A24A657861426696C565EC7197",
"minimal-home.vue.min.js": "DFA2E873F7948766950084DB5640A1299F63A6E45BAC943A3D1B9CB0E4A2E19F", "minimal-home.vue.min.js": "DFA2E873F7948766950084DB5640A1299F63A6E45BAC943A3D1B9CB0E4A2E19F",
"minimal-home-search.vue.min.js": "83ACE262CBA7CB68260746B25DD3009D12BA351220F5732BD74EF0B87CBB5D3A", "minimal-home-search.vue.min.js": "83ACE262CBA7CB68260746B25DD3009D12BA351220F5732BD74EF0B87CBB5D3A",

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -20,19 +20,36 @@ class Medal extends Badge {
roomID: number roomID: number
isLighted: boolean isLighted: boolean
constructor(json: any) { constructor(json: any) {
const { medal_id, status, level, medalName, uname, roomid, is_lighted } = json const {
super(status === 1, medal_id) medal: {
medal_id,
level,
medal_name,
wearing_status,
is_lighted,
},
anchor_info: {
nick_name,
},
room_info: {
room_id,
},
} = json
super(wearing_status === 1, medal_id)
this.level = level this.level = level
this.name = medalName this.name = medal_name
this.upName = uname this.upName = nick_name
this.roomID = roomid this.roomID = room_id
this.isLighted = is_lighted this.isLighted = is_lighted
} }
static async getList(): Promise<Medal[]> { static async getList(): Promise<Medal[]> {
return Badge.parseJson( return Badge.parseJson(
await Ajax.getTextWithCredentials("https://api.live.bilibili.com/i/api/medal?page=1&pageSize=256"), await Ajax.getTextWithCredentials(`https://api.live.bilibili.com/xlive/app-ucenter/v1/fansMedal/panel?page=1&page_size=256&target_id=${getUID()}`),
{ {
successAction: json => json.data.fansMedalList.map((it: any) => new Medal(it)), successAction: json => {
const list: any[] = (json.data.list ?? []).concat(json.data.special_list ?? [])
return list.map(it => new Medal(it))
},
errorAction: () => [], errorAction: () => [],
errorMessage: "无法获取勋章列表.", errorMessage: "无法获取勋章列表.",
}) })