From bc7ad7b40e6e1938e8869e3ed22a42967076b6d4 Mon Sep 17 00:00:00 2001 From: ctrlcvs <1509167646@qq.com> Date: Sat, 14 Jan 2023 11:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=81=E8=81=8A=E6=92=A4?= =?UTF-8?q?=E5=9B=9E=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Note.js | 48 +++++++++++------------ model/mhyTopUpLogin.js | 76 ++++++++++++++++++------------------- model/mys/utils.js | 2 +- resources/qrCode/index.html | 9 +++-- 4 files changed, 69 insertions(+), 66 deletions(-) diff --git a/apps/Note.js b/apps/Note.js index 76a1d9b..dd60a0d 100644 --- a/apps/Note.js +++ b/apps/Note.js @@ -28,29 +28,29 @@ function init() { export async function Note(e, { render }, poke) { - if (!Cfg.get("sys.Note") && !poke) { + if (!Cfg.get("sys.Note") && !poke && !this.e?.isTask) { return false; } let notes = new note(e); let cookie, uid, res; if (isV3) { - if(e.msg.replace(/全|全部/g,'多').includes('多')){ - let ck=await gsCfg.getBingCkSingle(e.user_id) - if(Object.keys(ck).length==0){ + if (e.msg.replace(/全|全部/g, '多').includes('多')) { + let ck = await gsCfg.getBingCkSingle(e.user_id) + if (Object.keys(ck).length == 0) { e.reply(`请先【#绑定cookie】`) return true; } - let sendMsg=[] - e._reply=e.reply; - e.reply=((msg)=>{ + let sendMsg = [] + e._reply = e.reply; + e.reply = ((msg) => { sendMsg.push(msg) }) - if(Object.keys(ck).length>1){ + if (Object.keys(ck).length > 1) { e._reply(`多账号体力查询中请稍等...`) } - for(let item of Object.keys(ck)){ - let res=await (await e.runtime.createMysApi(ck[item].uid,ck[item].ck)).getData('dailyNote') - await notes.getNote(ck[item].ck,ck[item].uid,res,{render}) + for (let item of Object.keys(ck)) { + let res = await (await e.runtime.createMysApi(ck[item].uid, ck[item].ck)).getData('dailyNote') + await notes.getNote(ck[item].ck, ck[item].uid, res, { render }) } e._reply(sendMsg) return true; @@ -99,22 +99,22 @@ export async function Note(e, { e.reply(`体力查询错误:${res.message}`); Bot.logger.mark(`体力查询错误:${JSON.stringify(res)}`); } - + return true; } - + //redis保存uid redis.set(`genshin:uid:${e.user_id}`, uid, { EX: 2592000 }); - + //更新 if (NoteCookie[e.user_id]) { NoteCookie[e.user_id].maxTime = new Date().getTime() + res.data.resin_recovery_time * 1000; saveJson(); } } - return await notes.getNote(cookie,uid,res,{render}) + return await notes.getNote(cookie, uid, res, { render }) } async function getDailyNote(uid, cookie) { @@ -226,7 +226,7 @@ export async function pokeNote(e, { export async function Note_appoint(e) { let mbPath = `${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/`; - let isDel= e.msg.includes("移除") + let isDel = e.msg.includes("移除") let msg = e.msg.replace(/#|井|体力|模板|设置|移除/g, ""); let All = ["默认", "随机", "0"]; let urlType = note_file(); @@ -242,7 +242,7 @@ export async function Note_appoint(e) { if (msg.includes("列表")) { let isUser = msg.includes('我的') let temp = tempData[e.user_id]?.temp; - if ((!temp||temp?.length===0) && isUser) { + if ((!temp || temp?.length === 0) && isUser) { e.reply("未获取到您设置的模板信息哦~") return true; } @@ -316,16 +316,16 @@ export async function Note_appoint(e) { if (typeof tempData[e.user_id]["temp"] === "string") { temp = [tempData[e.user_id]["temp"], msg] } else { - temp =tempData[e.user_id]["temp"] + temp = tempData[e.user_id]["temp"] if (!tempData[e.user_id]["temp"]?.includes(msg)) { temp.push(msg) } } - let sendMsg="诶~这是你选的模板吗,模板设置成功了快用指令来试试吧~!" - if(isDel){ - if(temp.includes(msg)){ - temp.splice(temp.indexOf(msg),1) - sendMsg=`模板${msg}已移除~` + let sendMsg = "诶~这是你选的模板吗,模板设置成功了快用指令来试试吧~!" + if (isDel) { + if (temp.includes(msg)) { + temp.splice(temp.indexOf(msg), 1) + sendMsg = `模板${msg}已移除~` } } tempData[e.user_id] = { @@ -338,7 +338,7 @@ export async function Note_appoint(e) { return true; } -const note_file = function(xiaoyao) { +const note_file = function (xiaoyao) { let url1 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/Template/` let url2 = `./plugins/xiaoyao-cvs-plugin/resources/BJT-Templet/` //冤种情况。。 let url3 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image/` diff --git a/model/mhyTopUpLogin.js b/model/mhyTopUpLogin.js index 89282ad..f14b91c 100644 --- a/model/mhyTopUpLogin.js +++ b/model/mhyTopUpLogin.js @@ -5,7 +5,7 @@ import { } from '../components/Changelog.js' import utils from './mys/utils.js'; import gsCfg from './gsCfg.js'; -import {segment} from 'oicq' +import { segment } from 'oicq' export default class mysTopLogin { constructor(e) { this.e = e; @@ -64,7 +64,7 @@ export default class mysTopLogin { this.e.reply(`请将账号密码用逗号隔开发送以完成绑定\n例:账号xxx@qq.com,密码xxxxx`) } async UserPassLogin() { - let msg = this.e.msg.replace(/账号|密码|:|:/g,'').replace(/,|,/, ',').split(','); + let msg = this.e.msg.replace(/账号|密码|:|:/g, '').replace(/,|,/, ',').split(','); if (msg.length != 2) { return false; } @@ -77,7 +77,7 @@ export default class mysTopLogin { Bot.logger.mark("[米哈游登录] 正在验证") this.aigis_captcha_data = JSON.parse(res.aigis_data.data) // let validate = await this.crack_geetest() - let validate = await this.user.getData("validate",this.aigis_captcha_data,false) + let validate = await this.user.getData("validate", this.aigis_captcha_data, false) if (validate?.data?.validate) { Bot.logger.mark("[米哈游登录] 验证成功") } else { @@ -85,25 +85,25 @@ export default class mysTopLogin { this.e.reply('接口效验失败,请重新尝试~') return false } - let aigis= res.aigis_data.session_id + ";" + Buffer.from(JSON.stringify({ + let aigis = res.aigis_data.session_id + ";" + Buffer.from(JSON.stringify({ geetest_challenge: validate?.data?.challenge, geetest_seccode: validate?.data?.validate + "|jordan", geetest_validate: validate?.data?.validate })).toString("base64") - body.headers={ - 'x-rpc-aigis':aigis, + body.headers = { + 'x-rpc-aigis': aigis, } - res = await this.user.getData("loginByPassword",body,false) + res = await this.user.getData("loginByPassword", body, false) Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(res))}`) } if (res.retcode == 0) { - let cookies=`stoken=${res.data.token.token}&mid=${res.data.user_info.mid}` - let cookie_token =this.user.getData("bbsGetCookie",{cookies}) + let cookies = `stoken=${res.data.token.token}&mid=${res.data.user_info.mid}` + let cookie_token = this.user.getData("bbsGetCookie", { cookies }) let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies};stuid=${res.data.user_info.aid};` }, false) Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`) return { - cookie:`ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`, - stoken:`${cookies};stuid=${res.data.user_info.aid};` + cookie: `ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`, + stoken: `${cookies};stuid=${res.data.user_info.aid};` } } else { await this.e.reply(`错误:${JSON.stringify(res)}`, true) @@ -111,13 +111,13 @@ export default class mysTopLogin { } } async crack_geetest() { - let res =await this.user.getData("microgg", this.aigis_captcha_data, false) + let res = await this.user.getData("microgg", this.aigis_captcha_data, false) Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(res))}`) await this.e.reply(`请完成验证:${res.shorturl}`, true) for (let n = 1; n < 60; n++) { await utils.sleepAsync(5000) try { - res =await this.user.getData("microggVl", this.aigis_captcha_data, false) + res = await this.user.getData("microggVl", this.aigis_captcha_data, false) if (res.geetest_validate) { return res } @@ -129,12 +129,12 @@ export default class mysTopLogin { return false; } - async showgoods(){ + async showgoods() { let goodslist = await this.goodsList() - if(!goodslist) return false; + if (!goodslist) return false; let msg = ['当前支持的商品有:\n'] for (const [i, goods] of Object.entries(goodslist)) { - if(i=='api') continue; + if (i == 'api') continue; let num = `${goods['goods_name']}×${(goods['goods_unit'])}` + ((goods['goods_unit']) > 0 ? goods["goods_name"] : '') // console.log(`ID:${i} ${num} 价格:${parseInt(goods['price']) / 100}元`) msg.push(`ID:${i} ${num} 价格:${parseInt(goods['price']) / 100}元\n`) @@ -143,7 +143,7 @@ export default class mysTopLogin { return true; } - async GetCode(){ + async GetCode() { try { let msg = this.e.msg.replace(/,|,|\|/g, ' ').split(' ') if (msg.length != 3) { @@ -155,12 +155,12 @@ export default class mysTopLogin { this.e.reply('uid格式不对!') return true; } - let res =await this.user.getData('GetCode',{msg:this.e.msg.replace('#','')}) - if(!res) return false; - if(res?.code!=200&&res?.retcode!=0){ + let res = await this.user.getData('GetCode', { msg: this.e.msg.replace('#', '') }) + if (!res) return false; + if (res?.code != 200 && res?.retcode != 0) { return true } - this.e.reply([`uid:${res.data.uid},请使用${iswx=='weixin'?'微信':"支付宝"}扫码支付:`,segment.image(res.data.base64.replace("data:image/png;base64,", "base64://")),`\n订单号:${res['data']['order_no']}\n 价格:${(res['data']['amount'])/100}元`]) + this.e.reply([`uid:${res.data.uid},请使用${iswx == 'weixin' ? '微信' : "支付宝"}扫码支付:`, segment.image(res.data.base64.replace("data:image/png;base64,", "base64://")), `\n订单号:${res['data']['order_no']}\n 价格:${(res['data']['amount']) / 100}元`]) } catch (error) { this.e.reply('出问题了捏') } @@ -168,28 +168,28 @@ export default class mysTopLogin { } async goodsList() { - let goods =await this.user.getData("goodsList") - if(!goods) return false; + let goods = await this.user.getData("goodsList") + if (!goods) return false; return goods; } - async checkOrder(){ - let msg,uid,order_no - if(!this.e.source){ - msg=this.e.msg.match(/\d{9,}/g) - uid=msg[0],order_no=msg[1] - }else{ - msg=this.e.source.message.match(/\d{9,}/g) - uid=msg[0],order_no=msg[1] + async checkOrder() { + let msg, uid, order_no + if (!this.e.source) { + msg = this.e.msg.match(/\d{9,}/g) + uid = msg[0], order_no = msg[1] + } else { + msg = this.e.source.message.match(/\d{9,}/g) + uid = msg[0], order_no = msg[1] } - let res=await this.user.getData('checkOrder',{ - uid,order_no - },false) - if(!res) return false; - if(res?.data?.status==1){ + let res = await this.user.getData('checkOrder', { + uid, order_no + }, false) + if (!res) return false; + if (res?.data?.status == 1) { this.e.reply(`uid:${uid},订单:${order_no}等待支付中`) - }else if(res?.data?.status==999){ + } else if (res?.data?.status == 999) { this.e.reply(`uid:${uid},订单:${order_no}已支付完成`) - }else{ + } else { this.e.reply(`订单:${order_no},${res.message}`) } return true diff --git a/model/mys/utils.js b/model/mys/utils.js index 813af61..e921781 100644 --- a/model/mys/utils.js +++ b/model/mys/utils.js @@ -114,7 +114,7 @@ export function recallMsg(e,r,times){ if(e.group){ e.group.recallMsg(r.message_id) }else{ - e.member.recallMsg(r.message_id) + e.friend.recallMsg(r.message_id) } },1000 * times) } diff --git a/resources/qrCode/index.html b/resources/qrCode/index.html index 2376cca..b8952f8 100644 --- a/resources/qrCode/index.html +++ b/resources/qrCode/index.html @@ -8,18 +8,21 @@ background-color: rgb(243, 242, 241); padding: 20px 0 10px 0 !important; } + .topTitle table{ + margin: 0 auto; + } {{/block}} {{block 'main'}} -
+