anchen
好像成功了
[MessageHandler]
public class C2R_UIMateLogin_RegisterPanel_RegisterHandler : AMRpcHandler<
C2R_UIMateLogin_RegisterPanel_Register, R2C_UIMateLogin_RegisterPanel_Register>
{
protected override async ETTask RunAsync(Session session, C2R_UIMateLogin_RegisterPanel_Register request, R2C_UIMateLogin_RegisterPanel_Register response, Action reply)
{
//获取数据表的数据StartZoneConfig@s
StartZoneConfig startZoneConfig = StartZoneConfigCategory.Instance.Get(1);
//获取DBComponent组件
DBComponent dBComponent = DBManagerComponent.Instance.GetZoneDB(startZoneConfig.Id);
//查询账号有没有被注册过
var users = await dBComponent.Query<Account>(d => d.AccountName.Equals(request.Account.Trim()));
if (users != null && users.Count > 0)
{
response.Message = "该账号已被注册";
reply();
return;
}
//注册账号
Account account = null;
account = session.AddChild<Account>();
account.AccountName = request.Account;
account.Password = request.Password;
account.CreateTime = TimeHelper.ServerNow();
account.isTempAccount = false;
account.AccountType = (int)AccountType.General;
await dBComponent.InsertBatch(new List<Account>() { account });
response.Message = "注册成功,请返回登录!";
reply();
}
}