From 6b8082c3c54d3bff6a5492ca84906059c4a0853c Mon Sep 17 00:00:00 2001 From: Ctrlcv <1509167646@qq.com> Date: Fri, 5 Aug 2022 11:12:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=B1=B3=E7=A4=BE=E7=B1=B3?= =?UTF-8?q?=E5=B8=81=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sign.js | 2 +- model/mys/mihoyo-api.js | 14 ++++++++------ model/mys/utils.js | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/sign.js b/apps/sign.js index c3c280f..0e0e448 100644 --- a/apps/sign.js +++ b/apps/sign.js @@ -166,7 +166,7 @@ export async function mysSign(e) { return retry(e); }); }, RETRY_OPTIONS); - Bot.logger.mark(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`); + // Bot.logger.mark(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`); await utils.randomSleepAsync(); } diff --git a/model/mys/mihoyo-api.js b/model/mys/mihoyo-api.js index 799b7eb..88b9a07 100644 --- a/model/mys/mihoyo-api.js +++ b/model/mys/mihoyo-api.js @@ -12,7 +12,9 @@ import { isV3 } from '../../components/Changelog.js'; import fetch from "node-fetch" -const APP_VERSION = "2.2.0"; +const APP_VERSION = "2.34.1"; +const salt="z8DRIUjNDT7IT5IZXvrUAxyupA1peND9"; +//b253c83ab2609b1b600eddfe974df47b const DEVICE_ID = utils.randomString(32).toUpperCase(); const DEVICE_NAME = utils.randomString(_.random(1, 10)); const _path = process.cwd(); @@ -135,7 +137,7 @@ export default class MihoYoApi { const url = `https://api-takumi.mihoyo.com/apihub/sapi/signIn?gids=${forumId}`; let res = await superagent.post(url).set(this._getHeader()).timeout(10000); let resObj = JSON.parse(res.text); - Bot.logger.mark(`ForumSign: ${res.text}`); + // Bot.logger.mark(`ForumSign: ${res.text}`); return resObj; } @@ -229,8 +231,8 @@ export default class MihoYoApi { for (let item of list) { let reward_id = item.id; let reward_msg = item.msg; - url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification`; - res = await superagent.post(url).set(this.getyunHeader()).send({"id": reward_id}).timeout(10000); + url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification?id=${reward_id}`; + res = await superagent.post(url).set(this.getyunHeader()).timeout(10000); let log_msg=`\n领取奖励,ID:${reward_id},Msg:${reward_msg}`; Bot.logger.info(log_msg) sendMSg+=log_msg @@ -329,7 +331,7 @@ export default class MihoYoApi { _getHeader() { const randomStr = utils.randomString(6); const timestamp = Math.floor(Date.now() / 1000) - let sign = md5(`salt=b253c83ab2609b1b600eddfe974df47b&t=${timestamp}&r=${randomStr}`); + let sign = md5(`salt=${salt}&t=${timestamp}&r=${randomStr}`); return { 'Cookie': this.cookies, 'Content-Type': 'application/json', @@ -340,7 +342,7 @@ export default class MihoYoApi { 'x-rpc-app_version': APP_VERSION, 'x-rpc-device_model': 'iPhone11,8', 'x-rpc-device_name': DEVICE_NAME, - 'x-rpc-client_type': '1', // 1 - iOS, 2 - Android, 4 - Web + 'x-rpc-client_type': '2', // 1 - iOS, 2 - Android, 4 - Web 'DS': `${timestamp},${randomStr},${sign}` // 'DS': `1602569298,k0xfEh,07f4545f5d88eac59cb1257aef74a570` } diff --git a/model/mys/utils.js b/model/mys/utils.js index 8fe9892..5470b56 100644 --- a/model/mys/utils.js +++ b/model/mys/utils.js @@ -18,6 +18,7 @@ export function randomString(length){ let randomStr = ''; for (let i = 0; i < length; i++) { randomStr += _.sample('abcdefghijklmnopqrstuvwxyz0123456789'); + // randomStr += _.sample('dWCcD2FsOUXEstC5f9xubswZxEeoBOTc'); } return randomStr; }