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 2022-10-31 22:23:11 +08:00
parent 4e4af821a4
commit b1708eb522
2 changed files with 121 additions and 102 deletions

View File

@ -164,20 +164,34 @@ export async function mytoken(e) {
export async function bindLogin_ticket(e){ export async function bindLogin_ticket(e){
let user = new User(e); let user = new User(e);
let ckMap=await utils.getCookieMap(e.original_msg.replace(/'|"/g,"")) let ckMap=await utils.getCookieMap(e.original_msg.replace(/'|"/g,""))
let stuid=ckMap?.get("login_uid") ? ckMap?.get("login_uid") : ckMap?.get("ltuid")
if(!stuid) stuid= ckMap?.get("account_id");
if(ckMap&&Cfg.get("ck.sk")){ if(ckMap&&Cfg.get("ck.sk")){
let res= await user.getData("bbsStoken", { let res= await user.getData("bbsStoken", {
loginUid:ckMap?.get("login_uid") ? ckMap?.get("login_uid") : ckMap?.get("ltuid"), loginUid:stuid,
loginTicket:ckMap.get("login_ticket"), loginTicket:ckMap.get("login_ticket"),
},false) })
if(res?.retcode===0){ if(res?.retcode===0){
let msg = 'stoken绑定成功您可通过下列指令进行操作:'; if (res?.data) {
msg += '\n【#米币查询】查询米游币余额' let datalist={}
msg += '\n【#mys原神签到】获取米游币' datalist[e.uid] = {
msg += '\n【#更新抽卡记录】更新抽卡记录' stuid:stuid,
msg += '\n【#刷新ck】刷新失效cookie' stoken: res.data.list[0].token,
msg += '\n【#我的stoken】查看绑定信息' ltoken: res.data.list[1].token,
msg += '\n【#删除stoken】删除绑定信息' uid: e.uid,
e.reply(msg) userId: e.user_id,
is_sign: true
}
gsCfg.saveBingStoken(e.user_id, datalist)
let msg = 'stoken绑定成功您可通过下列指令进行操作:';
msg += '\n【#米币查询】查询米游币余额'
msg += '\n【#mys原神签到】获取米游币'
msg += '\n【#更新抽卡记录】更新抽卡记录'
msg += '\n【#刷新ck】刷新失效cookie'
msg += '\n【#我的stoken】查看绑定信息'
msg += '\n【#删除stoken】删除绑定信息'
e.reply(msg)
}
} }
} }
return false; return false;

View File

@ -95,11 +95,11 @@ export default class user {
let res let res
try { try {
message += `**${forum.name}**\n` message += `**${forum.name}**\n`
res = await this.getData("userGameInfo", forum,false) res = await this.getData("userGameInfo", forum, false)
await utils.sleepAsync(3000) //等几毫秒免得请求太频繁了 await utils.sleepAsync(3000) //等几毫秒免得请求太频繁了
if (res?.data?.list?.length === 0 || !res?.data?.list) { if (res?.data?.list?.length === 0 || !res?.data?.list) {
message += `签到: 未绑定${forum.name}信息\n`; message += `签到: 未绑定${forum.name}信息\n`;
if(this.allSign){ if (this.allSign) {
this.allSign[forum.name].bindGame++; this.allSign[forum.name].bindGame++;
} }
await utils.randomSleepAsync() await utils.randomSleepAsync()
@ -111,66 +111,70 @@ export default class user {
let data = Object.assign({}, forum, item) let data = Object.assign({}, forum, item)
item.is_sign = true; item.is_sign = true;
item.upName = forum.name item.upName = forum.name
res = await this.getData("isSign", data,false) res = await this.getData("isSign", data, false)
await utils.sleepAsync(500) await utils.sleepAsync(500)
item.total_sign_day = res?.data?.total_sign_day item.total_sign_day = res?.data?.total_sign_day
if (res?.data?.is_sign) { if (res?.data?.is_sign) {
if(this.allSign){ if (this.allSign) {
this.allSign[forum.name].isSign++; this.allSign[forum.name].isSign++;
} }
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`; message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
} else { } else {
for (let i = 0; i < 2; i++) { //循环请求 // for (let i = 0; i < 2; i++) { //循环请求
let signTime = await redis.get(`xiaoyao:sign`) // let signTime = await redis.get(`xiaoyao:sign`)
if (signTime) { // if (signTime) {
//有数据的时候不得行必须出去 // //有数据的时候不得行必须出去
if (!mysTask) { // if (!mysTask) {
message += `${item.nickname}-${item.game_uid}:验证码失败请等待6分钟后重试或者手动上米游社签到~`; // message += `${item.nickname}-${item.game_uid}:验证码失败请等待6分钟后重试或者手动上米游社签到~`;
// break;
// } else {
// // await utils.sleepAsync(60000 * 6) // 由于这个方法已经无法过验证码了所以不在处理
// //ps你要是觉得改有加高过的概率就改吧随便你反正到时候黑IP的不是我
// }
// }
await utils.sleepAsync(2000)
res = await this.getData("sign", data, false)
if (res?.data?.gt) {
let validate = await this.geetest(res.data)
if (validate) {
let header = {}
header["x-rpc-challenge"] = res["data"]["challenge"]
header["x-rpc-validate"] = validate
header["x-rpc-seccode"] = `${validate}|jordan`
data.headers = header
res = await this.getData("sign", data, false)
if (!res?.data?.gt) {
if (this.allSign) {
this.allSign[forum.name].sign++;
}
message += `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
break; break;
} else { } else {
await utils.sleepAsync(60000 * 6) //等6分钟再说 if (this.allSign) {
//ps你要是觉得改有加高过的概率就改吧随便你反正到时候黑IP的不是我 this.allSign[forum.name].error++;
}
}
await utils.sleepAsync(2000)
res = await this.getData("sign", data,false)
if (res?.data?.gt) { //进行3次验证码访问签到加高通过概率
let validate = await this.geetest(res.data)
if (validate) {
let header = {}
header["x-rpc-challenge"] = res["data"]["challenge"]
header["x-rpc-validate"] = validate
header["x-rpc-seccode"] = `${validate}|jordan`
data.headers = header
res = await this.getData("sign", data,false)
if (!res?.data?.gt) {
if(this.allSign){
this.allSign[forum.name].sign++;
}
message += `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
break;
} else {
if(this.allSign){
this.allSign[forum.name].error++;
}
item.is_sign = false;
message +=
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
} }
item.is_sign = false;
message +=
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
} }
} else { } else {
if(this.allSign){ if (this.allSign) {
this.allSign[forum.name].sign++; this.allSign[forum.name].error++;
} }
item.total_sign_day++;
message +=
`${item.nickname}-${item.game_uid}${res.message=="OK"?"签到成功":res.message}\n`
break;
} }
} else {
if (this.allSign) {
this.allSign[forum.name].sign++;
}
item.total_sign_day++;
message +=
`${item.nickname}-${item.game_uid}${res.message=="OK"?"签到成功":res.message}\n`
break;
} }
} }
// }
//获取签到信息和奖励信息 //获取签到信息和奖励信息
const SignInfo = await this.getData("home", data,false) const SignInfo = await this.getData("home", data, false)
if (SignInfo) { if (SignInfo) {
let awards = SignInfo.data.awards[item.total_sign_day - 1]; let awards = SignInfo.data.awards[item.total_sign_day - 1];
item.awards = awards?.name + "*" + awards?.cnt item.awards = awards?.name + "*" + awards?.cnt
@ -179,7 +183,7 @@ export default class user {
await utils.randomSleepAsync() await utils.randomSleepAsync()
} }
} catch (e) { } catch (e) {
if(this.allSign){ if (this.allSign) {
this.allSign[forum.name].error++; this.allSign[forum.name].error++;
} }
Bot.logger.error(`${forum.name} 签到失败 [${res?.message}]`); Bot.logger.error(`${forum.name} 签到失败 [${res?.message}]`);
@ -257,7 +261,7 @@ export default class user {
let Share = 0; let Share = 0;
let sumcount = 0; let sumcount = 0;
message += `\n**${forum.name}**\n` message += `\n**${forum.name}**\n`
res = await this.getData("bbsSign", forum,false) res = await this.getData("bbsSign", forum, false)
if (res?.retcode == 1034) { if (res?.retcode == 1034) {
message += `社区签到: 验证码失败\n`; message += `社区签到: 验证码失败\n`;
challenge = await this.bbsGeetest() challenge = await this.bbsGeetest()
@ -265,14 +269,14 @@ export default class user {
forum["headers"] = { forum["headers"] = {
"x-rpc-challenge": challenge "x-rpc-challenge": challenge
} }
await this.getData("bbsSign", forum,false) await this.getData("bbsSign", forum, false)
} }
} else { } else {
message += `社区签到: ${res.message}\n`; message += `社区签到: ${res.message}\n`;
} }
Bot.logger.mark(`${this.e.user_id}:${this.e.uid}:${forum.name} 社区签到结果: [${res.message}]`); Bot.logger.mark(`${this.e.user_id}:${this.e.uid}:${forum.name} 社区签到结果: [${res.message}]`);
await utils.randomSleepAsync(); await utils.randomSleepAsync();
res = await this.getData("bbsPostList", forum,false) res = await this.getData("bbsPostList", forum, false)
sumcount++; sumcount++;
let postList = res.data.list; let postList = res.data.list;
let postId let postId
@ -281,7 +285,7 @@ export default class user {
postId = post['post_id'] postId = post['post_id']
res = await this.getData("bbsPostFull", { res = await this.getData("bbsPostFull", {
postId postId
},false) }, false)
if (res?.message && res?.retcode == 0) { if (res?.message && res?.retcode == 0) {
trueDetail++; trueDetail++;
} }
@ -294,13 +298,13 @@ export default class user {
"x-rpc-challenge": challenge, "x-rpc-challenge": challenge,
} }
} }
await this.getData("bbsPostFull", data,false) await this.getData("bbsPostFull", data, false)
} }
} }
await utils.randomSleepAsync(10); await utils.randomSleepAsync(10);
res = await this.getData("bbsVotePost", { res = await this.getData("bbsVotePost", {
postId postId
},false) }, false)
if (res?.message && res?.retcode == 0) { if (res?.message && res?.retcode == 0) {
Vote++; Vote++;
} }
@ -313,7 +317,7 @@ export default class user {
"x-rpc-challenge": challenge, "x-rpc-challenge": challenge,
} }
} }
await this.getData("bbsVotePost", data,false) await this.getData("bbsVotePost", data, false)
} }
} }
await utils.randomSleepAsync(2); await utils.randomSleepAsync(2);
@ -321,7 +325,7 @@ export default class user {
let sharePost = postList[0].post; let sharePost = postList[0].post;
res = await this.getData("bbsShareConf", { res = await this.getData("bbsShareConf", {
postId postId
},false) }, false)
if (res?.message && res?.retcode == 0) { if (res?.message && res?.retcode == 0) {
Share++; Share++;
} }
@ -359,7 +363,7 @@ export default class user {
mysTask = true; mysTask = true;
let tips = ['开始米社签到任务'] let tips = ['开始米社签到任务']
let time = userIdList.length * 25 + 5+ (userIdList.length/3 * 60) let time = userIdList.length * 25 + 5 + (userIdList.length / 3 * 60)
let finishTime = moment().add(time, 's').format('MM-DD HH:mm:ss') let finishTime = moment().add(time, 's').format('MM-DD HH:mm:ss')
tips.push(`\n签到用户:${userIdList.length}`) tips.push(`\n签到用户:${userIdList.length}`)
tips.push(`\n预计需要:${this.countTime(time)}`) tips.push(`\n预计需要:${this.countTime(time)}`)
@ -376,36 +380,37 @@ export default class user {
} }
let _reply = e.reply let _reply = e.reply
let msg = e?.msg; let msg = e?.msg;
this.allSign={ this.allSign = {
findModel:["崩坏3","崩坏2",'原神','未定事件簿'], findModel: ["崩坏3", "崩坏2", '原神', '未定事件簿'],
"崩坏3":{ "崩坏3": {
bindGame:0, bindGame: 0,
sign:0, sign: 0,
isSign:0, isSign: 0,
error:0, error: 0,
}, },
"崩坏2":{ "崩坏2": {
bindGame:0, bindGame: 0,
sign:0, sign: 0,
isSign:0, isSign: 0,
error:0, error: 0,
}, },
"原神":{ "原神": {
bindGame:0, bindGame: 0,
sign:0, sign: 0,
isSign:0, isSign: 0,
error:0, error: 0,
}, },
"未定事件簿":{ "未定事件簿": {
bindGame:0, bindGame: 0,
sign:0, sign: 0,
isSign:0, isSign: 0,
error:0, error: 0,
}, },
sendReply(){ sendReply() {
let msg="" let msg = ""
for (let item of this.findModel){ for (let item of this.findModel) {
msg+=`**${item}**\n已签:${this[item].isSign}\n签到成功:${this[item].sign}\n未绑定信息:${this[item].bindGame}\n签到失败异常:${this[item].error}\n` msg +=
`**${item}**\n已签:${this[item].isSign}\n签到成功:${this[item].sign}\n未绑定信息:${this[item].bindGame}\n签到失败异常:${this[item].error}\n`
} }
return msg return msg
} }
@ -450,7 +455,7 @@ export default class user {
this.e.reply(res.message) this.e.reply(res.message)
await utils.sleepAsync(15000); await utils.sleepAsync(15000);
} }
msg = `米社签到任务完成\n`+this.allSign.sendReply() msg = `米社签到任务完成\n` + this.allSign.sendReply()
Bot.logger.mark(msg); Bot.logger.mark(msg);
if (mul) { if (mul) {
_reply(msg) _reply(msg)
@ -504,8 +509,8 @@ export default class user {
} }
}; };
this.getyunToken(e) this.getyunToken(e)
this.e=e this.e = e
let res= await this.cloudSign(); let res = await this.cloudSign();
this.e.reply(res.message) this.e.reply(res.message)
await utils.sleepAsync(10000); await utils.sleepAsync(10000);
} }
@ -581,7 +586,7 @@ export default class user {
} }
}; };
this.e = e; this.e = e;
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);
} }
@ -596,9 +601,9 @@ export default class user {
bbsTask = false; bbsTask = false;
} }
async bbsGeetest() { async bbsGeetest() {
let res = await this.getData('bbsGetCaptcha',false) let res = await this.getData('bbsGetCaptcha', false)
let challenge = res.data["challenge"] let challenge = res.data["challenge"]
res = await this.getData("bbsValidate", res.data,false) res = await this.getData("bbsValidate", res.data, false)
if (res?.data?.validate) { if (res?.data?.validate) {
let validate = res?.data?.validate let validate = res?.data?.validate
res = await this.getData("bbsCaptchaVerify", { res = await this.getData("bbsCaptchaVerify", {
@ -607,13 +612,13 @@ export default class user {
"geetest_seccode": validate + "|jordan", "geetest_seccode": validate + "|jordan",
"geetest_validate": validate "geetest_validate": validate
} }
},false) }, false)
return res["data"]["challenge"] return res["data"]["challenge"]
} }
return "" return ""
} }
async geetest(data) { async geetest(data) {
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
@ -704,7 +709,7 @@ export default class user {
let res = await mhyapi.getData("bbsStoken", { let res = await mhyapi.getData("bbsStoken", {
loginUid, loginUid,
loginTicket loginTicket
},false) }, false)
if (res?.data) { if (res?.data) {
datalist[e.uid] = { datalist[e.uid] = {
stuid: map?.get("account_id"), stuid: map?.get("account_id"),