From 12e280b38c1ed563dc557c3c69f74cf28d02bfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8A=B1=E8=8A=B1=E8=8A=B1=E5=84=BF?= <860563585bxy@gmail.com> Date: Thu, 25 Jan 2024 00:56:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=B4=BD=E5=90=8D=E4=BB=8Epackage?= =?UTF-8?q?=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/model/base.js | 20 +++++++++++++++---- plugins/genshin/model/exportLog.js | 13 ++++++++++-- .../html/mysNews-list/mysNews-list.html | 2 +- .../StarRail/html/mysNews/mysNews.html | 2 +- .../resources/html/admin/userAdmin.html | 2 +- plugins/genshin/resources/html/deck/deck.html | 2 +- .../resources/html/deckCard/deckCard.html | 2 +- .../resources/html/deckList/deckList.html | 2 +- .../resources/html/layout/genshin.html | 2 +- .../html/mysNews-list/mysNews-list.html | 2 +- .../resources/html/mysNews/mysNews.html | 2 +- .../genshin/resources/html/payLog/payLog.html | 2 +- 12 files changed, 37 insertions(+), 16 deletions(-) diff --git a/plugins/genshin/model/base.js b/plugins/genshin/model/base.js index adfa651..ac398a5 100644 --- a/plugins/genshin/model/base.js +++ b/plugins/genshin/model/base.js @@ -1,22 +1,23 @@ import fs from 'node:fs' import _ from 'lodash' +import cfg from '../../../lib/config/config.js' import { Common, Version } from '#miao' import { Character } from '#miao.models' export default class base { - constructor (e = {}) { + constructor(e = {}) { this.e = e this.userId = e?.user_id this.model = 'genshin' this._path = process.cwd().replace(/\\/g, '/') } - get prefix () { + get prefix() { return `Yz:genshin:${this.model}:` } // 统一封装渲染 - async renderImg (tpl, data, cfg = {}) { + async renderImg(tpl, data, cfg = {}) { return Common.render('genshin', `html/${tpl}`, data, { ...cfg, e: this.e @@ -29,12 +30,23 @@ export default class base { * @param tplFile 模板html路径 * @param pluResPath 插件资源路径 */ - get screenData () { + get screenData() { const layoutPath = process.cwd() + '/plugins/genshin/resources/html/layout/' + let yunzaiName = cfg.package.name + if (yunzaiName == 'miao-yunzai') { + yunzaiName = 'Miao-Yunzai' + } else if (yunzaiName == 'yunzai') { + yunzaiName = 'Yunzai-Bot' + } else if (yunzaiName == 'trss-yunzai') { + yunzaiName = 'TRSS-Yunzai' + } else { + yunzaiName = _.capitalize(yunzaiName) + } let data = { saveId: this.userId, cwd: this._path, yzVersion: `v${Version.yunzai}`, + yzName: yunzaiName, genshinLayout: layoutPath + 'genshin.html', defaultLayout: layoutPath + 'default.html' } diff --git a/plugins/genshin/model/exportLog.js b/plugins/genshin/model/exportLog.js index db047d6..8f49534 100644 --- a/plugins/genshin/model/exportLog.js +++ b/plugins/genshin/model/exportLog.js @@ -63,14 +63,23 @@ export default class ExportLog extends base { if (!this.uid) return false let list = this.getAllList().list - + let yunzaiName = cfg.package.name + if (yunzaiName == 'miao-yunzai') { + yunzaiName = 'Miao-Yunzai' + } else if (yunzaiName == 'yunzai') { + yunzaiName = 'Yunzai-Bot' + } else if (yunzaiName == 'trss-yunzai') { + yunzaiName = 'TRSS-Yunzai' + } else { + yunzaiName = _.capitalize(yunzaiName) + } let data = { info: { uid: this.uid, lang: list[0].lang, export_time: moment().format('YYYY-MM-DD HH:mm:ss'), export_timestamp: moment().format('X'), - export_app: 'Miao-Yunzai', + export_app: yunzaiName, export_app_version: cfg.package.version, }, list diff --git a/plugins/genshin/resources/StarRail/html/mysNews-list/mysNews-list.html b/plugins/genshin/resources/StarRail/html/mysNews-list/mysNews-list.html index 03473b2..b041c1b 100644 --- a/plugins/genshin/resources/StarRail/html/mysNews-list/mysNews-list.html +++ b/plugins/genshin/resources/StarRail/html/mysNews-list/mysNews-list.html @@ -42,7 +42,7 @@