From 973d10cda60653951a5dad627fa535fa0a5563fc Mon Sep 17 00:00:00 2001
From: Ctrlcvs <1509167646@qq.com>
Date: Thu, 4 May 2023 10:37:13 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E7=BB=91=E5=AE=9Ack=E6=96=B9?=
=?UTF-8?q?=E6=B3=95=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
plugins/genshin/apps/gcLog.js | 31 +++++++++++-----------------
plugins/genshin/model/gachaLog.js | 2 +-
plugins/genshin/model/mys/MysUser.js | 28 ++++++++++++++++++-------
3 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/plugins/genshin/apps/gcLog.js b/plugins/genshin/apps/gcLog.js
index 144b84b..e34de10 100644
--- a/plugins/genshin/apps/gcLog.js
+++ b/plugins/genshin/apps/gcLog.js
@@ -98,12 +98,7 @@ export class gcLog extends plugin {
let data = await new GachaLog(this.e).logUrl()
if (!data) return
- let url='gachaLog'
- if(this.e.isSr){
- url ='StarRail/gachaLog'
- data.tplFile = './plugins/genshin/resources/StarRail/html/gachaLog/gachaLog.html'
- data.headStyle = ``
- }
+ let url = this.srHead('gachaLog', data)
let img = await puppeteer.screenshot(url, data)
if (img) await this.reply(img)
}
@@ -140,12 +135,7 @@ export class gcLog extends plugin {
async getLog () {
let data = await new GachaLog(this.e).getLogData()
if (!data) return
- let url='gachaLog'
- if(this.e.isSr){
- url ='StarRail/gachaLog'
- data.tplFile = './plugins/genshin/resources/StarRail/html/gachaLog/gachaLog.html'
- data.headStyle = ``
- }
+ let url = this.srHead('gachaLog', data)
let img = await puppeteer.screenshot(url, data)
if (img) await this.reply(img)
}
@@ -215,16 +205,19 @@ export class gcLog extends plugin {
await this.e.reply(segment.image(`file:///${_path}/resources/logHelp/记录帮助-苹果.png`))
}
}
-
+ srHead = (url, data) => {
+ let name = url
+ if (this.e.isSr) {
+ name = `StarRail/${url}`
+ data.tplFile = `./plugins/genshin/resources/StarRail/html/${url}/${url}.html`
+ data.headStyle = ``
+ }
+ return name
+ }
async logCount () {
let data = await new LogCount(this.e).count()
if (!data) return
- let url='logCount'
- if(this.e.isSr){
- url='StarRail/logCount'
- data.tplFile = './plugins/genshin/resources/StarRail/html/logCount/logCount.html'
- data.headStyle = ``
- }
+ let url = this.srHead('logCount', data)
let img = await puppeteer.screenshot(url, data)
if (img) await this.reply(img)
}
diff --git a/plugins/genshin/model/gachaLog.js b/plugins/genshin/model/gachaLog.js
index 141c949..77fa0b7 100644
--- a/plugins/genshin/model/gachaLog.js
+++ b/plugins/genshin/model/gachaLog.js
@@ -55,7 +55,7 @@ export default class GachaLog extends base {
if (i <= 1) await common.sleep(500)
}
- await this.e.reply(`抽卡记录更新完成,您还可回复\n【#${this?.e?.isSr?'光锥':'武器'}记录】统计武器池数据\n【#角色统计】按卡池统计数据\n【#导出记录】导出记录数据`)
+ await this.e.reply(`抽卡记录更新完成,您还可回复\n【#${this?.e?.isSr?'光锥':'武器'}记录】统计${this?.e?.isSr?'光锥':'武器'}池数据\n【#角色统计】按卡池统计数据\n【#导出记录】导出记录数据`)
this.isLogUrl = true
diff --git a/plugins/genshin/model/mys/MysUser.js b/plugins/genshin/model/mys/MysUser.js
index 3fd08f2..3fb4f52 100644
--- a/plugins/genshin/model/mys/MysUser.js
+++ b/plugins/genshin/model/mys/MysUser.js
@@ -374,16 +374,30 @@ export default class MysUser extends BaseModel {
}
static async getGameRole (ck, serv = 'mys') {
+ let biz=['hk4e_cn','hkrpg_cn']
let url = {
- mys: 'https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=hk4e_cn',
+ mys: 'https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=',
hoyolab: 'https://api-os-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=hk4e_global'
}
-
- let res = await fetch(url[serv], { method: 'get', headers: { Cookie: ck } })
- if (!res.ok) return false
- res = await res.json()
-
- return res
+ let list=[];
+ let result;
+ if(serv=='mys'){
+ for(let item of biz){
+ result=await fetch(url[serv]+item, { method: 'get', headers: { Cookie: ck } })
+ if(result.ok){
+ result=await result.json()
+ if(result?.data?.list.length>0){
+ list.push(...result.data.list)
+ }
+ }
+ }
+ result.data.list=list
+ }else{
+ let res = await fetch(url[serv], { method: 'get', headers: { Cookie: ck } })
+ if (!res.ok) return false
+ result = await res.json()
+ }
+ return result
}
// 获取米游社通行证id