refactor: 重构状态更新接口,新增商品管理与勋章规则配置
1. 重构用户、宠物模板、勋章、管理员状态更新接口,移除冗余参数改为自动切换状态 2. 重命名宠物背景枚举为宠物皮肤,调整商品状态字段为枚举类型 3. 新增商品上下架状态管理接口与对应逻辑 4. 新增勋章规则配置系统,支持动态加载可用表和字段 5. 优化商品查询与展示逻辑,适配新的状态字段
This commit is contained in:
@ -484,18 +484,20 @@ public class PetService(
|
||||
/// <summary>
|
||||
/// 更新模板状态(启用/禁用)
|
||||
/// </summary>
|
||||
public async Task UpdateTemplateStatusAsync(long id, int status)
|
||||
public async Task UpdateTemplateStatusAsync(long id)
|
||||
{
|
||||
var template = await petTemplateRepository.GetByIdAsync(id);
|
||||
if (template == null || template.IsDeleted)
|
||||
throw new BusinessException("宠物模板不存在", 404);
|
||||
|
||||
template.Status = status;
|
||||
|
||||
template.Status = template.Status == (int)PetTemplateStatusEnum.Active
|
||||
? (int)PetTemplateStatusEnum.Inactive
|
||||
: (int)PetTemplateStatusEnum.Active;
|
||||
template.UpdatedBy = "System";
|
||||
template.UpdatedAt = DateTime.Now;
|
||||
await petTemplateRepository.UpdateAsync(template);
|
||||
|
||||
logger.LogInformation("更新模板状态成功,Id: {Id}, Status: {Status}", id, status);
|
||||
logger.LogInformation("更新模板状态成功,Id: {Id}, Status: {Status}", id, template.Status);
|
||||
}
|
||||
|
||||
private static PetTemplateOutput BuildTemplateOutput(PetTemplate t)
|
||||
|
||||
Reference in New Issue
Block a user