2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +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: { bbsCaptchaVerify: {
url: `${mys.bbs_api}/misc/api/verifyVerification`, 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: { types: 'bbs'
url: `https://api.geetest.com/gettype.php`,
query: ``
}, },
//待定接口 用于获取用户米游社顶部的模块栏 //待定接口 用于获取用户米游社顶部的模块栏
bbs_Businesses_url: { bbs_Businesses_url: {
@ -199,9 +200,10 @@ export default class miHoYoApi {
query: `login_ticket=${data.loginTicket}&token_types=3&uid=${data.loginUid}`, query: `login_ticket=${data.loginTicket}&token_types=3&uid=${data.loginUid}`,
types: 'stoken' types: 'stoken'
}, },
//接口来源于外网扒来的 接口目前暂时免费后续看token是否收费祝你生活愉快
validate: { validate: {
url: ``, url: `http://api.fuckmys.tk/geetest`,
query: `` query: `token=fuckmys&gt=${data.gt}&challenge=${data.challenge}`
}, },
cloudLogin: { cloudLogin: {
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/login`, 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`; message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
} else { } else {
// for (let i = 0; i < 2; i++) { //循环请求 let isgt=false
// let signTime = await redis.get(`xiaoyao:sign`) let signMsg='';
// if (signTime) { for (let i = 0; i < 2; i++) { //循环请求
// //有数据的时候不得行必须出去
// if (!mysTask) {
// message += `${item.nickname}-${item.game_uid}:验证码失败请等待6分钟后重试或者手动上米游社签到~`;
// break;
// } else {
// // await utils.sleepAsync(60000 * 6) // 由于这个方法已经无法过验证码了所以不在处理
// }
// }
await utils.sleepAsync(2000) await utils.sleepAsync(2000)
res = await this.getData("sign", data, false) res = await this.getData("sign", data, false)
if (res?.data?.gt) { if (res?.data?.gt) {
if(!isgt){
isgt=true;
}
let validate = await this.geetest(res.data) let validate = await this.geetest(res.data)
if (validate) { if (validate) {
let header = {} let header = {}
@ -147,35 +142,38 @@ export default class user {
data.headers = header data.headers = header
res = await this.getData("sign", data, false) res = await this.getData("sign", data, false)
if (!res?.data?.gt) { if (!res?.data?.gt) {
if (this.allSign) { if (this.allSign&&!isgt) {
this.allSign[forum.name].sign++; this.allSign[forum.name].sign++;
} }
message += `${item.nickname}-${item.game_uid}:验证码签到成功~\n` signMsg = `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
break; break;
} else { } else {
if (this.allSign) { if (this.allSign&&!isgt) {
this.allSign[forum.name].error++; this.allSign[forum.name].error++;
} }
item.is_sign = false; item.is_sign = false;
message += signMsg =
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`; `${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
} }
} else { } else {
if (this.allSign) { if (this.allSign&&!isgt) {
this.allSign[forum.name].error++; this.allSign[forum.name].error++;
} }
message += `${item.nickname}-${item.game_uid}:验证码失败~\n` signMsg = `${item.nickname}-${item.game_uid}:验证码失败~\n`
} }
} else { } else {
if (this.allSign) { if (this.allSign) {
this.allSign[forum.name].sign++; this.allSign[forum.name].sign++;
} }
item.total_sign_day++; item.total_sign_day++;
message += signMsg =
`${item.nickname}-${item.game_uid}${res.message == "OK" ? "签到成功" : res.message}\n` `${item.nickname}-${item.game_uid}${res.message == "OK" ? "签到成功" : res.message}\n`
break;
} }
} }
// } message+=signMsg
}
//获取签到信息和奖励信息 //获取签到信息和奖励信息
const SignInfo = await this.getData("home", data, false) const SignInfo = await this.getData("home", data, false)
if (SignInfo) { if (SignInfo) {
@ -335,7 +333,6 @@ export default class user {
} }
await utils.randomSleepAsync(2); await utils.randomSleepAsync(2);
} }
let sharePost = postList[0].post;
res = await this.getData("bbsShareConf", { res = await this.getData("bbsShareConf", {
postId postId
}, false) }, false)
@ -541,7 +538,7 @@ export default class user {
let isPushSign = this.configSign.isPushSign let isPushSign = this.configSign.isPushSign
let userIdList = Object.keys(stoken) let userIdList = Object.keys(stoken)
if (bbsTask) { if (bbsTask) {
e.reply(`云原神自动签到任务进行中,请勿重复触发指令`) e.reply(`米游币自动签到任务进行中,请勿重复触发指令`)
return false return false
} }
let tips = ['开始米游币签到任务'] let tips = ['开始米游币签到任务']
@ -562,9 +559,11 @@ export default class user {
} }
bbsTask = true; bbsTask = true;
let _reply = e.reply let _reply = e.reply
let counts=0;
//获取需要签到的用户 //获取需要签到的用户
for (let dataUid of stoken) { for (let dataUid of stoken) {
for (let uuId in dataUid) { for (let uuId in dataUid) {
try {
if (uuId[0] * 1 > 5) { if (uuId[0] * 1 > 5) {
continue; continue;
} }
@ -574,8 +573,9 @@ export default class user {
user_id, user_id,
isTask: true isTask: true
}; };
counts++;
e.cookie = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`; 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.msg = "全部"
e.reply = (msg) => { e.reply = (msg) => {
//关闭签到消息推送 //关闭签到消息推送
@ -587,9 +587,14 @@ export default class user {
} }
}; };
this.e = e; this.e = e;
//await 代表同步 你可以尝试去除await以进行优化速度
let res = await this.getbbsSign(this.ForumData); let res = await this.getbbsSign(this.ForumData);
e.reply(res.message) e.reply(res.message)
await utils.sleepAsync(10000); await utils.sleepAsync(10000);
} catch (error) {
logger.error(`米游币签到报错:` + error)
}
} }
} }
let msg = `米社米币签到任务完成` let msg = `米社米币签到任务完成`
@ -602,32 +607,33 @@ export default class user {
bbsTask = false; bbsTask = false;
} }
async bbsGeetest() { async bbsGeetest() {
try {
let res = await this.getData('bbsGetCaptcha', false) let res = await this.getData('bbsGetCaptcha', false)
let challenge = res.data["challenge"] // let challenge = res.data["challenge"]
await this.getData("geeType", res.data, false) 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) { if (res?.data?.validate) {
let validate = res?.data?.validate res = await this.getData("bbsCaptchaVerify", res.data, false)
res = await this.getData("bbsCaptchaVerify", {
headers: {
"geetest_challenge": challenge,
"geetest_seccode": validate + "|jordan",
"geetest_validate": validate
}
}, false)
return res["data"]["challenge"] return res["data"]["challenge"]
} }
} catch (error) {
//大概率是数据空导致报错这种情况很少见捏,所以你可以忽略不看
Bot.logger.error('[validate][接口请求]异常信息:' + error)
return ""
}
return "" return ""
} }
async geetest(data) { async geetest(data) {
try {
let res = await this.getData("validate", data, false) let res = await this.getData("validate", data, false)
if (res?.data?.validate) { if (res?.data?.validate) {
let validate = res?.data?.validate let validate = res?.data?.validate
return validate return validate
} else if (res?.data?.result !== "slide") { }
await redis.set(`xiaoyao:sign`, 1, { //写入缓存 过不了了 } catch (error) {
EX: 60 * 6 //等6分钟后再给用指令 //大概率是数据空导致报错这种情况很少见捏,所以你可以忽略不看
}); Bot.logger.error('[validate][接口请求]异常信息:' + error)
return ""
} }
return "" return ""
} }