mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-25 09:27:34 +00:00
profile服务支持定义api
This commit is contained in:
parent
e93628fb8c
commit
66fa3e6979
@ -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;
|
||||
},
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user