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
16cea766be
commit
3bdc02c662
@ -45,13 +45,13 @@ import {
|
||||
} from "./sign.js"
|
||||
import {
|
||||
rule as topupLoginRule,
|
||||
qrCodeLogin,UserPassMsg,UserPassLogin,
|
||||
qrCodeLogin,UserPassMsg,UserPassLogin,GetCode,showgoods,checkOrder
|
||||
} from './mhyTopUpLogin.js'
|
||||
export {
|
||||
updateRes, updateTemp,
|
||||
delSign, gcPaylog,
|
||||
cloudSign,qrCodeLogin,
|
||||
seach, bindLogin_ticket,
|
||||
seach, bindLogin_ticket,GetCode,showgoods,checkOrder,
|
||||
bbsSign,UserPassMsg,UserPassLogin,
|
||||
gclog,
|
||||
mytoken, getBasicVoide,
|
||||
|
@ -15,19 +15,36 @@ export const rule = {
|
||||
describe: "账号密码登录"
|
||||
},
|
||||
UserPassLogin: {
|
||||
reg: `^(.*)$`,
|
||||
reg: `^账号(.*)密码(.*)$`,
|
||||
describe: "账号密码登录"
|
||||
},
|
||||
// GetCode: {
|
||||
// /** 命令正则匹配 */
|
||||
// reg: '^#?原神(微信)?充值(微信)?(.*)$',
|
||||
// /** 执行方法 */
|
||||
// describe: '原神充值(离线)'
|
||||
// }, showgoods: {
|
||||
// reg: "^#?商品列表",
|
||||
// fnc: '原神充值商品列表'
|
||||
// }
|
||||
GetCode: {
|
||||
/** 命令正则匹配 */
|
||||
reg: '^#?原神(微信)?充值(微信)?(.*)$',
|
||||
/** 执行方法 */
|
||||
describe: '原神充值(离线)'
|
||||
}, showgoods: {
|
||||
reg: "^#?商品列表",
|
||||
describe: '原神充值商品列表'
|
||||
},checkOrder:{
|
||||
reg:'^#?订单查询',
|
||||
describe:'充值订单查询'
|
||||
}
|
||||
}
|
||||
export async function checkOrder(e) {
|
||||
let Mys = new mys(e)
|
||||
return await Mys.checkOrder()
|
||||
}
|
||||
export async function GetCode(e) {
|
||||
let Mys = new mys(e)
|
||||
return await Mys.GetCode()
|
||||
}
|
||||
|
||||
export async function showgoods(e) {
|
||||
let Mys = new mys(e)
|
||||
return await Mys.showgoods()
|
||||
}
|
||||
|
||||
|
||||
export async function qrCodeLogin(e, { render }) {
|
||||
let Mys = new mys(e)
|
||||
@ -60,7 +77,7 @@ export async function UserPassLogin(e) {
|
||||
let Mys = new mys(e)
|
||||
let res = await Mys.UserPassLogin();
|
||||
if (res) await bindSkCK(e, res)
|
||||
return true;
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function bindSkCK(e, res) {
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
} from '../components/Changelog.js'
|
||||
import utils from './mys/utils.js';
|
||||
import gsCfg from './gsCfg.js';
|
||||
|
||||
import {segment} from 'oicq'
|
||||
export default class mysTopLogin {
|
||||
constructor(e) {
|
||||
this.e = e;
|
||||
@ -61,10 +61,10 @@ export default class mysTopLogin {
|
||||
|
||||
async UserPassMsg() {
|
||||
this.e.reply(this.sendMsgUserPassLogin)
|
||||
this.e.reply(`请将账号密码用逗号隔开发送以完成绑定\n例:xxx@qq.com,xxxxx`)
|
||||
this.e.reply(`请将账号密码用逗号隔开发送以完成绑定\n例:账号xxx@qq.com,密码xxxxx`)
|
||||
}
|
||||
async UserPassLogin() {
|
||||
let msg = this.e.msg.replace(',|,', ',').split(',');
|
||||
let msg = this.e.msg.replace(/账号|密码|:|:/g,'').replace(/,|,/, ',').split(',');
|
||||
if (msg.length != 2) {
|
||||
return false;
|
||||
}
|
||||
@ -128,4 +128,70 @@ export default class mysTopLogin {
|
||||
await this.e.reply("验证超时", true)
|
||||
return false;
|
||||
}
|
||||
|
||||
async showgoods(){
|
||||
let goodslist = await this.goodsList()
|
||||
if(!goodslist) return false;
|
||||
let msg = ['当前支持的商品有:\n']
|
||||
for (const [i, goods] of Object.entries(goodslist)) {
|
||||
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`)
|
||||
}
|
||||
this.e.reply(msg)
|
||||
return true;
|
||||
}
|
||||
|
||||
async GetCode(){
|
||||
try {
|
||||
let msg = this.e.msg.replace(/,|,|\|/g, ' ').split(' ')
|
||||
if (msg.length != 3) {
|
||||
this.e.reply(`格式参考:#原神充值 6(商品ID) 120065390(uid)\n 可通过【#商品列表】获取可操作商品`)
|
||||
return true;
|
||||
}
|
||||
let iswx = msg[0].includes('微信') ? 'weixin' : 'alipay'
|
||||
if (msg[2].length != 9) {
|
||||
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){
|
||||
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}元`])
|
||||
} catch (error) {
|
||||
this.e.reply('出问题了捏')
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async goodsList() {
|
||||
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]
|
||||
}
|
||||
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){
|
||||
this.e.reply(`uid:${uid},订单:${order_no}已支付完成`)
|
||||
}else{
|
||||
this.e.reply(`订单:${order_no},${res.message}`)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
@ -293,7 +293,18 @@ export default class miHoYoApi {
|
||||
url: `https://api-takumi.mihoyo.com/auth/api/getCookieAccountInfoByGameToken`,
|
||||
query: `account_id=${data.uid}&game_token=${data.token}`
|
||||
},
|
||||
|
||||
GetCode:{
|
||||
url:``,
|
||||
query:``
|
||||
},
|
||||
goodsList:{
|
||||
url:``,
|
||||
query:``
|
||||
},
|
||||
checkOrder:{
|
||||
url:``,
|
||||
body:{}
|
||||
}
|
||||
}
|
||||
if (!urlMap[type]) return false
|
||||
let {
|
||||
|
Loading…
Reference in New Issue
Block a user