fix: 优化微信授权服务的用户创建逻辑
移除冗余的用户ID赋值步骤,直接使用插入后返回的主键值填充日志,简化代码逻辑
This commit is contained in:
@ -260,11 +260,10 @@ public class WeChatAuthService(
|
||||
UpdatedAt = DateTime.Now
|
||||
};
|
||||
|
||||
var userId = await wxUserRepository.Context.Insertable(newUser).ExecuteReturnIdentityAsync();
|
||||
newUser.Id = userId;
|
||||
await wxUserRepository.Context.Insertable(newUser).ExecuteReturnIdentityAsync();
|
||||
|
||||
logger.LogInformation("新用户创建成功,UserId: {UserId}, WxUserId: {WxUserId}, Name: {Name}",
|
||||
userId, wxUserId, input.Name);
|
||||
newUser.Id, wxUserId, input.Name);
|
||||
|
||||
// 为新用户创建默认宠物
|
||||
try { await petService.CreateDefaultPetAsync(newUser.Id); }
|
||||
|
||||
Reference in New Issue
Block a user