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.4 KiB
93 lines
3.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Threading;
|
|
using Sog;
|
|
using LitJson;
|
|
using SimpleHttpServer;
|
|
using ProtoCSStruct;
|
|
using MySql.Data.MySqlClient;
|
|
using System.Text;
|
|
using System.Net;
|
|
using System.IO;
|
|
|
|
namespace Operation
|
|
{
|
|
[MenuMapping(refc = typeof(PlayerInfoOp))]
|
|
public class SelectAccount
|
|
{
|
|
//收到回包时调用这个
|
|
public static void OnResMsg(uint id, JsonData jsondata, HttpResponse rsp, HttpRequest request,
|
|
HttpQueryParams query, ref SSGmQueryUserAccountInfoRes res)
|
|
{
|
|
if (string.IsNullOrEmpty(res.AccountId.GetString()))
|
|
{
|
|
jsondata["ret"] = 1;
|
|
return;
|
|
}
|
|
|
|
jsondata["ret"] = 0;
|
|
var time = res.CreateTime;
|
|
DateTime dateTime = AppTime.ConvertUnixTimeToDateTime((long)time * 1000);
|
|
var timeStr = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
|
JsonData roleList = new JsonData();
|
|
for (int i = 0; i < res.RoleList.Count; i++)
|
|
{
|
|
var role = res.RoleList.Get(i);
|
|
JsonData roleData = new JsonData();
|
|
roleData["realmId"] = (int)role.Realm;
|
|
roleData["uid"] = (int)role.Uid;
|
|
roleData["nick"] = role.Nick.GetString();
|
|
roleData["icon"] = role.Icon.GetString();
|
|
roleData["level"] = role.Level;
|
|
roleData["accountId"] = res.AccountId.GetString();
|
|
roleData["IpAddr"] = NetUtils.IpNumToAddr(res.CreateIpAddr);
|
|
roleData["CreateTime"] = timeStr;
|
|
roleData["Gender"] = res.Gender.ToString();
|
|
roleData["Channel"] = res.Channel.ToString();
|
|
roleData["ChannelId"] = res.ChannelId.ToString();
|
|
roleData["CreateDeviceId"] = res.CreateDeviceId.ToString();
|
|
|
|
roleData["LastLoginRealm"] = res.LastLoginRealm.ToString();
|
|
roleData["ExData"] = res.ExData.ToString();
|
|
roleList.Add(roleData);
|
|
}
|
|
|
|
jsondata["data"] = roleList;
|
|
rsp.IsWaitFor = false;
|
|
|
|
TraceLog.Trace("SelectAccount.OnResMsg success, uid {0} pay count {1}", id, res.Nick);
|
|
|
|
|
|
return;
|
|
}
|
|
|
|
[RequestMapping("账号查询", PermissionCode.SELECT_ACCOUNT_INFO, true)]
|
|
public static int OnSelectAccountInfoHttpReq(string httpApiCmd, JsonData jsonData, HttpResponse rsp,
|
|
HttpRequest request, HttpQueryParams query, uint httpContextId)
|
|
{
|
|
try
|
|
{
|
|
TraceLog.Trace("SelectAccount.DoSelect Url{0},param count {1}", request.Url, query.Count);
|
|
|
|
string Account = query.GetValue("Account");
|
|
int AccountType = query.GetValue("AccountType").Toint32(0);
|
|
|
|
SSGmQueryUserAccountInfoReq req = new SSGmQueryUserAccountInfoReq();
|
|
req.Id = httpContextId;
|
|
req.Account.SetString(Account);
|
|
req.AccountType = AccountType;
|
|
//发送消息
|
|
OperationServerUtils.SendToDBServer((int)SSGameMsgID.GmQueryUserAccountinfoReq, ref req, 0, 0);
|
|
rsp.IsWaitFor = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
TraceLog.Error("SelectAccount.OnSelectAccountInfoHttpReq Error Msg {0}", ex.Message);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|