diff --git a/game-server/app/servers/gm/filter/tokenFilter.ts b/game-server/app/servers/gm/filter/tokenFilter.ts index 4161f7c94..4b86f6d10 100644 --- a/game-server/app/servers/gm/filter/tokenFilter.ts +++ b/game-server/app/servers/gm/filter/tokenFilter.ts @@ -45,7 +45,7 @@ Filter.prototype.after = function (err: Error, routeRecord: RouteRecord, msg: an let dicApi = gameData.apiByUrl.get(route); if(dicApi.type != GM_API_TYPE.find) { - GMRecordModel.createRecord(uid, route, JSON.stringify(msg||{}), JSON.stringify(resp||{})); + GMRecordModel.createRecord(uid, this.app.get('env'), route, JSON.stringify(msg||{}), JSON.stringify(resp||{})); } next(err); }; \ No newline at end of file diff --git a/gm-server/app/middleware/tokenParser.ts b/gm-server/app/middleware/tokenParser.ts index f70fe4c61..e556364e0 100644 --- a/gm-server/app/middleware/tokenParser.ts +++ b/gm-server/app/middleware/tokenParser.ts @@ -45,7 +45,7 @@ module.exports = () => { ctx.user = user; await next(); if(dicApi.type != GM_API_TYPE.find) { - GMRecordModel.createRecord(user?user.uid:0, ctx.request.url, JSON.stringify(ctx.request.body||{}), JSON.stringify(ctx.body||{})); + GMRecordModel.createRecord(user?user.uid:0, ctx.app.config.realEnv, ctx.request.url, JSON.stringify(ctx.request.body||{}), JSON.stringify(ctx.body||{})); } }; }; diff --git a/shared/db/GMRecord.ts b/shared/db/GMRecord.ts index 39e0cd9d6..3018943f6 100644 --- a/shared/db/GMRecord.ts +++ b/shared/db/GMRecord.ts @@ -1,5 +1,6 @@ import BaseModel from './BaseModel'; import { index, getModelForClass, prop, DocumentType, ReturnModelType, mongoose } from '@typegoose/typegoose'; +import { gameData } from '../pubUtils/data'; /** * GM用户组接口 @@ -12,17 +13,24 @@ export default class GMRecord extends BaseModel { @prop({ required: true }) uid: number; + @prop({ required: true }) + env: string; + @prop({ required: true }) api: string; + @prop({ required: true }) + apiName: string; + @prop({ required: true }) body: string; @prop({ required: true }) result: string; - public static async createRecord(uid: number, api: string, body: string, result: string) { - const r = await GMRecordModel.insertMany({uid, api, body, result}); + public static async createRecord(uid: number, env: string, api: string, body: string, result: string) { + let dicApi = gameData.apiByUrl.get(api); + const r = await GMRecordModel.insertMany({uid, env, api, apiName: dicApi?.name, body, result}); return r; } diff --git a/shared/resource/jsons/dic_api.json b/shared/resource/jsons/dic_api.json index 469f176a0..bcc551482 100644 --- a/shared/resource/jsons/dic_api.json +++ b/shared/resource/jsons/dic_api.json @@ -22,445 +22,445 @@ }, { "id": 4, - "api": "/api/upload/hotupdate", - "name": "上传热更新", - "module": "upload", - "type": "update" - }, - { - "id": 5, - "api": "/api/upload/uploadjson", - "name": "上传json", - "module": "upload", - "type": "update" - }, - { - "id": 6, - "api": "/api/upload/reloadresource", - "name": "加载资源", - "module": "upload", - "type": "update" - }, - { - "id": 7, - "api": "/api/gmaccount/getgmlist", - "name": "获取gm账号列表", - "module": "gmaccount", - "type": "find" - }, - { - "id": 8, - "api": "/api/gmaccount/createaccount", - "name": "创建gm账号", - "module": "gmaccount", - "type": "add" - }, - { - "id": 9, - "api": "/api/gmaccount/savegmgrouptouser", - "name": "将账号组保存至账号", - "module": "gmaccount", - "type": "update" - }, - { - "id": 10, - "api": "/api/gmaccount/getgrouplist", - "name": "获取账号组列表", - "module": "gmaccount", - "type": "find" - }, - { - "id": 11, - "api": "/api/gmaccount/getapilist", - "name": "获取api列表", - "module": "gmaccount", - "type": "find" - }, - { - "id": 12, - "api": "/api/gmaccount/creategmgroup", - "name": "创建账号组", - "module": "gmaccount", - "type": "add" - }, - { - "id": 13, - "api": "/api/gmaccount/savegmgroup", - "name": "保存账号组", - "module": "gmaccount", - "type": "update" - }, - { - "id": 14, - "api": "/api/gmaccount/saveapitogroup", - "name": "将api保存至账号组", - "module": "gmaccount", - "type": "update" - }, - { - "id": 15, - "api": "/api/users/getuserlist", - "name": "获取玩家账号列表", - "module": "user", - "type": "find" - }, - { - "id": 16, - "api": "/api/users/fixsms", - "name": "固定玩家短信", - "module": "user", - "type": "update" - }, - { - "id": 17, - "api": "/api/users/getrolelist", - "name": "获取玩家角色列表", - "module": "user", - "type": "find" - }, - { - "id": 18, - "api": "/api/users/deleterole", - "name": "删除角色", - "module": "user", - "type": "delete" - }, - { - "id": 19, - "api": "/api/users/setwar", - "name": "设置关卡", - "module": "user", - "type": "update" - }, - { - "id": 20, - "api": "/api/users/getherolist", - "name": "获取玩家武将列表", - "module": "user", - "type": "find" - }, - { - "id": 21, - "api": "/api/users/deletehero", - "name": "删除武将", - "module": "user", - "type": "delete" - }, - { - "id": 22, - "api": "/api/users/getequiplist", - "name": "获取玩家装备列表", - "module": "user", - "type": "find" - }, - { - "id": 23, - "api": "/api/users/getitemlist", - "name": "获取玩家道具列表", - "module": "user", - "type": "find" - }, - { - "id": 24, - "api": "/api/users/getguildlist", - "name": "获取军团列表", - "module": "user", - "type": "find" - }, - { - "id": 25, - "api": "/api/users/getmembersbyguildcode", - "name": "获取军团成员列表", - "module": "user", - "type": "find" - }, - { - "id": 26, - "api": "/api/users/deleteequip", - "name": "删除装备", - "module": "user", - "type": "delete" - }, - { - "id": 27, - "api": "/api/users/deleteitem", - "name": "删除道具", - "module": "user", - "type": "delete" - }, - { - "id": 28, - "api": "/api/users/createandgenerategift", - "name": "创建并生成礼包码", - "module": "giftcode", - "type": "add" - }, - { - "id": 29, - "api": "/api/users/updategiftcode", - "name": "更新礼包码", - "module": "giftcode", - "type": "update" - }, - { - "id": 30, - "api": "/api/users/generategiftcode", - "name": "追加礼包码", - "module": "giftcode", - "type": "update" - }, - { - "id": 31, - "api": "/api/users/cancelgiftCode", - "name": "取消礼包码", - "module": "giftcode", - "type": "delete" - }, - { - "id": 32, - "api": "/api/users/getgiftcodedetaillist", - "name": "获取礼包码列表", - "module": "giftcode", - "type": "find" - }, - { - "id": 33, - "api": "/api/game/getregions", - "name": "获取所有大区", - "module": "server", - "type": "find" - }, - { - "id": 34, - "api": "/api/game/getservers", - "name": "获取所有小区", - "module": "server", - "type": "find" - }, - { - "id": 35, - "api": "/api/game/getregionstategy", - "name": "获取大区策略", - "module": "server", - "type": "find" - }, - { - "id": 36, - "api": "/api/game/getwhitelist", - "name": "获取白名单", - "module": "server", - "type": "find" - }, - { - "id": 37, - "api": "/api/game/updatewhitelist", - "name": "更新白名单", - "module": "server", - "type": "update" - }, - { - "id": 38, - "api": "/api/game/deletewhitelist", - "name": "删除白名单", - "module": "server", - "type": "delete" - }, - { - "id": 39, - "api": "/api/game/stopserverregister", - "name": "小区停止注册", - "module": "server", - "type": "update" - }, - { - "id": 40, - "api": "/api/game/swicthserverstatus", - "name": "切换服务器状态", - "module": "server", - "type": "update" - }, - { - "id": 41, "api": "/api/dic/getdicgoods", "name": "获取物品字典表", "module": "base", "type": "find" }, { - "id": 42, + "id": 5, "api": "/api/dic/getdichero", "name": "获取武将字典表", "module": "base", "type": "find" }, { - "id": 43, + "id": 6, "api": "/api/dic/getdicrmb", "name": "获取商品字典表", "module": "base", "type": "find" }, { - "id": 44, + "id": 7, "api": "/api/dic/getdicactivitytype", "name": "获取活动类型字典表", "module": "base", "type": "find" }, { - "id": 45, + "id": 8, "api": "/api/dic/getdictasktype", "name": "获取任务类型字典表", "module": "base", "type": "find" }, { - "id": 46, + "id": 9, "api": "/api/dic/getservername", "name": "获取服务器名称字典表", "module": "base", "type": "find" }, { - "id": 47, + "id": 10, + "api": "/api/gmaccount/getgmlist", + "name": "获取gm账号列表", + "module": "gmaccount", + "type": "find" + }, + { + "id": 11, + "api": "/api/gmaccount/createaccount", + "name": "创建gm账号", + "module": "gmaccount", + "type": "add" + }, + { + "id": 12, + "api": "/api/gmaccount/savegmgrouptouser", + "name": "将账号组保存至账号", + "module": "gmaccount", + "type": "update" + }, + { + "id": 13, + "api": "/api/gmaccount/getgrouplist", + "name": "获取账号组列表", + "module": "gmaccount", + "type": "find" + }, + { + "id": 14, + "api": "/api/gmaccount/getapilist", + "name": "获取api列表", + "module": "gmaccount", + "type": "find" + }, + { + "id": 15, + "api": "/api/gmaccount/creategmgroup", + "name": "创建账号组", + "module": "gmaccount", + "type": "add" + }, + { + "id": 16, + "api": "/api/gmaccount/savegmgroup", + "name": "保存账号组", + "module": "gmaccount", + "type": "update" + }, + { + "id": 17, + "api": "/api/gmaccount/saveapitogroup", + "name": "将api保存至账号组", + "module": "gmaccount", + "type": "update" + }, + { + "id": 18, + "api": "/api/users/getuserlist", + "name": "获取玩家账号列表", + "module": "user", + "type": "find" + }, + { + "id": 19, + "api": "/api/users/fixsms", + "name": "固定玩家短信", + "module": "user", + "type": "update" + }, + { + "id": 20, + "api": "/api/users/getrolelist", + "name": "获取玩家角色列表", + "module": "user", + "type": "find" + }, + { + "id": 21, + "api": "/api/users/deleterole", + "name": "删除角色", + "module": "user", + "type": "delete" + }, + { + "id": 22, + "api": "/api/users/setwar", + "name": "设置关卡", + "module": "user", + "type": "update" + }, + { + "id": 23, + "api": "/api/users/getherolist", + "name": "获取玩家武将列表", + "module": "user", + "type": "find" + }, + { + "id": 24, + "api": "/api/users/deletehero", + "name": "删除武将", + "module": "user", + "type": "delete" + }, + { + "id": 25, + "api": "/api/users/getequiplist", + "name": "获取玩家装备列表", + "module": "user", + "type": "find" + }, + { + "id": 26, + "api": "/api/users/getitemlist", + "name": "获取玩家道具列表", + "module": "user", + "type": "find" + }, + { + "id": 27, + "api": "/api/users/deleteequip", + "name": "删除装备", + "module": "user", + "type": "delete" + }, + { + "id": 28, + "api": "/api/users/deleteitem", + "name": "删除道具", + "module": "user", + "type": "delete" + }, + { + "id": 29, + "api": "gm.gmRoleHandler.addItems", + "name": "增加道具", + "module": "user", + "type": "update" + }, + { + "id": 30, + "api": "gm.gmRoleHandler.handleBlock", + "name": "封禁", + "module": "user", + "type": "update" + }, + { + "id": 31, + "api": "/api/users/getguildlist", + "name": "获取军团列表", + "module": "guild", + "type": "find" + }, + { + "id": 32, + "api": "/api/users/getmembersbyguildcode", + "name": "获取军团成员列表", + "module": "guild", + "type": "find" + }, + { + "id": 33, + "api": "gm.gmRoleHandler.updateGuild", + "name": "更新军团", + "module": "guild", + "type": "update" + }, + { + "id": 34, + "api": "gm.gmRoleHandler.dismissGuild", + "name": "解散军团", + "module": "guild", + "type": "update" + }, + { + "id": 35, + "api": "gm.gmRoleHandler.setGuildLeader", + "name": "设置军团长", + "module": "guild", + "type": "update" + }, + { + "id": 36, + "api": "/api/users/createandgenerategift", + "name": "创建并生成礼包码", + "module": "giftcode", + "type": "add" + }, + { + "id": 37, + "api": "/api/users/updategiftcode", + "name": "更新礼包码", + "module": "giftcode", + "type": "update" + }, + { + "id": 38, + "api": "/api/users/generategiftcode", + "name": "追加礼包码", + "module": "giftcode", + "type": "update" + }, + { + "id": 39, + "api": "/api/users/cancelgiftCode", + "name": "取消礼包码", + "module": "giftcode", + "type": "delete" + }, + { + "id": 40, + "api": "/api/users/getgiftcodedetaillist", + "name": "获取礼包码列表", + "module": "giftcode", + "type": "find" + }, + { + "id": 41, + "api": "/api/users/getgiftcodelist", + "name": "获取礼包码列表", + "module": "giftcode", + "type": "find" + }, + { + "id": 42, "api": "/api/game/getnoticelist", "name": "获取公告列表", "module": "notice", "type": "find" }, { - "id": 48, + "id": 43, "api": "/api/game/updatenotice", "name": "更新公告", "module": "notice", "type": "update" }, { - "id": 49, + "id": 44, "api": "/api/game/delnotice", "name": "删除公告", "module": "notice", "type": "delete" }, { - "id": 50, + "id": 45, "api": "/api/game/getmarqueelist", "name": "获取跑马灯列表", "module": "marquee", "type": "find" }, { - "id": 51, + "id": 46, "api": "/api/game/updatemarquee", "name": "更新跑马灯", "module": "marquee", "type": "update" }, { - "id": 52, + "id": 47, + "api": "gm.gmServerHandler.sendMarquee", + "name": "发送跑马灯", + "module": "marquee", + "type": "update" + }, + { + "id": 48, + "api": "gm.gmServerHandler.cancelMarquee", + "name": "取消跑马灯", + "module": "marquee", + "type": "update" + }, + { + "id": 49, "api": "/api/game/getaccuse", "name": "获取举报列表", "module": "accuse", "type": "find" }, { - "id": 53, + "id": 50, "api": "/api/activity/getactivitylist", "name": "获取活动列表", "module": "activity", "type": "find" }, { - "id": 54, + "id": 51, "api": "/api/activity/getallactivities", "name": "获取所有活动", - "module": "base", + "module": "activity", "type": "find" }, { - "id": 55, + "id": 52, "api": "/api/activity/getactivitygrouplist", "name": "获取活动组列表", "module": "activity", "type": "find" }, { - "id": 56, + "id": 53, "api": "/api/activity/getallactivitygroups", "name": "获取所有活动组", - "module": "base", + "module": "activity", "type": "find" }, { - "id": 57, + "id": 54, "api": "/api/activity/creategroup", "name": "创建活动组", "module": "activity", "type": "add" }, { - "id": 58, + "id": 55, "api": "/api/activity/deletegroup", "name": "删除活动组", "module": "activity", "type": "delete" }, { - "id": 59, + "id": 56, "api": "/api/activity/getactivitygrouptypelist", "name": "获取活动组类型列表", "module": "activity", "type": "find" }, { - "id": 60, + "id": 57, "api": "/api/activity/getallactivitygrouptypes", "name": "获取所有活动组类型", - "module": "base", + "module": "activity", "type": "find" }, { - "id": 61, + "id": 58, "api": "/api/activity/saveactivitygrouptypelist", "name": "保存活动组类型", "module": "activity", "type": "update" }, { - "id": 62, + "id": 59, "api": "/api/activity/deleteactivitygrouptype", "name": "删除活动组类型", "module": "activity", "type": "delete" }, { - "id": 63, + "id": 60, "api": "/api/activity/getactivitytaskpoint", "name": "获取活动和任务对应", "module": "activity", "type": "find" }, { - "id": 64, + "id": 61, "api": "/api/activity/createtasktoactivity", "name": "创建活动和任务对应点", "module": "activity", "type": "add" }, { - "id": 65, + "id": 62, "api": "/api/activity/updateactivitytaskpoint", "name": "更新活动和任务对应点", "module": "activity", "type": "update" }, { - "id": 66, + "id": 63, "api": "/api/activity/delactivitytaskpoint", "name": "删除活动和任务对应点", "module": "activity", "type": "delete" }, + { + "id": 64, + "api": "gm.gmHandler.updateActivity", + "name": "更新活动", + "module": "activity", + "type": "update" + }, + { + "id": 65, + "api": "gm.gmHandler.deleteActivity", + "name": "删除活动", + "module": "activity", + "type": "delete" + }, + { + "id": 66, + "api": "gm.gmHandler.updateActivityGroup", + "name": "更新活动组", + "module": "activity", + "type": "update" + }, { "id": 67, "api": "/api/mail/getcreatesinglemail", @@ -521,7 +521,7 @@ "id": 75, "api": "/api/mail/findrolebyidorname", "name": "根据玩家名获取玩家", - "module": "base", + "module": "mail", "type": "find" }, { @@ -561,142 +561,142 @@ }, { "id": 81, - "api": "gm.gmHandler.reloadResource", - "name": "加载资源", - "module": "upload", - "type": "update" - }, - { - "id": 82, - "api": "gm.gmHandler.updateActivity", - "name": "更新活动", - "module": "activity", - "type": "update" - }, - { - "id": 83, - "api": "gm.gmHandler.deleteActivity", - "name": "删除活动", - "module": "activity", - "type": "delete" - }, - { - "id": 84, - "api": "gm.gmHandler.updateActivityGroup", - "name": "更新活动组", - "module": "activity", - "type": "update" - }, - { - "id": 85, "api": "gm.gmHandler.setGuildActivityDebug", "name": "开启军团活动", "module": "guildactivity", "type": "update" }, { - "id": 86, + "id": 82, "api": "gm.gmHandler.cancelGuildActivityDebug", "name": "取消军团活动", "module": "guildactivity", "type": "update" }, + { + "id": 83, + "api": "/api/game/getregions", + "name": "获取所有大区", + "module": "server", + "type": "find" + }, + { + "id": 84, + "api": "/api/game/getservers", + "name": "获取所有小区", + "module": "server", + "type": "find" + }, + { + "id": 85, + "api": "/api/game/getregionstategy", + "name": "获取大区策略", + "module": "server", + "type": "find" + }, + { + "id": 86, + "api": "/api/game/getwhitelist", + "name": "获取白名单", + "module": "server", + "type": "find" + }, { "id": 87, - "api": "gm.gmRoleHandler.addItems", - "name": "增加道具", - "module": "user", + "api": "/api/game/updatewhitelist", + "name": "更新白名单", + "module": "server", "type": "update" }, { "id": 88, - "api": "gm.gmRoleHandler.handleBlock", - "name": "封禁", - "module": "user", - "type": "update" + "api": "/api/game/deletewhitelist", + "name": "删除白名单", + "module": "server", + "type": "delete" }, { "id": 89, - "api": "gm.gmRoleHandler.updateGuild", - "name": "更新军团", - "module": "guild", + "api": "/api/game/stopserverregister", + "name": "小区停止注册", + "module": "server", "type": "update" }, { "id": 90, - "api": "gm.gmRoleHandler.dismissGuild", - "name": "解散军团", - "module": "guild", + "api": "/api/game/swicthserverstatus", + "name": "切换服务器状态", + "module": "server", "type": "update" }, { "id": 91, - "api": "gm.gmRoleHandler.setGuildLeader", - "name": "设置军团长", - "module": "guild", - "type": "update" - }, - { - "id": 92, "api": "gm.gmServerHandler.saveRegionConf", "name": "保存大区设置", "module": "server", "type": "update" }, { - "id": 93, + "id": 92, "api": "gm.gmServerHandler.createNewServer", "name": "手动开服", "module": "server", "type": "update" }, { - "id": 94, + "id": 93, "api": "gm.gmServerHandler.startMaintenance", "name": "开始维护", "module": "server", "type": "update" }, { - "id": 95, + "id": 94, "api": "gm.gmServerHandler.startRegionMaintenance", "name": "开始大区维护", "module": "server", "type": "update" }, { - "id": 96, + "id": 95, "api": "gm.gmServerHandler.stopMaintenance", "name": "停止维护", "module": "server", "type": "update" }, + { + "id": 96, + "api": "/api/upload/hotupdate", + "name": "上传热更新", + "module": "upload", + "type": "update" + }, { "id": 97, - "api": "gm.gmServerHandler.sendMarquee", - "name": "发送跑马灯", - "module": "marquee", + "api": "/api/upload/uploadjson", + "name": "上传json", + "module": "upload", "type": "update" }, { "id": 98, - "api": "gm.gmServerHandler.cancelMarquee", - "name": "取消跑马灯", - "module": "marquee", + "api": "/web/reloadresource", + "name": "加载资源(web)", + "module": "upload", "type": "update" }, { "id": 99, - "api": "/web/reloadresource", - "name": "加载资源", + "api": "/api/upload/reloadresource", + "name": "加载资源(后台)", "module": "upload", "type": "update" }, { "id": 100, - "api": "/api/users/getgiftcodelist", - "name": "获取礼包码列表", - "module": "giftcode", - "type": "find" + "api": "gm.gmHandler.reloadResource", + "name": "加载资源(游戏)", + "module": "upload", + "type": "update" } ] \ No newline at end of file diff --git a/web-server/app/middleware/gmTokenParser.ts b/web-server/app/middleware/gmTokenParser.ts index 1ba6a3cd3..8ffbe2b70 100644 --- a/web-server/app/middleware/gmTokenParser.ts +++ b/web-server/app/middleware/gmTokenParser.ts @@ -45,7 +45,7 @@ module.exports = () => { ctx.user = user; await next(); if(dicApi.type != GM_API_TYPE.find) { - GMRecordModel.createRecord(user?user.uid:0, ctx.request.url, JSON.stringify(ctx.request.body||{}), JSON.stringify(ctx.body||{})); + GMRecordModel.createRecord(user?user.uid:0, ctx.app.config.realEnv, ctx.request.url, JSON.stringify(ctx.request.body||{}), JSON.stringify(ctx.body||{})); } }; };