This commit is contained in:
Putoo
2026-07-08 19:13:55 +08:00
parent 5d0ebe5077
commit fe2696074b
59 changed files with 1448 additions and 112 deletions

View File

@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
using Photon.Core.Redis;
namespace Application.Web.Controllers.Login
{
@@ -19,7 +20,7 @@ namespace Application.Web.Controllers.Login
private readonly IUnitUserAttrService _attrService;
public LoginController(IGameAccountService accountService, IAreaService areaService,
IUnitUserService userService,IUnitUserAttrService attrService)
IUnitUserService userService, IUnitUserAttrService attrService)
{
_accountService = accountService;
_areaService = areaService;
@@ -27,6 +28,7 @@ namespace Application.Web.Controllers.Login
_attrService = attrService;
}
/// <summary>
/// 登录接口
/// </summary>
@@ -273,14 +275,14 @@ namespace Application.Web.Controllers.Login
loadData.Add("accId", userInfo.accId);
loadData.Add("areaId", userInfo.areaId);
string token = JwtHelper.CreateToken(Key, Issuer, Audience, loadData, TokenConfig.TokenTime);
//记录在线时间
await _attrService.UpdateOnLineTime(userInfo.userId, "Default", TokenConfig.TokenTime);
return PoAction.Ok(new
{ token = token, refToken = userInfo.token, userId = userInfo.userId });
}
[HttpPost]
public async Task<IPoAction> RefreshTokenByBook([FromBody] RefreshTokenParms parms)
{
@@ -304,7 +306,7 @@ namespace Application.Web.Controllers.Login
loadData.Add("accId", userInfo.accId);
loadData.Add("areaId", userInfo.areaId);
string token = JwtHelper.CreateToken(Key, Issuer, Audience, loadData, TokenConfig.TokenTime);
return PoAction.Ok(new
{ token = token, refToken = userInfo.token, userId = userInfo.userId });
}