//api/GM?token={token}&name={name}&pid={pid}&sid={sid}&search={search}&value={value}&type={type}&time={time}&reason={reason} /// <summary>Gm管理</summary> /// <param name="token">令牌</param> /// <param name="name">用户名</param> /// <param name="pid">平台id</param> /// <param name="sid">服务器</param> /// <param name="search">查询方式</param> /// <param name="value">查询值</param> /// <param name="type">操作类型</param> /// <param name="time">时间限制</param> /// <param name="reason">操作原因</param> /// <returns></returns> public GmManage PostGmManage(String token, String name, Int32 pid, Int32 sid, Int32 search, String value, Int32 type, Int64 time, String reason) { if (!IsToken(token)) { return new GmManage() { result = -1, message = "令牌不存在" } } ; //验证会话 tgm_role.SetDbConnName(tgm_connection); var user = tgm_role.GetFindEntity(name); if (user == null) { return new GmManage() { result = -1, message = "没有该操作的权限" } } ; tgm_platform.SetDbConnName(tgm_connection); var pl = tgm_platform.FindByid(pid); if (user.role != 10000) { if (pl.id != user.pid) { return new GmManage() { result = -1, message = "没有权限操作该平台信息" } } ; } tgm_server.SetDbConnName(tgm_connection); var server = tgm_server.FindByid(sid); if (server == null) { return new GmManage() { result = -1, message = "服务器不存在" } } ; SN = server.name; tg_user.SetDbConnName(db_connection); var player = search == 1 ? tg_user.GetEntityByCode(value) //根据账号查询 : tg_user.GetEntityByName(value); //根据玩家名查询 if (player == null) { return new GmManage() { result = -1, message = "没有该玩家信息" } } ; if (player.state != 0) { switch (player.state) { case 1: return(new GmManage() { result = -1, message = "该玩家已冻结,不能继续操作" }); case 2: return(new GmManage() { result = -1, message = "该玩家已封号,不能继续操作" }); } } player.state = type; player.state_end_time = DateTime.Now.Ticks + time * 60 * 1000; if (player.Save() < 0) { return new GmManage() { result = -1, message = "操作玩家数据失败" } } ; tgm_gm.SetDbConnName(tgm_connection); var entity = new tgm_gm() { pid = pl.id, sid = server.id, player_id = player.id, limit_time = time * 60 * 1000, state = type, player_name = player.player_name, player_code = player.user_code, platform_name = pl.name, server_name = server.name, describe = reason, createtime = DateTime.Now.Ticks, operate = name, }; entity.Save(); var ip = server.ip; var port = server.port_server; //解析后调用游戏接口判断是否成功 var api = new CommandApi(ip, port, ApiCommand.冻结封号); var state = api.Gmoperate(player.id); api.Dispose(); if (state != (int)ApiType.OK) { return new GmManage() { result = (int)ApiType.OK, message = "操作玩家信息失败" } } ; var gm = ToEntity.ToGmManage(entity); gm.result = 1; return(gm); }