This commit is contained in:
Putoo
2026-05-30 17:32:27 +08:00
parent bd1535aee9
commit f8d4a28d53
79 changed files with 1369 additions and 134 deletions

View File

@@ -158,7 +158,7 @@ namespace Application.Web.Controllers.Login
{
return PoAction.Message("暂未开放本区服!");
}
//判断是否已经注册
var userData = await _userService.GetUserDataByAccId(accInfo.accId);
if (userData.Any(it => it.areaId == area))
@@ -247,7 +247,7 @@ namespace Application.Web.Controllers.Login
string Key = App.Configuration["JwtTokenOptions:SecurityKey"].ToString();
string Issuer = App.Configuration["JwtTokenOptions:Issuer"].ToString();
string Audience = App.Configuration["JwtTokenOptions:Audience"].ToString();
string accId = string.Empty;
var tokenData = await JwtTool.GetJwtData(parms.token, Key, "accId");
if (tokenData != null)
@@ -297,13 +297,53 @@ namespace Application.Web.Controllers.Login
string sex = parms.sex == 0 ? "女" : "男";
string userId = StateHelper.userId;
var userInfo = await _userService.GetUserInfoByUserId(userId);
if (userInfo == null)
{
return PoAction.Message("角色不存在!");
}
if (userInfo.regOk == 1)
{
return PoAction.Ok(true);
}
var areaInfo = await _areaService.GetAreaInfo((int)userInfo.areaId);
if (areaInfo.isNeedCode == 1) //需要激活码
{
if (string.IsNullOrEmpty(parms.code))
{
return PoAction.Message("请输入激活码!");
}
var ackInfo = await _areaService.GetAckInfo(parms.code);
if (ackInfo == null)
{
return PoAction.Message("激活码过期!");
}
if (ackInfo.status != 0)
{
return PoAction.Message("激活码过期!");
}
if (ackInfo.areaId != 0 && ackInfo.areaId != areaInfo.areaId)
{
return PoAction.Message($"当前激活码可用于{ackInfo.areaId}区激活!");
}
}
if (await _userService.CheckUserNickIsAt(parms.nick))
{
return PoAction.Message("昵称已存在!");
}
if (await _userService.RegisterUserInfo(userId, parms.nick, sex))
{
if (areaInfo.isNeedCode == 1)
{
await _areaService.UseAck(parms.code, userId);
}
return PoAction.Ok(true);
}
else