From 369ab14375011c858da63e66a4daf3e320022ac1 Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale@user.noreply.gitee.com> Date: Tue, 11 Jul 2023 00:15:34 +0800 Subject: [PATCH 1/6] update plugins/genshin/apps/payLog.js. --- plugins/genshin/apps/payLog.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/genshin/apps/payLog.js b/plugins/genshin/apps/payLog.js index 07d7a83..9d4fa17 100644 --- a/plugins/genshin/apps/payLog.js +++ b/plugins/genshin/apps/payLog.js @@ -27,7 +27,7 @@ export class payLog extends plugin { }, { // 优先级高于抽卡记录,但是发送抽卡链接时不会抢指令,对比过米游社链接和抽卡链接,该字段为米游社链接字段 - reg: '(.*)(bill-record-user|customer-claim|player-log|user.mihoyo.com)(.*)', + reg: '(.*)(user-game-search|bill-record-user|customer-claim|player-log|user.mihoyo.com)(.*)', fnc: 'getAuthKey' }, { @@ -89,8 +89,12 @@ export class payLog extends plugin { } // 解析出authKey - let userUrl = this.e.msg.replace(/[\u4e00-\u9fa5]/g, '').replace(/\s+/g, '') - this.authKey = url.parse(userUrl, true, true).query.authkey + let match = this.e.msg.match(/&authkey=([^&\s\u4e00-\u9fa5]+)/) + if (!match) { + this.reply('链接无效,请重新发送') + return false + } + this.authKey = decodeURIComponent(match[1]) // 获取数据 this.reply('正在获取消费数据,可能需要30s~~') @@ -143,7 +147,7 @@ export class payLog extends plugin { } payLogHelp (e) { - e.reply('安卓教程: https://b23.tv/K5qfLad\n苹果用户可【先】发送最新获取的抽卡记录链接,【再】发送【#充值记录】或【#更新充值统计】来获取') + e.reply('安卓教程: https://b23.tv/K5qfLad\n苹果用户可【先】发送最新获取的抽卡记录链接,【再】发送【#充值记录】或【#更新充值统计】来获取(注:通过抽卡链接获取充值记录大概率已失效)') } /** 判断主uid,若没有则返回false,有则返回主uid */ From 8b5119addd7646e538ff31e78d99de7c75cdb2ef Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale@user.noreply.gitee.com> Date: Tue, 11 Jul 2023 00:21:36 +0800 Subject: [PATCH 2/6] update plugins/genshin/model/payLogData.js. --- plugins/genshin/model/payLogData.js | 94 ++++++++++++++++++++++++----- 1 file changed, 79 insertions(+), 15 deletions(-) diff --git a/plugins/genshin/model/payLogData.js b/plugins/genshin/model/payLogData.js index 5e394cc..8d406ff 100644 --- a/plugins/genshin/model/payLogData.js +++ b/plugins/genshin/model/payLogData.js @@ -22,11 +22,13 @@ export class PayData { async getOringinalData (id = '') { let res = await fetch(this.getUrl() + id, this.headers) let ret = await res.json() - // 加一个authkey不同情况 - if (ret?.retcode === -101 || ret?.retcode === -100) { - return ret.retcode === -101 ? { errorMsg: '您的链接过期,请重新获取' } : { errorMsg: '链接不正确,请重新获取' } + let check = this.checkResult(ret) + if (check?.errorMsg) return check + let list = ret?.data?.list + if (!Array.isArray(list)) { + console.error(ret) + return { errorMsg: '获取失败,错误码:' + ret?.retcode } } - let list = ret.data.list if (list.length === 20) { this.#oringinData.push(...list) await this.getOringinalData(list[19].id) @@ -41,7 +43,13 @@ export class PayData { async getPrimogemLog (id = '') { let res = await fetch(this.getUrl('getPrimogemLog') + id, this.headers) let ret = await res.json() - let list = ret.data.list + let check = this.checkResult(ret) + if (check?.errorMsg) return check + let list = ret?.data?.list + if (!Array.isArray(list)) { + console.error(ret) + return { errorMsg: '获取失败,错误码:' + ret?.retcode } + } if (list.length === 20) { list.forEach(v => { if (v.add_num === '680') this.#oringinData.push(v) @@ -56,18 +64,42 @@ export class PayData { } } + async getUserInfo() { + let res = await fetch(this.getUrl('getUserInfo'), this.headers) + let ret = await res.json() + let check = this.checkResult(ret) + if (check?.errorMsg) return check + let data = ret?.data + if (data?.uid) { + return data + } + return {errorMsg: '获取失败,可能是链接已过期或不正确'} + } + + checkResult(ret) { + if (ret?.retcode === -101 || ret?.retcode === -100) { + return ret.retcode === -101 ? {errorMsg: '您的链接过期,请重新获取'} : {errorMsg: '链接不正确,请重新获取'} + } + if (/unknown auth appid/.test(ret?.message)) { + return {errorMsg: '抽卡或其他链接现已无法获取充值记录,请发送客服页面的链接!'} + } + return {errorMsg: ''} + } + /** 对原始数据进行筛选,组合 */ async filtrateData () { + // 由于新接口不返回uid了,所以先查询出用户信息 + const userInfo = await this.getUserInfo() + if (userInfo?.errorMsg) return userInfo + this.#genShinId = userInfo.uid // 获取数据 let isSucceed = await this.getOringinalData() // 判断数据是否获取成功 if (isSucceed?.errorMsg) return isSucceed await this.getPrimogemLog() - // 获取uid,并判断零氪党的情况 - if (this.#oringinData[0]?.uid) { - this.#genShinId = this.#oringinData[0].uid - } else { - return { errorMsg: '未获取到您的任何充值数据' } + // 判断零氪党的情况 + if (this.#oringinData.length === 0) { + return {errorMsg: '未获取到您的任何充值数据'} } // 将原始数据按id排序 this.#oringinData = this.#oringinData.sort((a, b) => { @@ -92,7 +124,9 @@ export class PayData { let num = Number(this.#oringinData[index].add_num) if (num < 0) continue // 获取月份 - let thisMonth = ++moment(this.#oringinData[index].time).toArray()[1] + // let thisMonth = ++moment(this.#oringinData[index].time).toArray()[1] + // 新接口改名为:datetime + let thisMonth = ++moment(this.#oringinData[index].datetime).toArray()[1] if (thisMonth !== month) { i++ month = thisMonth @@ -136,10 +170,40 @@ export class PayData { credentials: 'include' } - // 两个api //原石 getPrimogemLog //结晶 getCrystalLog - getUrl (api = 'getCrystalLog') { - let type = api === 'getCrystalLog' ? 3 : 1 - return `https://hk4e-api.mihoyo.com/ysulog/api/${api}?selfquery_type=${type}&lang=zh-cn&sign_type=2&auth_appid=csc&authkey_ver=1&authkey=${this.#authkey}&game_biz=hk4e_cn&app_client=bbs&type=${type}&size=20&end_id=` + /** + * 获取url + * @param api 原石 getPrimogemLog // 结晶 getCrystalLog // 获取用户信息 getUserInfo + * @returns {string} + */ + getUrl(api = 'getCrystalLog') { + const baseUrl = 'https://hk4e-api.mihoyo.com/common/hk4e_self_help_query/User' + const isUserInfo = api === 'getUserInfo', isCrystalLog = api === 'getCrystalLog' + const url = isUserInfo ? '/GetUserInfo' : isCrystalLog ? '/GetCrystalLog' : '/GetPrimogemLog' + let params = '' + params += '?selfquery_type=1' + params += '&sign_type=2' + params += '&auth_appid=csc' + params += '&authkey_ver=1' + params += '&game_biz=hk4e_cn' + params += '&win_direction=portrait' + params += '&bbs_auth_required=true' + params += '&bbs_game_role_required=hk4e_cn' + params += '&app_client=bbs' + params += '&lang=zh-cn' + params += '&csc_authkey_required=true' + params += '&authkey=' + this.#authkey + params += '&page_id=1' + // 此条件限定只查询获取的 + if (!isUserInfo) { + params += '&add_type=produce' + params += '&size=20' + // endId,外部拼接 + params += '&end_id=' + } + return baseUrl + url + params + // 老API: + // let type = api === 'getCrystalLog' ? 3 : 1 + // return `https://hk4e-api.mihoyo.com/ysulog/api/${api}?selfquery_type=${type}&lang=zh-cn&sign_type=2&auth_appid=csc&authkey_ver=1&authkey=${this.#authkey}&game_biz=hk4e_cn&app_client=bbs&type=${type}&size=20&end_id=` } } From f829fcfc71050f898c5275923626851191657bf7 Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> Date: Sat, 15 Jul 2023 07:27:37 +0000 Subject: [PATCH 3/6] update package.json. Signed-off-by: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fe0aac..4ff66c2 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "chalk": "^5.2.0", "chokidar": "^3.5.3", "https-proxy-agent": "5.0.1", - "icqq": "^0.4.10", + "icqq": "^0.4.11", "image-size": "^1.0.2", "inquirer": "^8.2.5", "lodash": "^4.17.21", From 6d24058f93ae5b1f9ffc70b1f5bbf30667271dce Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> Date: Sat, 15 Jul 2023 07:53:57 +0000 Subject: [PATCH 4/6] update plugins/genshin/defSet/pool/11.yaml. Signed-off-by: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> --- plugins/genshin/defSet/pool/11.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/genshin/defSet/pool/11.yaml b/plugins/genshin/defSet/pool/11.yaml index f4010ac..d12a79f 100644 --- a/plugins/genshin/defSet/pool/11.yaml +++ b/plugins/genshin/defSet/pool/11.yaml @@ -1,3 +1,12 @@ +- from: '2023-07-19 11:00:00' + to: '2023-08-09 11:59:59' + five: + - 刃 + four: + - 阿兰 + - 娜塔莎 + - 素裳 + name: 零号协议 - from: '2023-06-28 12:00:00' to: '2023-07-18 14:59:59' five: From e0ce2a17ebfee23ba3c5593475dc94248d832918 Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> Date: Sat, 15 Jul 2023 08:09:10 +0000 Subject: [PATCH 5/6] update plugins/genshin/defSet/pool/12.yaml. Signed-off-by: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> --- plugins/genshin/defSet/pool/12.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/genshin/defSet/pool/12.yaml b/plugins/genshin/defSet/pool/12.yaml index 9e466af..4db4b28 100644 --- a/plugins/genshin/defSet/pool/12.yaml +++ b/plugins/genshin/defSet/pool/12.yaml @@ -1,3 +1,12 @@ +- from: '2023-07-19 11:00:00' + to: '2023-08-09 11:59:59'' + five: + - 到不了的彼岸 + four: + - 秘密誓心 + - 同一种心情 + - 论剑 + name: 流光定影 - from: '2023-06-28 12:00:00' to: '2023-07-18 14:59:59' five: From d5f8d2da590db08a156d7ad1175dd342536e4727 Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> Date: Sat, 15 Jul 2023 08:13:12 +0000 Subject: [PATCH 6/6] update plugins/genshin/defSet/pool/11.yaml. Signed-off-by: touchscale <11134128+touchscale_admin@user.noreply.gitee.com> --- plugins/genshin/defSet/pool/11.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/genshin/defSet/pool/11.yaml b/plugins/genshin/defSet/pool/11.yaml index d12a79f..e75196a 100644 --- a/plugins/genshin/defSet/pool/11.yaml +++ b/plugins/genshin/defSet/pool/11.yaml @@ -6,7 +6,7 @@ - 阿兰 - 娜塔莎 - 素裳 - name: 零号协议 + name: 业途游魂 - from: '2023-06-28 12:00:00' to: '2023-07-18 14:59:59' five: