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.
93 lines
3.2 KiB
93 lines
3.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Threading;
|
|
|
|
using Operation;
|
|
using Sog;
|
|
using LitJson;
|
|
using SimpleHttpServer;
|
|
using MySql.Data.MySqlClient;
|
|
using ProtoCSStruct;
|
|
|
|
namespace Operation
|
|
{
|
|
public class DeleteUserName
|
|
{
|
|
[RequestMapping("删除用户名",PermissionCode.DEL_USER_NAME, toLog: true)]
|
|
public static int OnDeleteUserNameHttpReq(string httpApiCmd, JsonData jsonData, HttpResponse rsp, HttpRequest request, HttpQueryParams query, uint httpContextId)
|
|
{
|
|
TraceLog.Trace("DeleteUserName.OnDeleteUserNameHttpReq url {0} ,param count {1} ,httpContextId {2}", request.Url, query.Count, httpContextId);
|
|
|
|
string account = query.GetValue("account") == null ? "" : query.GetValue("account");
|
|
string user = query.GetValue("user") == null ? "" : query.GetValue("user");
|
|
|
|
TraceLog.Trace("DeleteUserName.OnDeleteUserNameHttpReq account {0} ,user {1}", account, user);
|
|
|
|
if (user == "")
|
|
{
|
|
jsonData["ret"] = 6;
|
|
jsonData["msg"] = "delete user account is empty";
|
|
return 6;
|
|
}
|
|
|
|
if (user == "mmogtest")
|
|
{
|
|
jsonData["ret"] = 10;
|
|
jsonData["msg"] = "管理员账号无法删除!";
|
|
return 10;
|
|
}
|
|
|
|
RepeatedFixedStructString128_10 data = new RepeatedFixedStructString128_10();
|
|
data.Add(account);
|
|
data.Add(user);
|
|
HttpApiRootHandler.FillHttpApiDbReq2MessageTaskDistributor(httpApiCmd, httpContextId, ref data);
|
|
|
|
rsp.IsWaitFor = true;
|
|
|
|
return 0;
|
|
}
|
|
|
|
public static int DoDeleteUserName(string httpApiCmd, SSHttpApiDbReq req, DBOperator dbOperator)
|
|
{
|
|
TraceLog.Trace("DeleteUserName.DoDeleteUserName HttpContextId {0}", req.HttpContextId);
|
|
|
|
HttpRequestInfo m_request = null;
|
|
LitJson.JsonData builder = new LitJson.JsonData();
|
|
|
|
try
|
|
{
|
|
var httpContextId = req.HttpContextId;
|
|
m_request = OperationServer.m_httpService.m_requestList.Find(f => f.Http.id == httpContextId);
|
|
|
|
if (req.Data.Count < 2)
|
|
{
|
|
TraceLog.Error("DeleteUserName.DoDeleteUserName param error");
|
|
builder["ret"] = 2;
|
|
builder["msg"] = "参数错误";
|
|
}
|
|
else
|
|
{
|
|
dbOperator.DBDeleteUserName(req.Data[0].ToString(), req.Data[1].ToString(), builder);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
TraceLog.Error("DeleteUserName.DoDeleteUserName Error Msg {0}", ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
if (m_request != null)
|
|
{
|
|
m_request.Http.httpResponse.ContentAsUTF8 = builder.ToJson();
|
|
m_request.ProcessEnd = true;
|
|
}
|
|
}
|
|
|
|
TraceLog.Trace("DeleteUserName.DoDeleteUserName success httpContextId {0}", req.HttpContextId);
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
|