mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2025-01-04 22:21:08 +08:00
修正签到查询显示问题、米游币全部签到问题、米社自动签到报错问题
This commit is contained in:
parent
6bef45da11
commit
91f1d98176
@ -38,8 +38,9 @@ export const rule = {
|
|||||||
}
|
}
|
||||||
export async function cloudSign(e){
|
export async function cloudSign(e){
|
||||||
let user = new User(e);
|
let user = new User(e);
|
||||||
let res= await user.cloudSeach()
|
START = moment().unix();
|
||||||
await replyMsg(e, "云原神签到成功\n当前"+res.message);
|
let res= await user.cloudSign()
|
||||||
|
await replyMsg(e, res.message);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
export async function signTask(e){
|
export async function signTask(e){
|
||||||
|
@ -202,7 +202,7 @@ export default class miHoYoApi {
|
|||||||
},
|
},
|
||||||
cloudGamer: {
|
cloudGamer: {
|
||||||
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/ackNotification`,
|
url: `${mys.cloud_api}/hk4e_cg_cn/gamer/api/ackNotification`,
|
||||||
query: `id=${data.reward_id}`,
|
body: {id:data.reward_id},
|
||||||
types: 'cloud'
|
types: 'cloud'
|
||||||
},
|
},
|
||||||
cloudGet: {
|
cloudGet: {
|
||||||
|
@ -20,6 +20,15 @@ export function randomString(length,os=false) {
|
|||||||
}
|
}
|
||||||
return randomStr;
|
return randomStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function redisGet(userId,type='bbs'){
|
||||||
|
await redis.get(`xiaoyao:${type}:${userId}`);
|
||||||
|
}
|
||||||
|
export async function redisSet(userId,type='bbs',data){
|
||||||
|
var time = moment(Date.now()).add('days', 1).format('YYYY-MM-DD 00:00:00')
|
||||||
|
var new_date = (new Date(time).getTime() - new Date().getTime()) / 1000 //获取隔天凌晨的时间差
|
||||||
|
await redis.set(`xiaoyao:${type}:${userId}`,JSON.stringify(data),{EX:parseInt(new_date)});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 发送私聊消息,仅给好友发送
|
* 发送私聊消息,仅给好友发送
|
||||||
* @param user_id qq号
|
* @param user_id qq号
|
||||||
@ -91,7 +100,7 @@ export default {
|
|||||||
sleepAsync,getServer,
|
sleepAsync,getServer,
|
||||||
randomSleepAsync,
|
randomSleepAsync,
|
||||||
replyMake,
|
replyMake,
|
||||||
randomString,
|
randomString,redisGet,redisSet,
|
||||||
relpyPrivate,
|
relpyPrivate,
|
||||||
getCookieMap
|
getCookieMap
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ export default class user {
|
|||||||
let yundata = yunres.data
|
let yundata = yunres.data
|
||||||
if (yunres.retcode === 0) {
|
if (yunres.retcode === 0) {
|
||||||
sumData["云原神"] = {
|
sumData["云原神"] = {
|
||||||
"今日可获取": yundata?.coin?.coin_num,
|
"今日可获取": yundata?.coin?.free_coin_num,
|
||||||
|
"米云币":yundata?.coin?.coin_num,
|
||||||
"免费时长": yundata?.free_time?.free_time,
|
"免费时长": yundata?.free_time?.free_time,
|
||||||
"总时长": yundata.total_time
|
"总时长": yundata.total_time
|
||||||
}
|
}
|
||||||
@ -88,9 +89,9 @@ export default class user {
|
|||||||
if (!(this.configSign.signlist.includes(forum.name))) {
|
if (!(this.configSign.signlist.includes(forum.name))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
message += `**${forum.name}**\n`
|
|
||||||
let res
|
let res
|
||||||
try {
|
try {
|
||||||
|
message += `**${forum.name}**\n`
|
||||||
res = await this.getData("userGameInfo", forum)
|
res = await this.getData("userGameInfo", forum)
|
||||||
await utils.sleepAsync(300) //等几毫秒免得请求太频繁了
|
await utils.sleepAsync(300) //等几毫秒免得请求太频繁了
|
||||||
if (res?.data?.list?.length === 0 || !res?.data?.list) {
|
if (res?.data?.list?.length === 0 || !res?.data?.list) {
|
||||||
@ -152,7 +153,22 @@ export default class user {
|
|||||||
async docHelp(type) {
|
async docHelp(type) {
|
||||||
return this.configSign[type.includes("云") ? "yunDoc" : "cookiesDoc"]
|
return this.configSign[type.includes("云") ? "yunDoc" : "cookiesDoc"]
|
||||||
}
|
}
|
||||||
|
async cloudSign(){
|
||||||
|
let res = await this.getData("cloudReward")
|
||||||
|
if(res?.data?.list?.length==0||!res?.data?.list){
|
||||||
|
res.message=`您今天的奖励已经领取了~`
|
||||||
|
}else{
|
||||||
|
let sendMsg=``
|
||||||
|
for(let item of res?.data?.list){
|
||||||
|
let reward_id = item.id;
|
||||||
|
let reward_msg = item.msg;
|
||||||
|
res = await this.getData("cloudGamer",{reward_id})
|
||||||
|
sendMsg+=`\n领取奖励,ID:${reward_id},Msg:${reward_msg}`
|
||||||
|
}
|
||||||
|
res.message=sendMsg;
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
async cloudSeach() {
|
async cloudSeach() {
|
||||||
let res = await this.getData("cloudGet") //这样会算签到?具体待测试
|
let res = await this.getData("cloudGet") //这样会算签到?具体待测试
|
||||||
if (res?.retcode == -100) {
|
if (res?.retcode == -100) {
|
||||||
@ -185,10 +201,6 @@ export default class user {
|
|||||||
challenge = '',
|
challenge = '',
|
||||||
res;
|
res;
|
||||||
try {
|
try {
|
||||||
if (bbsTask) {
|
|
||||||
this.e.reply(`米游币自动签到任务进行中、暂不支持手动签到`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (let forum of forumData) {
|
for (let forum of forumData) {
|
||||||
let trueDetail = 0;
|
let trueDetail = 0;
|
||||||
let Vote = 0;
|
let Vote = 0;
|
||||||
@ -398,7 +410,7 @@ export default class user {
|
|||||||
utils.relpyPrivate(qq, msg + "\n云原神自动签到成功");
|
utils.relpyPrivate(qq, msg + "\n云原神自动签到成功");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await this.cloudSeach(e);
|
await this.cloudSign(e);
|
||||||
await utils.sleepAsync(10000);
|
await utils.sleepAsync(10000);
|
||||||
}
|
}
|
||||||
let msg = `云原神签到任务完成`
|
let msg = `云原神签到任务完成`
|
||||||
@ -487,7 +499,7 @@ export default class user {
|
|||||||
bbsTask = false;
|
bbsTask = false;
|
||||||
}
|
}
|
||||||
async bbsGeetest() {
|
async bbsGeetest() {
|
||||||
let res = await this.getData('bbsGetCaptcha') //?????????????????????????????
|
let res = await this.getData('bbsGetCaptcha')
|
||||||
let challenge = res.data["challenge"]
|
let challenge = res.data["challenge"]
|
||||||
res = await this.getData("bbsValidate", res.data)
|
res = await this.getData("bbsValidate", res.data)
|
||||||
if (res?.data?.validate) {
|
if (res?.data?.validate) {
|
||||||
@ -530,7 +542,6 @@ export default class user {
|
|||||||
skuid
|
skuid
|
||||||
} = await this.getCookie(e);
|
} = await this.getCookie(e);
|
||||||
let cookiesDoc = await this.getcookiesDoc();
|
let cookiesDoc = await this.getcookiesDoc();
|
||||||
// let miHoYoApi = new MihoYoApi(this.e);
|
|
||||||
if (!cookie) {
|
if (!cookie) {
|
||||||
e.reply("请先#绑定cookie\n发送【体力帮助】查看配置教程")
|
e.reply("请先#绑定cookie\n发送【体力帮助】查看配置教程")
|
||||||
return false;
|
return false;
|
||||||
@ -543,7 +554,7 @@ export default class user {
|
|||||||
// e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 " + cookiesDoc)
|
// e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 " + cookiesDoc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let flot = this.stoken(cookie, e)
|
let flot =await this.stoken(cookie, e)
|
||||||
await utils.sleepAsync(1000); //延迟加载防止文件未生成
|
await utils.sleepAsync(1000); //延迟加载防止文件未生成
|
||||||
if (!flot) {
|
if (!flot) {
|
||||||
e.reply("登录失效请重新登录获取cookie发送机器人~")
|
e.reply("登录失效请重新登录获取cookie发送机器人~")
|
||||||
@ -585,20 +596,24 @@ export default class user {
|
|||||||
if (Object.keys(datalist).length > 0) {
|
if (Object.keys(datalist).length > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const map = utils.getCookieMap(cookie);
|
const map =await utils.getCookieMap(cookie);
|
||||||
let loginTicket = map.get("login_ticket");
|
let loginTicket = map?.get("login_ticket");
|
||||||
const loginUid = map.get("login_uid") ? map.get("login_uid") : map.get("ltuid");
|
const loginUid = map?.get("login_uid") ? map?.get("login_uid") : map?.get("ltuid");
|
||||||
if (isV3) {
|
if (isV3) {
|
||||||
loginTicket = gsCfg.getBingCookie(e.user_id).login_ticket
|
loginTicket = gsCfg.getBingCookie(e.user_id).login_ticket
|
||||||
}
|
}
|
||||||
|
let mhyapi = new miHoYoApi(this.e);
|
||||||
let res = this.getData("bbsStoken", {
|
let res = await mhyapi.getData("bbsStoken", {
|
||||||
loginUid,
|
loginUid,
|
||||||
loginTicket
|
loginTicket
|
||||||
})
|
})
|
||||||
|
// this.getData("bbsStoken", {
|
||||||
|
// loginUid,
|
||||||
|
// loginTicket
|
||||||
|
// })
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
datalist[e.uid] = {
|
datalist[e.uid] = {
|
||||||
stuid: map.get("account_id"),
|
stuid: map?.get("account_id"),
|
||||||
stoken: data.data.list[0].token,
|
stoken: data.data.list[0].token,
|
||||||
ltoken: data.data.list[1].token,
|
ltoken: data.data.list[1].token,
|
||||||
uid: e.uid,
|
uid: e.uid,
|
||||||
|
Loading…
Reference in New Issue
Block a user