增加Shop API
This commit is contained in:
1 parent
3769193696
commit
5d017740c6
83 files changed
+4451
-696
No files matched your search
@@ -29,7 +29,7 @@ namespace Store.Api.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录:校验用户名/密码,签发 JWT(同账号支持多个独立会话)
|
||||
/// 登录:校验用户名/密码,签发数据库 Token(同账号支持多个独立会话)
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
[EndpointSummary("用户登录")]
|
||||
@@ -51,7 +51,9 @@ namespace Store.Api.Controllers
|
||||
new(JwtClaimTypes.UserName, user.UserName),
|
||||
};
|
||||
|
||||
TokenResult token = _tokenService.CreateToken(claims, HttpContext.Connection.RemoteIpAddress?.ToString());
|
||||
if (request.DeviceId?.Length > 100 || request.DeviceName?.Length > 100)
|
||||
return ApiResult.Fail("设备信息最多 100 字符", 400);
|
||||
TokenResult token = _tokenService.CreateToken(claims, HttpContext.Connection.RemoteIpAddress?.ToString(), request.DeviceId, request.DeviceName);
|
||||
return ApiResult.Ok(token);
|
||||
}
|
||||
|
||||
@@ -108,5 +110,7 @@ namespace Store.Api.Controllers
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string? DeviceId { get; set; }
|
||||
public string? DeviceName { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user