深渊出场率及角色持有率改为请求MiaoPlugin的中间服务转发

This commit is contained in:
yoimiya-kokomi 2022-04-19 05:32:21 +08:00
parent 267c75b991
commit d8c039d6ca
4 changed files with 106 additions and 28 deletions

View File

@ -8,44 +8,27 @@
import Base from "./Base.js";
import fetch from "node-fetch";
const host = "https://hutao-api.snapgenshin.com";
const host = "http://49.232.91.210:88/miaoPlugin/hutaoApi";
let hutaoApi = null;
function getApi(api) {
return `${host}${api}`;
return `${host}?api=${api}`;
}
let HutaoApi = {
_auth: false,
async login() {
let response = await fetch(getApi('/Auth/Login'), {
method: 'POST',
headers: {
'Content-Type': 'text/json; charset=utf-8',
},
body: JSON.stringify({
"Appid": "appid",
"Secret": "secret"
})
});
let res = await response.json();
},
async req(url, data) {
let cacheData = await redis.get(`hutao:${url}`);
if (cacheData) {
return JSON.parse(cacheData)
}
let response = await fetch(getApi(`${url}?Authorization=demo`), {
let response = await fetch(getApi(`${url}`), {
method: "GET",
headers: {
Authorization: `Bearer{token}`
}
});
let retData = await response.json();
let d = new Date();
retData.lastUpdate = `${d.toLocaleDateString()} ${d.toTimeString().substr(0, 5)}`;
retData.lastUpdate = `${d.toLocaleDateString()} ${d.toTimeString().substr(0, 5)}`;
await redis.set(`hutao:${url}`, JSON.stringify(retData), { EX: 3600 });
return retData;

View File

@ -1,12 +1,12 @@
/*
* 请将此文件复制一份命名为 config.js 放置在miao-plugin的根目录
*
* 申请API Token请在Bot群内联系 @喵喵 或者 @九章
* */
export const config = {
miaoApi: {
api: "http://49.232.91.210:88/miaoPlugin/GetRoleAll", // Miao APi 地址
api: "http://49.232.91.210:88/miaoPlugin/getRoleAll", // Miao APi 地址
qq: "", // 申请的主人qq
token: "" // 申请的token
token: "" // 申请的token申请API Token请在Bot群内联系 @喵喵 或者 @九章
}
}

View File

@ -18,6 +18,7 @@
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "YS";
src: url("../common/font/HYWenHei-55W.ttf");
@ -63,7 +64,7 @@ body {
.head-box .title {
font-size: 36px;
font-family: NZBZ, sans-serif;
text-shadow: 0 0 1px #000, 1px 1px 3px rgba(0,0,0,.9);
text-shadow: 0 0 1px #000, 1px 1px 3px rgba(0, 0, 0, .9);
}
@ -76,7 +77,7 @@ body {
.head-box .label {
font-size: 16px;
text-shadow: 0 0 1px #000, 1px 1px 3px rgba(0,0,0,.9);
text-shadow: 0 0 1px #000, 1px 1px 3px rgba(0, 0, 0, .9);
}
@ -104,3 +105,97 @@ body {
text-shadow: 1px 1px 1px #000;
margin-bottom: 10px;
}
.cons {
border-radius: 4px;
}
.cons-0 {
background: #666;
color: #fff;
}
.cons-1 {
background-color: #71b167;
color: #fff;
}
.cons-2 {
background-color: #369961;
color: #fff;
}
.cons-3 {
background-color: #4596b9;
color: #fff;
}
.cons-4 {
background-color: #4560b9;
color: #fff;
}
.cons-5 {
background-color: #531ba9cf;
color: #fff;
}
.cons-6 {
background-color: #ff5722;
color: #fff;
}
/******** ELEM ********/
.elem-anemo .talent-icon {
background-image: url(../common/bg/talent-anemo.png)
}
.elem-anemo .elem-bg {
background-image: url(../common/bg/bg-anemo.jpg);
}
.elem-cryo .talent-icon {
background-image: url(../common/bg/talent-cryo.png)
}
.elem-cryo .elem-bg {
background-image: url(../common/bg/bg-cryo.jpg);
}
.elem-electro .talent-icon {
background-image: url(../common/bg/talent-electro.png)
}
.elem-electro .elem-bg {
background-image: url(../common/bg/bg-electro.jpg);
}
.elem-geo .talent-icon {
background-image: url(../common/bg/talent-geo.png)
}
.elem-geo .elem-bg {
background-image: url(../common/bg/bg-geo.jpg);
}
.elem-hydro .talent-icon {
background-image: url(../common/bg/talent-hydro.png)
}
.elem-hydro .elem-bg {
background-image: url(../common/bg/bg-hydro.jpg);
}
.elem-pyro .talent-icon {
background-image: url(../common/bg/talent-pyro.png)
}
.elem-pyro .elem-bg {
background-image: url(../common/bg/bg-pyro.jpg);
}

View File

@ -22,7 +22,7 @@
}
.card-list .item.star5 img {
background-image: url(../common/bg5.png);
background-image: url(../common/item/bg5.png);
width: 100%;
height: 70px;
/*filter: brightness(1.1);*/
@ -33,7 +33,7 @@
.card-list .item.star4 img {
width: 100%;
height: 70px;
background-image: url(../common/bg4.png);
background-image: url(../common/item/bg4.png);
background-size: 100%;
background-repeat: no-repeat;
}