#更新面板支持B服角色

This commit is contained in:
yoimiya-kokomi 2022-06-15 06:14:58 +08:00
parent 8e57b7690b
commit d571eb235e
4 changed files with 19 additions and 19 deletions

View File

@ -744,7 +744,7 @@ export async function renderProfile(e, char, render, mode = "profile", params =
}
//await profileHelp(e);
return true;
} else if (!['enka', 'input2', 'ysin', 'ysin-pre'].includes(profile.dataSource)) {
} else if (!['enka', 'input2', 'miao', 'miao-pre'].includes(profile.dataSource)) {
if (!await refresh()) {
e.reply(`由于数据格式升级,请重新获取面板信息后查看`);
}
@ -960,7 +960,7 @@ export async function getProfileAll(e) {
let chars = [];
lodash.forEach(profiles || [], (ds) => {
if (!['enka', 'input2', 'ysin-pre', 'ysin'].includes(ds.dataSource)) {
if (!['enka', 'input2', 'miao-pre', 'miao'].includes(ds.dataSource)) {
return;
}
ds.name && chars.push(ds.name)

View File

@ -6,7 +6,7 @@ import Character from "./models/Character.js";
import Reliquaries from "./models/Reliquaries.js";
import Data from "./data/enka.js";
import Ysin from "./profile/ysin.js";
import Miao from "./profile/miao.js";
import Enka from "./profile/enka.js";
const _path = process.cwd();
@ -32,7 +32,7 @@ function sleep(ms) {
function getServ(uid) {
if ((uid + '')[0] === '5') {
return Ysin;
return Miao;
}
return Enka;
}
@ -79,7 +79,7 @@ let Profile = {
userData.chars = userData.chars || {};
lodash.forEach(data.chars, (char, charId) => {
let original = userData.chars[charId] || {};
if (char.dataSource === "ysin-pre" && original && original.dataSource) {
if (char.dataSource === "miao-pre" && original && original.dataSource) {
original.dataSource = char.dataSource;
} else {
userData.chars[charId] = char;

View File

@ -2,13 +2,13 @@ import fetch from "node-fetch";
import lodash from "lodash";
import Character from "../models/Character.js";
import moment from "moment";
import { artiIdx, artiSetMap, attrMap } from "./ysin_meta.js";
import { artiIdx, artiSetMap, attrMap } from "./miao_meta.js";
import cmeta from "../data/enka_char.js";
const url = "http://miaoapi.cn/profile";
let Ysin = {
key: "ysin",
let Miao = {
key: "miao",
cd: 1,
async request({ e, uid, avatar = '' }) {
let api = `${url}/list?uid=${uid}`;
@ -25,7 +25,7 @@ let Ysin = {
return false;
}
return Ysin.getData(uid, data);
return Miao.getData(uid, data);
},
@ -43,7 +43,7 @@ let Ysin = {
ret[key] = lodash.get(data, src, "");
})
lodash.forEach(data.uidListData, (ds) => {
let char = Ysin.getAvatar(ds);
let char = Miao.getAvatar(ds);
ret.chars[char.id] = char;
})
return ret;
@ -55,14 +55,14 @@ let Ysin = {
return {
id: ds.usernameid,
name: char ? char.name : "",
dataSource: "ysin-pre",
dataSource: "miao-pre",
updateTime: now.format("YYYY-MM-DD HH:mm:ss"),
lv: ds.level
};
},
async getCharData(uid, ds, saveCharData) {
if (ds.dataSource === "ysin") {
if (ds.dataSource === "miao") {
return ds;
}
try {
@ -70,7 +70,7 @@ let Ysin = {
let req = await fetch(api);
let data = await req.json();
if (data.status === 0 && data.uidData) {
data = Ysin.getAvatarDetail(data);
data = Miao.getAvatarDetail(data);
if (data) {
saveCharData(uid, data);
return data;
@ -89,15 +89,15 @@ let Ysin = {
return {
id: ds.id,
name: char ? char.name : "",
dataSource: "ysin",
dataSource: "miao",
updateTime: now.format("YYYY-MM-DD HH:mm:ss"),
lv: ds.level,
fetter: ds.fetterLevel,
attr: Ysin.getAttr(data.uidDataCombatValue),
weapon: Ysin.getWeapon(ds.weapon),
artis: Ysin.getArtifact(data.uidDataByReliquary),
attr: Miao.getAttr(data.uidDataCombatValue),
weapon: Miao.getWeapon(ds.weapon),
artis: Miao.getArtifact(data.uidDataByReliquary),
cons: ds.constellationNum,
talent: Ysin.getTalent(char.id, ds.skill),
talent: Miao.getTalent(char.id, ds.skill),
_priority: 10
};
},
@ -217,4 +217,4 @@ let Ysin = {
},
}
export default Ysin;
export default Miao;