config: 自定义过🐎🐎

This commit is contained in:
bietiaop 2024-08-24 15:57:17 +08:00
parent 1471e6346f
commit d082c87809
3 changed files with 34 additions and 6 deletions

View file

@ -5,5 +5,9 @@ query:
update: update:
autoCheck: true # 自动检查更新 autoCheck: true # 自动检查更新
cron: 0 0/10 * * * ? # 更新检查时间 cron: 0 0/10 * * * ? # 更新检查时间
# 需要调用过🐎的接口code
mysCode:
- 1034
- 10035
# 自定义绑定设备下载url # 自定义绑定设备下载url
url: https://ghproxy.mihomo.me/https://raw.githubusercontent.com/forchannot/get_device_info/main/app/build/outputs/apk/debug/app-debug.apk url: https://ghproxy.mihomo.me/https://raw.githubusercontent.com/forchannot/get_device_info/main/app/build/outputs/apk/debug/app-debug.apk

View file

@ -61,19 +61,36 @@ export function supportGuoba() {
}, },
{ {
field: 'config.update.autoCheck', field: 'config.update.autoCheck',
label: '自动检查更新', label: '更新推送',
bottomHelpMessage: '是否开启自动检查更新(仅检查,不更新)', bottomHelpMessage: '是否开启自动检查更新推送(仅检查,不更新)',
component: 'Switch', component: 'Switch',
}, },
{ {
field: 'config.update.cron', field: 'config.update.cron',
label: '自动检查更新时间', label: '推送时间',
bottomHelpMessage: '设置自动检查更新的时间cron表达式', bottomHelpMessage: '设置自动检查更新推送的时间cron表达式',
component: 'Input', component: 'Input',
componentProps: { componentProps: {
placeholder: '请输入cron表达式', 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', component: 'Divider',
label: '抽卡分析设置', label: '抽卡分析设置',
@ -212,7 +229,8 @@ export function supportGuoba() {
}, },
{ {
component: 'Divider', component: 'Divider',
label: '默认设备信息设置(通过"%设置默认设备"进行设置,如果不知道这是什么请勿修改)', label:
'默认设备信息设置(通过"%设置默认设备"进行设置,如果不知道这是什么请勿修改)',
}, },
{ {
field: 'device.productName', field: 'device.productName',

View file

@ -5,6 +5,7 @@ import ZZZApiTool from './mysapi/tool.js';
import { randomString } from '../utils/data.js'; import { randomString } from '../utils/data.js';
import MysApi from '../../genshin/model/mys/mysApi.js'; import MysApi from '../../genshin/model/mys/mysApi.js';
import { MysError } from './error.js'; import { MysError } from './error.js';
import settings from './settings.js';
// const DEVICE_ID = randomString(32).toUpperCase() // const DEVICE_ID = randomString(32).toUpperCase()
// const DEVICE_NAME = randomString(_.random(1, 10)); // const DEVICE_NAME = randomString(_.random(1, 10));
@ -263,7 +264,12 @@ export default class MysZZZApi extends MysApi {
} }
res.retcode = Number(res.retcode); res.retcode = Number(res.retcode);
const code = String(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调用 // 如果有注册的mys.req.err调用
if (!!this?.handler && this?.handler?.has('mys.req.err')) { if (!!this?.handler && this?.handler?.has('mys.req.err')) {
logger.mark( logger.mark(