From 66fa3e6979c62e5a3b39e74639180a9f2e45815a Mon Sep 17 00:00:00 2001 From: Kokomi <592981798@qq.com> Date: Sat, 2 Jul 2022 10:38:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?profile=E6=9C=8D=E5=8A=A1=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AE=9A=E4=B9=89api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Profile.js | 2 +- components/profile-data/miao.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/Profile.js b/components/Profile.js index bd2f9b5c..7ff51ced 100644 --- a/components/Profile.js +++ b/components/Profile.js @@ -128,7 +128,7 @@ let Profile = { let data = Profile._get(uid, charId); let Serv = getServ(uid); if (Serv.getCharData && data && data.id) { - return await Serv.getCharData(uid, data, Profile.saveCharData); +f return await Serv.getCharData(uid, data, Profile.saveCharData, { config }); } return data; }, diff --git a/components/profile-data/miao.js b/components/profile-data/miao.js index f3af90c4..b2801e46 100644 --- a/components/profile-data/miao.js +++ b/components/profile-data/miao.js @@ -5,7 +5,7 @@ import moment from "moment"; import { artiIdx, artiSetMap, attrMap } from "./miao-meta.js"; import cmeta from "./enka-char.js"; -const url = "http://49.232.91.210/profile"; +const url = "http://49.232.91.210/profile/detail?token=kokomi"; let Miao = { key: "miao", @@ -63,12 +63,18 @@ let Miao = { }; }, - async getCharData(uid, ds, saveCharData) { + async getCharData(uid, ds, saveCharData, { config = {} }) { if (ds.dataSource !== "miao-pre" || !ds.id) { return ds; } try { - let api = `${url}/detail?uid=${uid}&avatar=${ds.id}`; + let profileApi = function ({ uid, avatar }) { + return `http://49.232.91.210/profile/detail?uid=${uid}&avatar=${avatar}` + }; + if (config.miaoApi && lodash.isFunction(config.miaoApi)) { + profileApi = config.miaoApi; + } + let api = profileApi({ uid, avatar: ds.id }); let req = await fetch(api); let data = await req.json(); if (data.status === 0 && data.uidData) { From 01bde5b704a3c6bf968b7de7f48227a98bdeeedc Mon Sep 17 00:00:00 2001 From: Kokomi <592981798@qq.com> Date: Sat, 2 Jul 2022 10:38:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?profile=E6=9C=8D=E5=8A=A1=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AE=9A=E4=B9=89api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Profile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Profile.js b/components/Profile.js index 7ff51ced..152b6a77 100644 --- a/components/Profile.js +++ b/components/Profile.js @@ -128,7 +128,7 @@ let Profile = { let data = Profile._get(uid, charId); let Serv = getServ(uid); if (Serv.getCharData && data && data.id) { -f return await Serv.getCharData(uid, data, Profile.saveCharData, { config }); + return await Serv.getCharData(uid, data, Profile.saveCharData, { config }); } return data; },