mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
🐛 更换v2地址
This commit is contained in:
parent
b5323c8770
commit
910dd4d19d
3 changed files with 8 additions and 20 deletions
|
|
@ -5,3 +5,6 @@ export const ZZZ_RES = 'https://act-webstatic.mihoyo.com/game_record/zzz',
|
|||
export const NEW_ZZZ_RES = 'https://act-webstatic.mihoyo.com/game_record/nap',
|
||||
NEW_ZZZ_SQUARE_AVATAR = `${NEW_ZZZ_RES}/role_square_avatar`,
|
||||
NEW_ZZZ_SQUARE_BANGBOO = `${NEW_ZZZ_RES}/bangboo_rectangle_avatar`;
|
||||
export const ZZZ_RES_V2 = `https://act-webstatic.mihoyo.com/game_record/zzzv2`,
|
||||
ZZZ_SQUARE_AVATAR_V2 = `${ZZZ_RES_V2}/role_square_avatar_v2`,
|
||||
ZZZ_SQUARE_BANGBOO_V2 = `${ZZZ_RES_V2}/bangboo_rectangle_avatar`;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ import {
|
|||
export const getSquareAvatar = async charID => {
|
||||
const filename = `role_square_avatar_${charID}.png`;
|
||||
const result = await downloadMysImage(
|
||||
'ZZZ_SQUARE_AVATAR',
|
||||
'ZZZ_SQUARE_AVATAR_V2',
|
||||
'ZZZ_SQUARE_AVATAR_PATH',
|
||||
filename,
|
||||
'NEW_ZZZ_SQUARE_AVATAR'
|
||||
filename
|
||||
);
|
||||
return result;
|
||||
};
|
||||
|
|
@ -46,10 +45,9 @@ export const getSmallSquareAvatar = async charID => {
|
|||
export const getSquareBangboo = async bangbooId => {
|
||||
const filename = `bangboo_rectangle_avatar_${bangbooId}.png`;
|
||||
const result = await downloadMysImage(
|
||||
'ZZZ_SQUARE_BANGBOO',
|
||||
'ZZZ_SQUARE_BANGBOO_V2',
|
||||
'ZZZ_SQUARE_BANGBOO_PATH',
|
||||
filename,
|
||||
'NEW_ZZZ_SQUARE_BANGBOO'
|
||||
filename
|
||||
);
|
||||
return result;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,27 +10,14 @@ import * as LocalURI from './const.js';
|
|||
* @param {keyof MysURL} base 远程地址
|
||||
* @param {keyof LocalURI} localBase 本地地址
|
||||
* @param {string} filename 文件名
|
||||
* @param {keyof MysURL} newBase 新远程地址
|
||||
* @returns {Promise<string | null>} 保存路径
|
||||
*/
|
||||
export const downloadMysImage = async (
|
||||
base,
|
||||
localBase,
|
||||
filename,
|
||||
newBase = ''
|
||||
) => {
|
||||
export const downloadMysImage = async (base, localBase, filename) => {
|
||||
base = MysURL[base];
|
||||
localBase = LocalURI[localBase];
|
||||
if (!!newBase) {
|
||||
newBase = MysURL[newBase];
|
||||
}
|
||||
const finalPath = path.join(localBase, filename);
|
||||
let url = `${base}/${filename}`;
|
||||
let result = await checkFile(url, finalPath);
|
||||
if (!result && !!newBase) {
|
||||
url = `${newBase}/${filename}`;
|
||||
result = await checkFile(url, finalPath);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue