mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +08:00
新年快乐啊哈哈,迟来的祝福,祝你生活愉快~
This commit is contained in:
parent
7175d5faf5
commit
4f1d1e461d
@ -155,12 +155,13 @@ export default class miHoYoApi {
|
|||||||
},
|
},
|
||||||
bbsCaptchaVerify: {
|
bbsCaptchaVerify: {
|
||||||
url: `${mys.bbs_api}/misc/api/verifyVerification`,
|
url: `${mys.bbs_api}/misc/api/verifyVerification`,
|
||||||
|
body: {
|
||||||
|
"geetest_challenge": data.challenge, //challenge,
|
||||||
|
"geetest_validate": data.validate,
|
||||||
|
"geetest_seccode": `${data.validate}|jordan`
|
||||||
|
},
|
||||||
types: 'bbs'
|
types: 'bbs'
|
||||||
},
|
},
|
||||||
bbsCaptchaVerify: {
|
|
||||||
url: `https://api.geetest.com/gettype.php`,
|
|
||||||
query: ``
|
|
||||||
},
|
|
||||||
//待定接口 用于获取用户米游社顶部的模块栏
|
//待定接口 用于获取用户米游社顶部的模块栏
|
||||||
bbs_Businesses_url: {
|
bbs_Businesses_url: {
|
||||||
url: `${mys.bbs_api}/user/api/getUserBusinesses`,
|
url: `${mys.bbs_api}/user/api/getUserBusinesses`,
|
||||||
@ -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>=${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`,
|
||||||
|
206
model/user.js
206
model/user.js
@ -124,58 +124,56 @@ 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++) { //循环请求
|
||||||
// //有数据的时候不得行必须出去
|
await utils.sleepAsync(2000)
|
||||||
// if (!mysTask) {
|
res = await this.getData("sign", data, false)
|
||||||
// message += `${item.nickname}-${item.game_uid}:验证码失败请等待6分钟后重试或者手动上米游社签到~`;
|
if (res?.data?.gt) {
|
||||||
// break;
|
if(!isgt){
|
||||||
// } else {
|
isgt=true;
|
||||||
// // await utils.sleepAsync(60000 * 6) // 由于这个方法已经无法过验证码了所以不在处理
|
}
|
||||||
// }
|
let validate = await this.geetest(res.data)
|
||||||
// }
|
if (validate) {
|
||||||
await utils.sleepAsync(2000)
|
let header = {}
|
||||||
res = await this.getData("sign", data, false)
|
header["x-rpc-challenge"] = res["data"]["challenge"]
|
||||||
if (res?.data?.gt) {
|
header["x-rpc-validate"] = validate
|
||||||
let validate = await this.geetest(res.data)
|
header["x-rpc-seccode"] = `${validate}|jordan`
|
||||||
if (validate) {
|
data.headers = header
|
||||||
let header = {}
|
res = await this.getData("sign", data, false)
|
||||||
header["x-rpc-challenge"] = res["data"]["challenge"]
|
if (!res?.data?.gt) {
|
||||||
header["x-rpc-validate"] = validate
|
if (this.allSign&&!isgt) {
|
||||||
header["x-rpc-seccode"] = `${validate}|jordan`
|
this.allSign[forum.name].sign++;
|
||||||
data.headers = header
|
}
|
||||||
res = await this.getData("sign", data, false)
|
signMsg = `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
|
||||||
if (!res?.data?.gt) {
|
break;
|
||||||
if (this.allSign) {
|
} else {
|
||||||
this.allSign[forum.name].sign++;
|
if (this.allSign&&!isgt) {
|
||||||
|
this.allSign[forum.name].error++;
|
||||||
|
}
|
||||||
|
item.is_sign = false;
|
||||||
|
signMsg =
|
||||||
|
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
|
||||||
}
|
}
|
||||||
message += `${item.nickname}-${item.game_uid}:验证码签到成功~\n`
|
|
||||||
break;
|
|
||||||
} else {
|
} else {
|
||||||
if (this.allSign) {
|
if (this.allSign&&!isgt) {
|
||||||
this.allSign[forum.name].error++;
|
this.allSign[forum.name].error++;
|
||||||
}
|
}
|
||||||
item.is_sign = false;
|
signMsg = `${item.nickname}-${item.game_uid}:验证码失败~\n`
|
||||||
message +=
|
|
||||||
`${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this.allSign) {
|
if (this.allSign) {
|
||||||
this.allSign[forum.name].error++;
|
this.allSign[forum.name].sign++;
|
||||||
}
|
}
|
||||||
message += `${item.nickname}-${item.game_uid}:验证码失败~\n`
|
item.total_sign_day++;
|
||||||
|
signMsg =
|
||||||
|
`${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`
|
|
||||||
}
|
}
|
||||||
|
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,34 +559,42 @@ 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) {
|
||||||
if (uuId[0] * 1 > 5) {
|
try {
|
||||||
continue;
|
if (uuId[0] * 1 > 5) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let data = dataUid[uuId]
|
||||||
|
let user_id = data.userId * 1;
|
||||||
|
let e = {
|
||||||
|
user_id,
|
||||||
|
isTask: true
|
||||||
|
};
|
||||||
|
counts++;
|
||||||
|
e.cookie = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
||||||
|
Bot.logger.mark(`[米游币签到][第${counts}个]正在为qq${user_id}:uid:${uuId}签到中...`);
|
||||||
|
e.msg = "全部"
|
||||||
|
e.reply = (msg) => {
|
||||||
|
//关闭签到消息推送
|
||||||
|
if (!isPushSign || mul) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.includes("OK")) { //签到成功并且不是已签到的才推送
|
||||||
|
utils.relpyPrivate(user_id, msg + "uid:" + uuId + "\n自动签到成功");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
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 data = dataUid[uuId]
|
|
||||||
let user_id = data.userId * 1;
|
|
||||||
let e = {
|
|
||||||
user_id,
|
|
||||||
isTask: true
|
|
||||||
};
|
|
||||||
e.cookie = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
|
||||||
Bot.logger.mark(`正在为qq${user_id}:uid:${uuId}进行米游币签到中...`);
|
|
||||||
e.msg = "全部"
|
|
||||||
e.reply = (msg) => {
|
|
||||||
//关闭签到消息推送
|
|
||||||
if (!isPushSign || mul) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (msg.includes("OK")) { //签到成功并且不是已签到的才推送
|
|
||||||
utils.relpyPrivate(user_id, msg + "uid:" + uuId + "\n自动签到成功");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.e = e;
|
|
||||||
let res = await this.getbbsSign(this.ForumData);
|
|
||||||
e.reply(res.message)
|
|
||||||
await utils.sleepAsync(10000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let msg = `米社米币签到任务完成`
|
let msg = `米社米币签到任务完成`
|
||||||
@ -602,32 +607,33 @@ export default class user {
|
|||||||
bbsTask = false;
|
bbsTask = false;
|
||||||
}
|
}
|
||||||
async bbsGeetest() {
|
async bbsGeetest() {
|
||||||
let res = await this.getData('bbsGetCaptcha', false)
|
try {
|
||||||
let challenge = res.data["challenge"]
|
let res = await this.getData('bbsGetCaptcha', false)
|
||||||
await this.getData("geeType", res.data, false)
|
// let challenge = res.data["challenge"]
|
||||||
res = await this.getData("bbsValidate", res.data, false)
|
await this.getData("geeType", res.data, false)
|
||||||
if (res?.data?.validate) {
|
res = await this.getData("validate", res.data, false)
|
||||||
let validate = res?.data?.validate
|
if (res?.data?.validate) {
|
||||||
res = await this.getData("bbsCaptchaVerify", {
|
res = await this.getData("bbsCaptchaVerify", res.data, false)
|
||||||
headers: {
|
return res["data"]["challenge"]
|
||||||
"geetest_challenge": challenge,
|
}
|
||||||
"geetest_seccode": validate + "|jordan",
|
} catch (error) {
|
||||||
"geetest_validate": validate
|
//大概率是数据空导致报错这种情况很少见捏,所以你可以忽略不看
|
||||||
}
|
Bot.logger.error('[validate][接口请求]异常信息:' + error)
|
||||||
}, false)
|
return ""
|
||||||
return res["data"]["challenge"]
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
async geetest(data) {
|
async geetest(data) {
|
||||||
let res = await this.getData("validate", data, false)
|
try {
|
||||||
if (res?.data?.validate) {
|
let res = await this.getData("validate", data, false)
|
||||||
let validate = res?.data?.validate
|
if (res?.data?.validate) {
|
||||||
return validate
|
let validate = res?.data?.validate
|
||||||
} else if (res?.data?.result !== "slide") {
|
return validate
|
||||||
await redis.set(`xiaoyao:sign`, 1, { //写入缓存 过不了了
|
}
|
||||||
EX: 60 * 6 //等6分钟后再给用指令
|
} catch (error) {
|
||||||
});
|
//大概率是数据空导致报错这种情况很少见捏,所以你可以忽略不看
|
||||||
|
Bot.logger.error('[validate][接口请求]异常信息:' + error)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -746,15 +752,15 @@ export default class user {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async seachUid(data) {
|
async seachUid(data) {
|
||||||
let ltoken = '',v2Sk;
|
let ltoken = '', v2Sk;
|
||||||
if (data?.data) {
|
if (data?.data) {
|
||||||
let res;
|
let res;
|
||||||
if (this.e.sk) {
|
if (this.e.sk) {
|
||||||
if(this.e.sk.get('stoken').includes('v2_')){
|
if (this.e.sk.get('stoken').includes('v2_')) {
|
||||||
res=await this.getData('getLtoken',{cookies:this.e.raw_message},false)
|
res = await this.getData('getLtoken', { cookies: this.e.raw_message }, false)
|
||||||
ltoken=res?.data?.ltoken
|
ltoken = res?.data?.ltoken
|
||||||
}else{
|
} else {
|
||||||
v2Sk=await this.getData('getByStokenV2',{headers:{Cookie:this.e.raw_message}},false)
|
v2Sk = await this.getData('getByStokenV2', { headers: { Cookie: this.e.raw_message } }, false)
|
||||||
}
|
}
|
||||||
this.e.cookie =
|
this.e.cookie =
|
||||||
`ltoken=${this.e.sk?.get('ltoken') || ltoken};ltuid=${this.e.sk?.get('stuid')};cookie_token=${data.data.cookie_token}; account_id=${this.e.sk?.get('stuid')};`
|
`ltoken=${this.e.sk?.get('ltoken') || ltoken};ltuid=${this.e.sk?.get('stuid')};cookie_token=${data.data.cookie_token}; account_id=${this.e.sk?.get('stuid')};`
|
||||||
@ -764,9 +770,9 @@ export default class user {
|
|||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
this.e.cookie = this.e.original_msg //发送的为cookies
|
this.e.cookie = this.e.original_msg //发送的为cookies
|
||||||
this.cookies=`stuid=${this.e.stuid};stoken=${data?.data?.list[0].token};ltoken=${data?.data?.list[1].token}`
|
this.cookies = `stuid=${this.e.stuid};stoken=${data?.data?.list[0].token};ltoken=${data?.data?.list[1].token}`
|
||||||
res=await this.getData('getLtoken',{cookies:this.cookies},false)
|
res = await this.getData('getLtoken', { cookies: this.cookies }, false)
|
||||||
v2Sk=await this.getData('getByStokenV2',{headers:{Cookie:this.cookies}},false)
|
v2Sk = await this.getData('getByStokenV2', { headers: { Cookie: this.cookies } }, false)
|
||||||
}
|
}
|
||||||
res = await this.getData("userGameInfo", this.ForumData[1], false)
|
res = await this.getData("userGameInfo", this.ForumData[1], false)
|
||||||
if (res?.retcode != 0) {
|
if (res?.retcode != 0) {
|
||||||
@ -779,9 +785,9 @@ export default class user {
|
|||||||
uids.push(uid)
|
uids.push(uid)
|
||||||
datalist[uid] = {
|
datalist[uid] = {
|
||||||
stuid: this.e?.sk?.get('stuid') || this.e.stuid,
|
stuid: this.e?.sk?.get('stuid') || this.e.stuid,
|
||||||
stoken:v2Sk?.data?.token?.token || this.e?.sk?.get('stoken') || data?.data?.list[0].token,
|
stoken: v2Sk?.data?.token?.token || this.e?.sk?.get('stoken') || data?.data?.list[0].token,
|
||||||
ltoken: this.e?.sk?.get('ltoken') || ltoken || data?.data?.list[1].token,
|
ltoken: this.e?.sk?.get('ltoken') || ltoken || data?.data?.list[1].token,
|
||||||
mid: this.e?.sk?.get('mid')||v2Sk?.data?.user_info?.mid,
|
mid: this.e?.sk?.get('mid') || v2Sk?.data?.user_info?.mid,
|
||||||
uid: uid,
|
uid: uid,
|
||||||
userId: this.e.user_id,
|
userId: this.e.user_id,
|
||||||
is_sign: true
|
is_sign: true
|
||||||
|
Loading…
Reference in New Issue
Block a user