This commit is contained in:
2026-03-30 11:07:30 +08:00
parent 2c44b3a4b2
commit d4a8e71733
74 changed files with 1751 additions and 421 deletions

View File

@@ -150,7 +150,7 @@ public class UserService : IUserService
public async Task<ApiResponse> ChangePasswordAsync(ChangePasswordParams model)
{
int userId = _claimsService.GetCurrentUserId();
int userId = _claimsService.GetCurrentUserId()!.Value;
var user = await _dbContext.Users
.FirstAsync(u => u.Id == userId);
@@ -166,7 +166,7 @@ public class UserService : IUserService
public async Task<ApiResponse<User>> GetUserInfoAsync()
{
var userId = _claimsService.GetCurrentUserId();
var userId = _claimsService.GetCurrentUserId()!.Value;
var model = await _dbContext.Users
.FirstAsync(u => u.Id == userId);
@@ -187,7 +187,7 @@ public class UserService : IUserService
public async Task<ApiResponse> EditAsync(EditUserParams model)
{
int userId = _claimsService.GetCurrentUserId();
int userId = _claimsService.GetCurrentUserId()!.Value;
var user = await _dbContext.Users.FirstAsync(u => u.Id == userId);
if (!string.IsNullOrWhiteSpace(model.AvatarFileName))
@@ -205,7 +205,7 @@ public class UserService : IUserService
public ApiResponse<List<Address>> GetAddresses()
{
var userId = _claimsService.GetCurrentUserId();
var userId = _claimsService.GetCurrentUserId()!.Value;
var addresses = _dbContext.Addresses
.Where(a => a.UserId == userId)
@@ -221,7 +221,7 @@ public class UserService : IUserService
{
EF.Models.Address? address = null;
var userId = _claimsService.GetCurrentUserId();
var userId = _claimsService.GetCurrentUserId()!.Value;
if (model.Id.HasValue && model.Id > 0)
{
@@ -253,7 +253,7 @@ public class UserService : IUserService
public async Task<ApiResponse> DeleteAddressAsync(int id)
{
var userId = _claimsService.GetCurrentUserId();
var userId = _claimsService.GetCurrentUserId()!.Value;
await _dbContext.Addresses
.Where(a => a.Id == id && a.UserId == userId)
.ExecuteDeleteAsync();