2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-22 19:10:53 +08:00

新年快乐啊哈哈,迟来的祝福,祝你生活愉快~

This commit is contained in:
Ctrlcvs 2023-01-04 20:15:15 +08:00
parent 7175d5faf5
commit 4f1d1e461d
2 changed files with 115 additions and 107 deletions

View File

@ -155,11 +155,12 @@ export default class miHoYoApi {
},
bbsCaptchaVerify: {
url: `${mys.bbs_api}/misc/api/verifyVerification`,
types: 'bbs'
body: {
"geetest_challenge": data.challenge, //challenge,
"geetest_validate": data.validate,
"geetest_seccode": `${data.validate}|jordan`
},
bbsCaptchaVerify: {
url: `https://api.geetest.com/gettype.php`,
query: ``
types: 'bbs'
},
//待定接口 用于获取用户米游社顶部的模块栏
bbs_Businesses_url: {
@ -199,9 +200,10 @@ export default class miHoYoApi {
query: `login_ticket=${data.loginTicket}&token_types=3&uid=${data.loginUid}`,
types: 'stoken'
},
//接口来源于外网扒来的 接口目前暂时免费后续看token是否收费祝你生活愉快
validate: {
url: ``,
query: ``
url: `http://api.fuckmys.tk/geetest`,
query: `token=fuckmys&gt=${data.gt}&challenge=${data.challenge}`
},
cloudLogin: {
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`,

View File

@ -124,20 +124,15 @@ export default class user {
}
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
} else {
// for (let i = 0; i < 2; i++) { //循环请求
// let signTime = await redis.get(`xiaoyao:sign`)
// if (signTime) {
// //有数据的时候不得行必须出去
// if (!mysTask) {
// message += `${item.nickname}-${item.game_uid}:验证码失败请等待6分钟后重试或者手动上米游社签到~`;
// break;
// } else {
// // await utils.sleepAsync(60000 * 6) // 由于这个方法已经无法过验证码了所以不在处理
// }
// }
let isgt=false
let signMsg='';
for (let i = 0; i < 2; i++) { //循环请求
await utils.sleepAsync(2000)
res = await this.getData("sign", data, false)
if (res?.data?.gt) {
if(!isgt){
isgt=true;
}
let validate = await this.geetest(res.data)
if (validate) {
let header = {}
@ -147,35 +142,38 @@ export default class user {
data.headers = header
res = await this.getData("sign", data, false)
if (!res?.data?.gt) {
if (this.allSign) {
if (this.allSign&&!isgt) {
this.allSign[forum.name].sign++;
}
message += `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
signMsg = `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
break;
} else {
if (this.allSign) {
if (this.allSign&&!isgt) {
this.allSign[forum.name].error++;
}
item.is_sign = false;
message +=
signMsg =
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
}
} else {
if (this.allSign) {
if (this.allSign&&!isgt) {
this.allSign[forum.name].error++;
}
message += `${item.nickname}-${item.game_uid}:验证码失败~\n`
signMsg = `${item.nickname}-${item.game_uid}:验证码失败~\n`
}
} else {
if (this.allSign) {
this.allSign[forum.name].sign++;
}
item.total_sign_day++;
message +=
signMsg =
`${item.nickname}-${item.game_uid}${res.message == "OK" ? "签到成功" : res.message}\n`
break;
}
}
// }
message+=signMsg
}
//获取签到信息和奖励信息
const SignInfo = await this.getData("home", data, false)
if (SignInfo) {
@ -335,7 +333,6 @@ export default class user {
}
await utils.randomSleepAsync(2);
}
let sharePost = postList[0].post;
res = await this.getData("bbsShareConf", {
postId
}, false)
@ -541,7 +538,7 @@ export default class user {
let isPushSign = this.configSign.isPushSign
let userIdList = Object.keys(stoken)
if (bbsTask) {
e.reply(`云原神自动签到任务进行中,请勿重复触发指令`)
e.reply(`米游币自动签到任务进行中,请勿重复触发指令`)
return false
}
let tips = ['开始米游币签到任务']
@ -562,9 +559,11 @@ export default class user {
}
bbsTask = true;
let _reply = e.reply
let counts=0;
//获取需要签到的用户
for (let dataUid of stoken) {
for (let uuId in dataUid) {
try {
if (uuId[0] * 1 > 5) {
continue;
}
@ -574,8 +573,9 @@ export default class user {
user_id,
isTask: true
};
counts++;
e.cookie = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
Bot.logger.mark(`正在为qq${user_id}uid:${uuId}进行米游币签到中...`);
Bot.logger.mark(`[米游币签到][第${counts}个]正在为qq${user_id}uid:${uuId}签到中...`);
e.msg = "全部"
e.reply = (msg) => {
//关闭签到消息推送
@ -587,9 +587,14 @@ export default class user {
}
};
this.e = e;
//await 代表同步 你可以尝试去除await以进行优化速度
let res = await this.getbbsSign(this.ForumData);
e.reply(res.message)
await utils.sleepAsync(10000);
} catch (error) {
logger.error(`米游币签到报错:` + error)
}
}
}
let msg = `米社米币签到任务完成`
@ -602,32 +607,33 @@ export default class user {
bbsTask = false;
}
async bbsGeetest() {
try {
let res = await this.getData('bbsGetCaptcha', false)
let challenge = res.data["challenge"]
// let challenge = res.data["challenge"]
await this.getData("geeType", res.data, false)
res = await this.getData("bbsValidate", res.data, false)
res = await this.getData("validate", res.data, false)
if (res?.data?.validate) {
let validate = res?.data?.validate
res = await this.getData("bbsCaptchaVerify", {
headers: {
"geetest_challenge": challenge,
"geetest_seccode": validate + "|jordan",
"geetest_validate": validate
}
}, false)
res = await this.getData("bbsCaptchaVerify", res.data, false)
return res["data"]["challenge"]
}
} catch (error) {
//大概率是数据空导致报错这种情况很少见捏,所以你可以忽略不看
Bot.logger.error('[validate][接口请求]异常信息:' + error)
return ""
}
return ""
}
async geetest(data) {
try {
let res = await this.getData("validate", data, false)
if (res?.data?.validate) {
let validate = res?.data?.validate
return validate
} else if (res?.data?.result !== "slide") {
await redis.set(`xiaoyao:sign`, 1, { //写入缓存 过不了了
EX: 60 * 6 //等6分钟后再给用指令
});
}
} catch (error) {
//大概率是数据空导致报错这种情况很少见捏,所以你可以忽略不看
Bot.logger.error('[validate][接口请求]异常信息:' + error)
return ""
}
return ""
}