From d571eb235e6c1abfa083d368b9bcd2460aaa4a20 Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Wed, 15 Jun 2022 06:14:58 +0800 Subject: [PATCH] =?UTF-8?q?`#=E6=9B=B4=E6=96=B0=E9=9D=A2=E6=9D=BF`?= =?UTF-8?q?=E6=94=AF=E6=8C=81B=E6=9C=8D=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/character.js | 4 +-- components/Profile.js | 6 ++-- components/profile/{ysin.js => miao.js} | 28 +++++++++---------- .../profile/{ysin_meta.js => miao_meta.js} | 0 4 files changed, 19 insertions(+), 19 deletions(-) rename components/profile/{ysin.js => miao.js} (89%) rename components/profile/{ysin_meta.js => miao_meta.js} (100%) diff --git a/apps/character.js b/apps/character.js index 73d7aa8a..9cf260b1 100644 --- a/apps/character.js +++ b/apps/character.js @@ -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) diff --git a/components/Profile.js b/components/Profile.js index a9f329a7..e504d794 100644 --- a/components/Profile.js +++ b/components/Profile.js @@ -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; diff --git a/components/profile/ysin.js b/components/profile/miao.js similarity index 89% rename from components/profile/ysin.js rename to components/profile/miao.js index 8d3b34c0..0ba6e402 100644 --- a/components/profile/ysin.js +++ b/components/profile/miao.js @@ -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; \ No newline at end of file +export default Miao; \ No newline at end of file diff --git a/components/profile/ysin_meta.js b/components/profile/miao_meta.js similarity index 100% rename from components/profile/ysin_meta.js rename to components/profile/miao_meta.js