diff --git a/plugins/genshin/apps/user.js b/plugins/genshin/apps/user.js index 279990f..9ca972b 100644 --- a/plugins/genshin/apps/user.js +++ b/plugins/genshin/apps/user.js @@ -42,7 +42,7 @@ export class user extends plugin { fnc: 'delUid' }, { - reg: '^#(原神|星铁)?绑定(uid|UID)?\\s*([1-9]|18)[0-9]{8}$', + reg: '^#(原神|星铁)?绑定(uid|UID)?(\\s|\\+)*([1-9]|18)[0-9]{8}$', fnc: 'bingUid' }, { diff --git a/plugins/genshin/model/gachaLog.js b/plugins/genshin/model/gachaLog.js index e1a3049..3aed501 100644 --- a/plugins/genshin/model/gachaLog.js +++ b/plugins/genshin/model/gachaLog.js @@ -4,8 +4,7 @@ import lodash from "lodash" import fs from "node:fs" import common from "../../../lib/common/common.js" import gsCfg from "./gsCfg.js" -import GachaData from "./gachaData.js" -import { Character, Weapon } from "../../miao-plugin/models/index.js" +import { Character, Weapon } from "#miao.models" export default class GachaLog extends base { constructor(e) { @@ -45,7 +44,7 @@ export default class GachaLog extends base { } else if (type === "weapon" || type === "武器" || type === "光锥") { let weapon = Weapon.get(name, game) if (!weapon) { - console.log("not-found-weapon",`[${name}]`, game) + console.log("not-found-weapon", `[${name}]`, game) } return weapon?.imgs?.icon || "" } @@ -134,8 +133,7 @@ export default class GachaLog extends base { let url = txt.match(/auth_appid=webview_gacha(.*)hk4e_cn/) /** 删除文件 */ - fs.unlink(textPath, () => { - }) + fs.unlink(textPath, () => { }) if (!url || !url[0]) { return false @@ -270,7 +268,7 @@ export default class GachaLog extends base { return false } - logger.mark(`${this.e.logFnc}[uid:${this.uid}] 开始获取:${this.typeName}记录...`) + logger.mark(`${this.e.logFnc}[UID:${this.uid}] 开始获取:${this.typeName}记录...`) let all = [] let logJson = this.readJson() @@ -316,14 +314,14 @@ export default class GachaLog extends base { } if (!res?.data?.list || res.data.list.length <= 0) { - logger.mark(`${this.e.logFnc}[uid:${this.uid}] 获取${this.typeName}记录完成,共${Number(page) - 1}页`) + logger.mark(`${this.e.logFnc}[UID:${this.uid}] 获取${this.typeName}记录完成,共${Number(page) - 1}页`) return { hasErr: false, list: [] } } let list = [] for (let val of res.data.list) { if (ids.get(String(val.id))) { - logger.mark(`${this.e.logFnc}[uid:${this.uid}] 获取${this.typeName}记录完成,暂无新记录`) + logger.mark(`${this.e.logFnc}[UID:${this.uid}] 获取${this.typeName}记录完成,暂无新记录`) return { hasErr: false, list } } else { list.push(val) @@ -634,9 +632,7 @@ export default class GachaLog extends base { num: fourLog[i] }) } - four = four.sort((a, b) => { - return b.num - a.num - }) + four = four.sort((a, b) => { return b.num - a.num }) if (four.length <= 0) { four.push({ name: "无", num: 0 }) @@ -645,23 +641,23 @@ export default class GachaLog extends base { let fiveAvg = 0 let fourAvg = 0 if (fiveNum > 0) { - fiveAvg = ((allNum - noFiveNum) / fiveNum).toFixed(2) + fiveAvg = Math.round((allNum - noFiveNum) / fiveNum); } if (fourNum > 0) { - fourAvg = ((allNum - noFourNum) / fourNum).toFixed(2) + fourAvg = Math.round((allNum - noFourNum) / fourNum); } // 有效抽卡 let isvalidNum = 0 if (fiveNum > 0 && fiveNum > wai) { if (fiveLog.length > 0 && !fiveLog[0].isUp) { - isvalidNum = (allNum - noFiveNum - fiveLog[0].num) / (fiveNum - wai) + isvalidNum = Math.round((allNum - noFiveNum - fiveLog[0].num) / (fiveNum - wai)); } else { - isvalidNum = (allNum - noFiveNum) / (fiveNum - wai) + isvalidNum = Math.round((allNum - noFiveNum) / (fiveNum - wai)); } - isvalidNum = isvalidNum.toFixed(2) } + let upYs = isvalidNum * 160 if (upYs >= 10000) { upYs = (upYs / 10000).toFixed(2) + "w" @@ -738,17 +734,42 @@ export default class GachaLog extends base { const max = type === 12 || type === 302 ? 80 : 90 let line = [] let weapon = this.e.isSr ? "光锥" : "武器" + //最非,最欧 + let maxValue, minValue; + + if (data && data.fiveLog) { + const filteredFiveLog = data.fiveLog.filter(item => item.num !== 0); + + if (filteredFiveLog.length > 0) { + maxValue = Math.max(...filteredFiveLog.map(item => item.num)); + minValue = Math.min(...filteredFiveLog.map(item => item.num)); + } else { + if (data.fiveLog[0]) { + maxValue = data.fiveLog[0]; + minValue = data.fiveLog[0]; + } else { + maxValue = 0; + minValue = 0; + } + } + } else { + maxValue = 0; + minValue = 0; + } + if ([301, 11].includes(type)) { line = [[ { lable: "未出五星", num: data.noFiveNum, unit: "抽" }, { lable: "五星", num: data.fiveNum, unit: "个" }, { lable: "五星平均", num: data.fiveAvg, unit: "抽", color: data.fiveColor }, - { lable: "小保底不歪", num: data.noWaiRate + "%", unit: "" } + { lable: "小保底不歪", num: data.noWaiRate + "%", unit: "" }, + { lable: "最非", num: maxValue, unit: "抽" } ], [ { lable: "未出四星", num: data.noFourNum, unit: "抽" }, { lable: "五星常驻", num: data.wai, unit: "个" }, { lable: "UP平均", num: data.isvalidNum, unit: "抽" }, - { lable: `UP花费${this?.e?.isSr ? "星琼" : "原石"}`, num: data.upYs, unit: "" } + { lable: `UP花费${this?.e?.isSr ? "星琼" : "原石"}`, num: data.upYs, unit: "" }, + { lable: "最欧", num: minValue, unit: "抽" } ]] } // 常驻池 @@ -757,12 +778,14 @@ export default class GachaLog extends base { { lable: "未出五星", num: data.noFiveNum, unit: "抽" }, { lable: "五星", num: data.fiveNum, unit: "个" }, { lable: "五星平均", num: data.fiveAvg, unit: "抽", color: data.fiveColor }, - { lable: `五星${weapon}`, num: data.weaponNum, unit: "个" } + { lable: `五星${weapon}`, num: data.weaponNum, unit: "个" }, + { lable: "最非", num: maxValue, unit: "抽" } ], [ { lable: "未出四星", num: data.noFourNum, unit: "抽" }, { lable: "四星", num: data.fourNum, unit: "个" }, { lable: "四星平均", num: data.fourAvg, unit: "抽" }, - { lable: "四星最多", num: data.maxFour.num, unit: data.maxFour.name } + { lable: "四星最多", num: data.maxFour.num, unit: data.maxFour.name.slice(0, 4) }, + { lable: "最欧", num: minValue, unit: "抽" } ]] } // 武器池 @@ -771,12 +794,14 @@ export default class GachaLog extends base { { lable: "未出五星", num: data.noFiveNum, unit: "抽" }, { lable: "五星", num: data.fiveNum, unit: "个" }, { lable: "五星平均", num: data.fiveAvg, unit: "抽", color: data.fiveColor }, - { lable: `四星${weapon}`, num: data.weaponFourNum, unit: "个" } + { lable: `四星${weapon}`, num: data.weaponFourNum, unit: "个" }, + { lable: "最非", num: maxValue, unit: "抽" } ], [ { lable: "未出四星", num: data.noFourNum, unit: "抽" }, { lable: "四星", num: data.fourNum, unit: "个" }, { lable: "四星平均", num: data.fourAvg, unit: "抽" }, - { lable: "四星最多", num: data.maxFour.num, unit: data.maxFour.name } + { lable: "四星最多", num: data.maxFour.num, unit: data.maxFour.name.slice(0, 4) }, + { lable: "最欧", num: minValue, unit: "抽" } ]] } // 新手池 @@ -785,12 +810,14 @@ export default class GachaLog extends base { { lable: "未出五星", num: data.noFiveNum, unit: "抽" }, { lable: "五星", num: data.fiveNum, unit: "个" }, { lable: "五星平均", num: data.fiveAvg, unit: "抽", color: data.fiveColor }, - { lable: `五星${weapon}`, num: data.weaponNum, unit: "个" } + { lable: `五星${weapon}`, num: data.weaponNum, unit: "个" }, + { lable: "最非", num: maxValue, unit: "抽" } ], [ { lable: "未出四星", num: data.noFourNum, unit: "抽" }, { lable: "四星", num: data.fourNum, unit: "个" }, { lable: "四星平均", num: data.fourAvg, unit: "抽" }, - { lable: "四星最多", num: data.maxFour.num, unit: data.maxFour.name } + { lable: "四星最多", num: data.maxFour.num, unit: data.maxFour.name.slice(0, 4) }, + { lable: "最欧", num: minValue, unit: "抽" } ]] } let hasMore = false diff --git a/plugins/genshin/model/mys/mysInfo.js b/plugins/genshin/model/mys/mysInfo.js index 5c18259..66b7fc2 100644 --- a/plugins/genshin/model/mys/mysInfo.js +++ b/plugins/genshin/model/mys/mysInfo.js @@ -355,7 +355,7 @@ export default class MysInfo { async checkCode(res, type, mysApi = {}, data = {}, isTask = false) { if (!res) { - if (!isTask) this.e.reply(['米游社接口请求失败,暂时无法查询', this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},米游社接口请求失败,暂时无法查询`, this.mysButton]) return false } @@ -380,27 +380,27 @@ export default class MysInfo { if (!isTask) this.e.reply([`UID:${this.ckInfo.uid},米游社Cookie已失效`, this.mysButton]) } else { logger.mark(`[公共ck失效][ltuid:${this.ckInfo.ltuid}]`) - if (!isTask) this.e.reply(['米游社查询失败,请稍后再试', this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},米游社查询失败,请稍后再试`, this.mysButton]) } if (!isTask) await this.delCk() } else { - if (!isTask) this.e.reply([`米游社接口报错,暂时无法查询:${res.message}`, this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},米游社接口报错,暂时无法查询:${res.message}`, this.mysButton]) } break case 1008: - if (!isTask) this.e.reply(['请先去米游社绑定角色', this.mysButton], false, { at: this.userId }) + if (!isTask) this.e.reply([`UID:${this.uid},请先去米游社绑定角色`, this.mysButton], false, { at: this.userId }) break case 10101: if (!isTask) { await this.disableToday() - this.e.reply(['查询已达今日上限', this.mysButton]) + this.e.reply([`UID:${this.uid},查询已达今日上限`, this.mysButton]) } break case 10102: if (res.message === 'Data is not public for the user') { if (!isTask) this.e.reply([`\nUID:${this.uid},米游社数据未公开`, this.mysButton], false, { at: this.userId }) } else { - if (!isTask) this.e.reply([`uid:${this.uid},请先去米游社绑定角色`, this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},请先去米游社绑定角色`, this.mysButton]) } break // 伙伴不存在~ @@ -408,7 +408,7 @@ export default class MysInfo { if (res.api === 'detail') res.retcode = 0 break case 5003: - if (!isTask) this.e.reply(['米游社账号异常,暂时无法查询', this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},米游社账号异常,暂时无法查询`, this.mysButton]) break case 1034: let handler = this.e.runtime?.handler || {} @@ -421,14 +421,14 @@ export default class MysInfo { if (!res || res?.retcode == 1034) { logger.mark(`[米游社查询失败][uid:${this.uid}][qq:${this.userId}] 遇到验证码`) - if (!isTask) this.e.reply(['米游社查询遇到验证码,请稍后再试', this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},米游社查询遇到验证码,请稍后再试`, this.mysButton]) } break case 10307: - if (!isTask) this.e.reply(['版本更新期间,数据维护中', this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},版本更新期间,数据维护中`, this.mysButton]) break default: - if (!isTask) this.e.reply([`米游社接口报错,暂时无法查询:${res.message || 'error'}`, this.mysButton]) + if (!isTask) this.e.reply([`UID:${this.uid},米游社接口报错,暂时无法查询:${res.message || 'error'}`, this.mysButton]) break } if (res.retcode !== 0) { diff --git a/plugins/genshin/resources/html/gacha/gacha-log.css b/plugins/genshin/resources/html/gacha/gacha-log.css index 4b8c754..441c409 100644 --- a/plugins/genshin/resources/html/gacha/gacha-log.css +++ b/plugins/genshin/resources/html/gacha/gacha-log.css @@ -76,7 +76,7 @@ body { border-radius: 15px; margin-top: 20px; margin-bottom: 20px; - padding: 20px 0px 5px 5px; + padding: 20px 0px 5px 10px; background: #fff; box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.15); position: relative; @@ -88,6 +88,7 @@ body { background: #d4b98c; color: #fff; font-size: 14px; + font-family: "HYWenHei-55W"; padding: 3px 10px; border-radius: 15px 0px 15px 15px; z-index: 20; @@ -130,7 +131,7 @@ body { /* margin-top: 20px; */ margin-bottom: 20px; padding: 6px 0px 5px 10px; - background: #fff; + /* background: #fff; */ box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.15); position: relative; } @@ -146,12 +147,11 @@ body { height: 90px; position: relative; overflow: hidden; - background: #e7e5d9; + /* background: #e7e5d9; */ } .item .role_img { width: 70px; height: 70px; - border-radius: 7px 7px 20px 0; display: inline-block; background-size: auto 100%; background-repeat: no-repeat; @@ -159,7 +159,6 @@ body { } .card_list .item.star5 { background-image: url(../../img/other/bg5.png); - /*filter: brightness(1.1);*/ background-size: 100%; background-repeat: no-repeat; } @@ -184,13 +183,13 @@ body { .card_list .item .name, .card_list .item .num_name { position: absolute; - top: 71px; + top: 70.4px; left: 0px; z-index: 9; font-size: 12px; text-align: center; width: 100%; - height: 18px; + height: 30px; line-height: 18px; } .card_list .item .num_name { @@ -210,7 +209,7 @@ body { border-radius: 1px; left: 0; top: 0; - background: #d3bc8d; + background: #bca87e; } .label_301 { background-color: #eb6a4b; @@ -277,7 +276,8 @@ body { display: flex; justify-content: space-between; align-items: center; - font-size: 12px; + font-size: 15px; + font-family: "HYWenHei-55W"; color: #7d7d7d; padding-bottom: 5px; }