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 @@