From d082c878098920ac248a4b0485bc86ab4d188745 Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Sat, 24 Aug 2024 15:57:17 +0800 Subject: [PATCH] =?UTF-8?q?config:=20=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=87?= =?UTF-8?q?=F0=9F=90=8E=E7=9A=84=F0=9F=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- defSet/config.yaml | 4 ++++ guoba.support.js | 28 +++++++++++++++++++++++----- lib/mysapi.js | 8 +++++++- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/defSet/config.yaml b/defSet/config.yaml index 5ad4c5b..00dbba9 100644 --- a/defSet/config.yaml +++ b/defSet/config.yaml @@ -5,5 +5,9 @@ query: update: autoCheck: true # 自动检查更新 cron: 0 0/10 * * * ? # 更新检查时间 +# 需要调用过🐎的接口code +mysCode: + - 1034 + - 10035 # 自定义绑定设备下载url url: https://ghproxy.mihomo.me/https://raw.githubusercontent.com/forchannot/get_device_info/main/app/build/outputs/apk/debug/app-debug.apk \ No newline at end of file diff --git a/guoba.support.js b/guoba.support.js index 74023c2..bee1ead 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -61,19 +61,36 @@ export function supportGuoba() { }, { field: 'config.update.autoCheck', - label: '自动检查更新', - bottomHelpMessage: '是否开启自动检查更新(仅检查,不更新)', + label: '更新推送', + bottomHelpMessage: '是否开启自动检查更新推送(仅检查,不更新)', component: 'Switch', }, { field: 'config.update.cron', - label: '自动检查更新时间', - bottomHelpMessage: '设置自动检查更新的时间,cron表达式', + label: '推送时间', + bottomHelpMessage: '设置自动检查更新推送的时间,cron表达式', component: 'Input', componentProps: { placeholder: '请输入cron表达式', }, }, + { + field: 'config.mysCode', + label: '过🐎', + bottomHelpMessage: + '设置米游社接口返回的错误码,遇到这些错误码会触发过🐎', + component: 'Select', + componentProps: { + mode: 'multiple', + options: [ + { label: '1034', value: 1034 }, + { label: '10035', value: 10035 }, + { label: '10102', value: 10102 }, + { label: '10041', value: 10041 }, + { label: '5003', value: 5003 }, + ], + }, + }, { component: 'Divider', label: '抽卡分析设置', @@ -212,7 +229,8 @@ export function supportGuoba() { }, { component: 'Divider', - label: '默认设备信息设置(通过"%设置默认设备"进行设置,如果不知道这是什么请勿修改)', + label: + '默认设备信息设置(通过"%设置默认设备"进行设置,如果不知道这是什么请勿修改)', }, { field: 'device.productName', diff --git a/lib/mysapi.js b/lib/mysapi.js index 1e9b05e..5d46255 100644 --- a/lib/mysapi.js +++ b/lib/mysapi.js @@ -5,6 +5,7 @@ import ZZZApiTool from './mysapi/tool.js'; import { randomString } from '../utils/data.js'; import MysApi from '../../genshin/model/mys/mysApi.js'; import { MysError } from './error.js'; +import settings from './settings.js'; // const DEVICE_ID = randomString(32).toUpperCase() // const DEVICE_NAME = randomString(_.random(1, 10)); @@ -263,7 +264,12 @@ export default class MysZZZApi extends MysApi { } res.retcode = Number(res.retcode); const code = String(res.retcode); - if (code === '1034' || code === '10035') { + const config = settings.getConfig('config') || {}; + const _configCode = _.get(config, 'mysCode', []); + const configCode = !Array.isArray(_configCode) + ? [String(_configCode)] + : _configCode.map(item => String(item)); + if (code === '1034' || code === '10035' || configCode.includes(code)) { // 如果有注册的mys.req.err,调用 if (!!this?.handler && this?.handler?.has('mys.req.err')) { logger.mark(