From 9ff5288458d9a4652dcbb067e9d0337b7e487ef9 Mon Sep 17 00:00:00 2001 From: ningmengchongshui <916415899@qq.com> Date: Sat, 15 Jun 2024 12:27:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9=E6=97=A7=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/setPubCk.ts | 3 +- apps/strategy.ts | 71 +++++++++++++++++++++------------------------- apps/user.ts | 2 -- apps/userAdmin.ts | 2 ++ deploy.sh | 10 ------- model/abyss.ts | 1 + model/base.ts | 4 +++ model/gachaData.ts | 7 ++++- model/gachaLog.ts | 3 ++ model/gsCfg.ts | 2 ++ model/note.ts | 4 +++ model/roleIndex.ts | 4 +++ model/user.ts | 4 +++ model/weapon.ts | 3 ++ 14 files changed, 68 insertions(+), 52 deletions(-) delete mode 100644 deploy.sh create mode 100644 model/gsCfg.ts diff --git a/apps/setPubCk.ts b/apps/setPubCk.ts index 45188e5..641f426 100644 --- a/apps/setPubCk.ts +++ b/apps/setPubCk.ts @@ -28,8 +28,9 @@ export class setPubCk extends plugin { ] }) - this.file = "./plugins/genshin/config/mys.pubCk.yaml" } + + file = "./plugins/genshin/config/mys.pubCk.yaml" /** 配置公共ck */ async setPubCk () { diff --git a/apps/strategy.ts b/apps/strategy.ts index 1438a57..f63d9eb 100644 --- a/apps/strategy.ts +++ b/apps/strategy.ts @@ -1,5 +1,5 @@ - import { plugin } from 'yunzai/core' -import { gsCfg} from 'yunzai/mys' +import { plugin } from 'yunzai/core' +import { gsCfg } from 'yunzai/mys' import lodash from 'lodash' import fs from 'node:fs' import fetch from 'node-fetch' @@ -15,7 +15,28 @@ gsCfg.cpCfg('mys', 'set') * 作者:曉K 更新:🌌 */ export class strategy extends plugin { - constructor () { + path = './temp/strategy' + url = 'https://bbs-api.mihoyo.com/post/wapi/getPostFullInCollection?&gids=2&order_type=2&collection_id=' + collection_id = [ + [], + // 来源:西风驿站 + [2319292, 2319293, 2319295, 2319296, 2319299, 2319294, 2319298], + // 来源:原神观测枢 + [813033], + // 来源:派蒙喵喵屋 + [341284], + // 来源:OH是姜姜呀(需特殊处理) + [341523], + // 来源:曉K → 废物一个 + [1582613], + // 来源:坤易 + [22148], + // 来源:婧枫赛赛 + [1812949] + ] + source = ['西风驿站', '原神观测枢', '派蒙喵喵屋', 'OH是姜姜呀', '曉K', '坤易', '婧枫赛赛'] + oss = '?x-oss-process=image//resize,s_1200/quality,q_90/auto-orient,0/interlace,1/format,jpg' + constructor() { /** * name: '米游社攻略', @@ -38,37 +59,11 @@ export class strategy extends plugin { } ] }) - this.set = gsCfg.getConfig('mys', 'set') - - this.path = './temp/strategy' - - this.url = 'https://bbs-api.mihoyo.com/post/wapi/getPostFullInCollection?&gids=2&order_type=2&collection_id=' - this.collection_id = [ - [], - // 来源:西风驿站 - [2319292, 2319293, 2319295, 2319296, 2319299, 2319294, 2319298], - // 来源:原神观测枢 - [813033], - // 来源:派蒙喵喵屋 - [341284], - // 来源:OH是姜姜呀(需特殊处理) - [341523], - // 来源:曉K → 废物一个 - [1582613], - // 来源:坤易 - [22148], - // 来源:婧枫赛赛 - [1812949] - ] - - this.source = ['西风驿站', '原神观测枢', '派蒙喵喵屋', 'OH是姜姜呀', '曉K', '坤易', '婧枫赛赛'] - - this.oss = '?x-oss-process=image//resize,s_1200/quality,q_90/auto-orient,0/interlace,1/format,jpg' } /** 初始化创建配置文件 */ - async init () { + async init() { if (!fs.existsSync(this.path)) { fs.mkdirSync(this.path) } @@ -82,7 +77,7 @@ export class strategy extends plugin { } /** #心海攻略 */ - async strategy () { + async strategy() { let match = /^#?(更新)?(\S+)攻略([1-7])?$/.exec(this.e.msg) // let isUpdate = !!this.e.msg.includes('更新') @@ -127,19 +122,19 @@ export class strategy extends plugin { } /** #攻略帮助 */ - async strategy_help () { + async strategy_help() { await this.e.reply('攻略帮助:\n#心海攻略[1234567]\n#更新早柚攻略[1234567]\n#设置默认攻略[1234567]\n示例: 心海攻略4\n\n攻略来源:\n1——西风驿站\n2——原神观测枢\n3——派蒙喵喵屋\n4——OH是姜姜呀\n5——曉K\n6——坤易\n7——婧枫赛赛(角色配队一图流)') } /** #设置默认攻略1 */ - async strategy_setting () { + async strategy_setting() { let match = /^#?设置默认攻略([1-7])?$/.exec(this.e.msg) let set = './plugins/genshin/config/mys.set.yaml' let config = fs.readFileSync(set, 'utf8') let num = Number(match[1]) - if(isNaN(num)) { - await this.e.reply('默认攻略设置方式为: \n#设置默认攻略[1234567] \n 请增加数字1-7其中一个') - return + if (isNaN(num)) { + await this.e.reply('默认攻略设置方式为: \n#设置默认攻略[1234567] \n 请增加数字1-7其中一个') + return } config = config.replace(/defaultSource: [1-7]/g, 'defaultSource: ' + num) fs.writeFileSync(set, config, 'utf8') @@ -148,7 +143,7 @@ export class strategy extends plugin { } /** 下载攻略图 */ - async getImg (name, group) { + async getImg(name, group) { let msyRes = [] this.collection_id[group].forEach((id) => msyRes.push(this.getData(this.url + id))) @@ -208,7 +203,7 @@ export class strategy extends plugin { } /** 获取数据 */ - async getData (url) { + async getData(url) { let response = await fetch(url, { method: 'get' }) if (!response.ok) { return false diff --git a/apps/user.ts b/apps/user.ts index a0a5d2f..ace8367 100644 --- a/apps/user.ts +++ b/apps/user.ts @@ -2,9 +2,7 @@ import { plugin } from 'yunzai/core' import { gsCfg} from 'yunzai/mys' import User from '../model/user.js' export class user extends plugin { - User = null - constructor(e) { /** * diff --git a/apps/userAdmin.ts b/apps/userAdmin.ts index 91b7381..d261739 100644 --- a/apps/userAdmin.ts +++ b/apps/userAdmin.ts @@ -2,6 +2,8 @@ import { plugin } from 'yunzai/core' import User from '../model/user.js' import { MysInfo } from 'yunzai/mys' export class userAdmin extends plugin { + User = null + button = null constructor(e) { /** name: '用户管理', diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index 7bf5f4c..0000000 --- a/deploy.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env sh - -# 确保脚本抛出遇到的错误 -set -e - -git init -git add -A -git commit -m 'update: 修复引用' - -git push -f git@github.com:yoimiya-kokomi/Miao-Yunzai.git master:genshin \ No newline at end of file diff --git a/model/abyss.ts b/model/abyss.ts index b7dad3b..54b0ab2 100644 --- a/model/abyss.ts +++ b/model/abyss.ts @@ -2,6 +2,7 @@ import moment from 'moment' import lodash from 'lodash' import base from './base.js' import { MysInfo } from 'yunzai/mys' +// tudo import { Character } from '#miao.models' export default class Abyss extends base { diff --git a/model/base.ts b/model/base.ts index e102e06..9e59d6e 100644 --- a/model/base.ts +++ b/model/base.ts @@ -1,5 +1,9 @@ import _ from 'lodash' import { ConfigController as cfg } from 'yunzai/config' + + +// tudo + import { Common, Version } from '#miao' import { Character } from '#miao.models' diff --git a/model/gachaData.ts b/model/gachaData.ts index b53c0a0..707e43a 100644 --- a/model/gachaData.ts +++ b/model/gachaData.ts @@ -1,7 +1,12 @@ import base from './base.js' import { gsCfg } from 'yunzai/mys' import lodash from 'lodash' -import moment from 'moment' +import moment from 'moment' + + +// tudo + + import { Character, Weapon } from '#miao.models' export default class GachaData extends base { diff --git a/model/gachaLog.ts b/model/gachaLog.ts index 4899f77..9fb4149 100644 --- a/model/gachaLog.ts +++ b/model/gachaLog.ts @@ -4,6 +4,9 @@ import lodash from "lodash" import fs from "node:fs" import { downFile, sleep} from 'yunzai/utils' import { gsCfg } from 'yunzai/mys' + +// tudo + import { Character, Weapon } from "#miao.models" export default class GachaLog extends base { diff --git a/model/gsCfg.ts b/model/gsCfg.ts new file mode 100644 index 0000000..1a08fa9 --- /dev/null +++ b/model/gsCfg.ts @@ -0,0 +1,2 @@ +import { GSCfg} from 'yunzai/mys' +export default GSCfg \ No newline at end of file diff --git a/model/note.ts b/model/note.ts index 6f48157..6f6da24 100644 --- a/model/note.ts +++ b/model/note.ts @@ -3,6 +3,10 @@ import lodash from 'lodash' import base from './base.js' import { MysInfo, } from 'yunzai/mys' + + +// tudo + import { Character } from '#miao.models' export default class Note extends base { diff --git a/model/roleIndex.ts b/model/roleIndex.ts index fbb3c61..80f1744 100644 --- a/model/roleIndex.ts +++ b/model/roleIndex.ts @@ -3,6 +3,10 @@ import { gsCfg } from 'yunzai/mys' import lodash from 'lodash' import moment from 'moment' import fs from 'node:fs' + + +// tudo + import { Character } from '#miao.models' let dsz = '待实装' diff --git a/model/user.ts b/model/user.ts index d33ccd3..cca4d56 100644 --- a/model/user.ts +++ b/model/user.ts @@ -6,6 +6,10 @@ import { gsCfg, MysUser, NoteUser } from 'yunzai/mys' import { promisify } from 'node:util' import YAML from 'yaml' import { UserGameDB, sequelize } from 'yunzai/db' + + +// tudo + import { Data } from '#miao' import { Player } from '#miao.models' diff --git a/model/weapon.ts b/model/weapon.ts index 1cb6e34..18d4866 100644 --- a/model/weapon.ts +++ b/model/weapon.ts @@ -2,6 +2,9 @@ import base from './base.js' import { MysInfo } from 'yunzai/mys' import {gsCfg} from 'yunzai/mys' import lodash from 'lodash' + +// tudo + import { Weapon, Character } from '#miao.models' export default class WeaponModel extends base {