You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
3.0 KiB
84 lines
3.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using LitJson;
|
|
using SimpleHttpServer;
|
|
using MySql.Data.MySqlClient;
|
|
using ProtoCSStruct;
|
|
using TencentCloud.Dayu.V20180709.Models;
|
|
using TencentCloud.Ckafka.V20190819.Models;
|
|
using System.Security.Cryptography;
|
|
using TencentCloud.Ecm.V20190719.Models;
|
|
|
|
namespace Operation
|
|
{
|
|
class ChangeName
|
|
{
|
|
[RequestMapping("修改玩家名称",PermissionCode.CHANGE_PLAYER_NAME_FILE, toLog: true,ignored:true)]
|
|
public static int OnChangeNameHttpReq(string httpApiCmd, JsonData jsonData, HttpResponse rsp, HttpRequest request, HttpQueryParams query, uint httpContextId)
|
|
{
|
|
TraceLog.Trace("ChangeName.OnChangeNameHttpReq url {0} ,param count {1} ,httpContextId {2}", request.Url, query.Count, httpContextId);
|
|
|
|
string server_id = query.GetValue("server_id");
|
|
int type = query.GetValue("type").Toint32();//类型(1:修改角色名称,2:修改公会名称)
|
|
string target_id = query.GetValue("target_id");
|
|
string new_name = query.GetValue("new_name");
|
|
|
|
TraceLog.Trace("ChangeName.OnChangeNameHttpReq server_id {0} ,type {1} ,target_id {2}, new_name {3}", server_id, type, target_id, new_name);
|
|
|
|
if (type == 1) {
|
|
SSGmChangeRoleNameReq req = new SSGmChangeRoleNameReq();
|
|
req.Id = httpContextId;
|
|
req.Uid = long.Parse(target_id);
|
|
req.Name.SetString(new_name);
|
|
|
|
OperationServerUtils.SendToWorld((int)SSGameMsgID.GmChangeRoleNameReq, ref req, req.Uid, 0, "");
|
|
rsp.IsWaitFor = true;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
public static void OnChangeRoleNameRes(uint serverID, StructPacket packet)
|
|
{
|
|
HttpRequestInfo m_request = null;
|
|
|
|
try
|
|
{
|
|
ref var res = ref packet.GetMessage<SSGmChangeRoleNameRes>();
|
|
var id = res.Id;
|
|
TraceLog.Debug("ChangeName.OnChangeRoleNameRes uid {0} ", id);
|
|
m_request = OperationServer.m_httpService.m_requestList.Find(f => f.Http.id == id);
|
|
LitJson.JsonData builder = new LitJson.JsonData();
|
|
HttpQueryParams queryParams = new HttpQueryParams(m_request.Http.httpRequest.Url);
|
|
|
|
builder["msg"] = "";
|
|
builder["code"] = res.Ret;
|
|
if (res.Ret == -1) {
|
|
builder["msg"] = "玩家不在线";
|
|
}
|
|
builder["data"] = null;
|
|
m_request.Http.httpResponse.IsWaitFor = false;
|
|
|
|
|
|
m_request.Http.httpResponse.ContentAsUTF8 = builder.ToJson();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
TraceLog.Error("ChangeName.OnChangeRoleNameRes Error Msg {0}", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
if (m_request != null)
|
|
{
|
|
m_request.ProcessEnd = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|