refactor(pet): 重构宠物模块实体与接口
1. 将原Pet实体重命名为UserPet,新增PetTemplate模板实体拆分宠物模板与实例数据 2. 调整IPetService泛型参数为IBaseService<UserPet> 3. 补充宠物模板相关字段与查询逻辑,完善创建默认宠物的流程 4. 替换所有Pet实体引用为UserPet,修正相关服务层查询与更新逻辑
This commit is contained in:
@ -495,7 +495,7 @@ public class WxMallService(
|
||||
logger.LogInformation("宠物换肤,UserId: {UserId}, SkinId: {SkinId}", userId, input.SkinId);
|
||||
|
||||
// 查询用户宠物
|
||||
var pet = await exchangeRecordRepository.Context.Queryable<Pet>()
|
||||
var pet = await exchangeRecordRepository.Context.Queryable<UserPet>()
|
||||
.Where(p => p.UserId == userId && !p.IsDeleted)
|
||||
.FirstAsync();
|
||||
|
||||
@ -505,7 +505,7 @@ public class WxMallService(
|
||||
if (input.SkinId == 0)
|
||||
{
|
||||
// 恢复默认皮肤
|
||||
await exchangeRecordRepository.Context.Updateable<Pet>()
|
||||
await exchangeRecordRepository.Context.Updateable<UserPet>()
|
||||
.SetColumns(p => p.CurrentSkinId == 0)
|
||||
.SetColumns(p => p.UpdatedAt == DateTime.Now)
|
||||
.Where(p => p.Id == pet.Id)
|
||||
@ -535,7 +535,7 @@ public class WxMallService(
|
||||
throw new BusinessException("您尚未拥有该皮肤,请先兑换", 400);
|
||||
|
||||
// 换肤
|
||||
await exchangeRecordRepository.Context.Updateable<Pet>()
|
||||
await exchangeRecordRepository.Context.Updateable<UserPet>()
|
||||
.SetColumns(p => p.CurrentSkinId == skin.Id)
|
||||
.SetColumns(p => p.UpdatedAt == DateTime.Now)
|
||||
.Where(p => p.Id == pet.Id)
|
||||
|
||||
Reference in New Issue
Block a user