From fdddbe9c398af8a68d19f2cc6062fcd319a5837a Mon Sep 17 00:00:00 2001 From: ctrlcvs <1509167646@qq.com> Date: Sun, 15 Jan 2023 22:10:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=93=AA=E9=87=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97=E8=AF=86=E5=88=AB=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=EF=BC=9A#=E5=B1=82=E5=B2=A9=E6=99=AE=E9=80=9A=E5=AE=9D?= =?UTF-8?q?=E7=AE=B1=E5=9C=A8=E5=93=AA=E9=87=8C=20(#45)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/map.js | 18 ++++++++++++++++-- model/mhyTopUpLogin.js | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/map.js b/apps/map.js index b24b0d4..7feb426 100644 --- a/apps/map.js +++ b/apps/map.js @@ -9,7 +9,11 @@ import { segment } from "oicq"; let path = './data/map' - +//mapId-地图别名 +let getPath={ + "&map_id=7":["渊下宫",'渊下'], + "&map_id=9":['璃月地下','层岩地下','层岩'] +} export async function genShenMap(e){ let msg= e.msg.replace(/#|(哪|那)|里|在/g,"") var urlFile = fs.readdirSync(`./data/map/`); @@ -18,7 +22,8 @@ export async function genShenMap(e){ await e.reply(segment.image(`file://${msgPath}`)) return true; } - let url=`https://map.minigg.cn/map/get_map?resource_name=${msg}&is_cluster=false` + let data=await exReg(msg); + let url=`https://map.minigg.cn/map/get_map?resource_name=${data.msg}&is_cluster=false${data.item}` let res=await fetch(url,{method:'get'}) try{ res=await res.json() @@ -33,6 +38,15 @@ export async function genShenMap(e){ } return false; } +async function exReg(msg){ + for (const item of Object.keys(getPath)) { + let reg =new RegExp(`${getPath[item].join('|')}`,'g') + if(reg.test(msg)){ + return {item,msg:msg.replace(reg,'')} + } + } + return {item:'',msg} +} init() /** 初始化创建配置文件 */ function init () { diff --git a/model/mhyTopUpLogin.js b/model/mhyTopUpLogin.js index 4b0620e..b67094f 100644 --- a/model/mhyTopUpLogin.js +++ b/model/mhyTopUpLogin.js @@ -58,8 +58,8 @@ export default class mysTopLogin { let UserData = await this.user.getData("getTokenByGameToken", raw) let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw) return { - cookie: `ltoken=${UserData.data.token.token};ltuid=${UserData.data.user_info.aid};cookie_token=${ck.data.cookie_token}`, - stoken: `stoken=${UserData.data.token.token};stuid=${UserData.data.user_info.aid};mid=${UserData.data.user_info.mid}` + cookie: `ltoken=${UserData.data?.token?.token};ltuid=${UserData.data?.user_info?.aid};cookie_token=${ck.data?.cookie_token}`, + stoken: `stoken=${UserData.data?.token?.token};stuid=${UserData.data?.user_info?.aid};mid=${UserData?.data?.user_info.mid}` } }