refactor: 重构状态更新接口,新增商品管理与勋章规则配置
1. 重构用户、宠物模板、勋章、管理员状态更新接口,移除冗余参数改为自动切换状态 2. 重命名宠物背景枚举为宠物皮肤,调整商品状态字段为枚举类型 3. 新增商品上下架状态管理接口与对应逻辑 4. 新增勋章规则配置系统,支持动态加载可用表和字段 5. 优化商品查询与展示逻辑,适配新的状态字段
This commit is contained in:
@ -45,7 +45,7 @@ public class WxMallService(
|
||||
public async Task<List<WxProductOutput>> GetProductsAsync(long userId, string? type = null)
|
||||
{
|
||||
var query = exchangeRecordRepository.Context.Queryable<Product>()
|
||||
.Where(p => !p.IsDeleted && p.IsActive && p.SaleStatus == "OnSale")
|
||||
.Where(p => !p.IsDeleted && p.IsActive && p.Status == (int)ProductStatusEnum.OnSale)
|
||||
.WhereIF(!string.IsNullOrEmpty(type), p => p.Type.ToString() == type)
|
||||
.OrderByDescending(p => p.CreatedAt);
|
||||
|
||||
@ -53,7 +53,7 @@ public class WxMallService(
|
||||
|
||||
// 批量提取 PetBg 商品的 SkinId
|
||||
var skinProductMap = products
|
||||
.Where(p => p.Type == ProductTypeEnum.PetBg)
|
||||
.Where(p => p.Type == ProductTypeEnum.PetSkin)
|
||||
.Select(p => new { ProductId = p.Id, SkinId = GetSkinIdFromMetaData(p.MetaData) })
|
||||
.Where(x => x.SkinId > 0)
|
||||
.ToList();
|
||||
@ -122,13 +122,13 @@ public class WxMallService(
|
||||
public async Task<WxProductOutput?> GetProductDetailAsync(long userId, long productId)
|
||||
{
|
||||
var product = await exchangeRecordRepository.Context.Queryable<Product>()
|
||||
.Where(p => p.Id == productId && !p.IsDeleted && p.IsActive && p.SaleStatus == "OnSale")
|
||||
.Where(p => p.Id == productId && !p.IsDeleted && p.IsActive && p.Status == (int)ProductStatusEnum.OnSale)
|
||||
.FirstAsync();
|
||||
|
||||
if (product == null) return null;
|
||||
|
||||
PetSkinBrief? skinBrief = null;
|
||||
if (product.Type == ProductTypeEnum.PetBg)
|
||||
if (product.Type == ProductTypeEnum.PetSkin)
|
||||
{
|
||||
var skinId = GetSkinIdFromMetaData(product.MetaData);
|
||||
if (skinId > 0)
|
||||
@ -190,7 +190,7 @@ public class WxMallService(
|
||||
|
||||
// 查询商品
|
||||
var product = await exchangeRecordRepository.Context.Queryable<Product>()
|
||||
.Where(p => p.Id == input.ProductId && !p.IsDeleted && p.IsActive && p.SaleStatus == "OnSale")
|
||||
.Where(p => p.Id == input.ProductId && !p.IsDeleted && p.IsActive && p.Status == (int)ProductStatusEnum.OnSale)
|
||||
.FirstAsync();
|
||||
|
||||
if (product == null)
|
||||
|
||||
Reference in New Issue
Block a user