From f1cf0a854012576ee6cb462bc24faab4a9774bab Mon Sep 17 00:00:00 2001 From: ctrlcvs <1509167646@qq.com> Date: Sat, 15 Apr 2023 07:38:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0`#=E6=89=AB=E7=A0=81=E7=BB=91?= =?UTF-8?q?=E5=AE=9A`=E6=8C=87=E4=BB=A4=E5=BC=80=E5=85=B3(#56)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/admin.js | 4 ++++ apps/mhyTopUpLogin.js | 18 ++++++++++++++++-- resources/admin/index.html | 8 ++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/apps/admin.js b/apps/admin.js index 30d8ee2..42b2644 100644 --- a/apps/admin.js +++ b/apps/admin.js @@ -19,6 +19,7 @@ let cfgMap = { "模板": "mb.len", "获取sk":"ck.sk", "目录":"Atlas.all", + "扫码绑定":'mhy.qrcode', }; let sysCfgReg = `^#图鉴设置\s*(${lodash.keys(cfgMap).join("|")})?\s*(.*)$`; export const rule = { @@ -74,6 +75,8 @@ export async function sysCfg(e, { val = Math.min(200, Math.max(50, val * 1 || 100)); }else if(cfgKey === "mb.len"){ val= Math.min(2,Math.max(val,0)); + }else if(cfgKey==='mhy.qrcode'){ + val= Math.min(3,Math.max(val,0)); } else { val = !/关闭/.test(val); } @@ -88,6 +91,7 @@ export async function sysCfg(e, { len:Cfg.get("mb.len", 0), poke: getStatus("note.poke",false), isSk: getStatus("ck.sk",false), + qrcode:Cfg.get("mhy.qrcode", 0), imgPlus: fs.existsSync(plusPath), notePlus: fs.existsSync(notePlus), bg: await rodom(), //获取底图 diff --git a/apps/mhyTopUpLogin.js b/apps/mhyTopUpLogin.js index 1c5877a..cd8f291 100644 --- a/apps/mhyTopUpLogin.js +++ b/apps/mhyTopUpLogin.js @@ -5,6 +5,9 @@ import mys from "../model/mhyTopUpLogin.js" import Common from "../components/Common.js"; import { bindStoken } from './user.js' import utils from '../model/mys/utils.js'; +import { + Cfg, +} from "../components/index.js"; const _path = process.cwd(); export const rule = { qrCodeLogin: { @@ -31,7 +34,7 @@ export const rule = { export async function payOrder(e, { render }) { let Mys = new mys(e) if (/(商品|充值)列表/.test(e.msg)) { - return await Mys.showgoods( { render }) + return await Mys.showgoods({ render }) } else if (/(订单|查询)(订单|查询)/.test(e.msg)) { return await Mys.checkOrder() } else if (e.msg.includes('充值')) { @@ -41,6 +44,17 @@ export async function payOrder(e, { render }) { } export async function qrCodeLogin(e, { render }) { + let power = Cfg.get("mhy.qrcode") + if (power === 3) { + return false; + } else { + if (power == 2 && !e.isPrivate) { + return false; + } + if (power == 1 && !e.isGroup) { + return false; + } + } let Mys = new mys(e) let res = await Mys.qrCodeLogin() if (!res?.data) return false; @@ -89,7 +103,7 @@ export async function UserPassLogin(e) { export async function bindSkCK(e, res) { e.msg = res?.stoken, e.raw_message = res?.stoken e.isPrivate = true - await bindStoken(e,'1') + await bindStoken(e, '1') e.ck = res?.cookie, e.msg = res.cookie, e.raw_message = res.cookie; if (isV3) { let userck = (await import(`file://${_path}/plugins/genshin/model/user.js`)).default diff --git a/resources/admin/index.html b/resources/admin/index.html index 7bd5dca..09af130 100644 --- a/resources/admin/index.html +++ b/resources/admin/index.html @@ -119,6 +119,14 @@