add auto comb cost price
This commit is contained in:
@@ -357,9 +357,9 @@ func (s *ProductApplicationServiceImpl) UpdatePackageItems(ctx context.Context,
|
||||
return s.productManagementService.UpdatePackageItemsBatch(ctx, packageID, cmd.Items)
|
||||
}
|
||||
|
||||
// GetAvailableProducts 获取可选子产品列表
|
||||
// 业务流程:1. 获取启用产品 2. 过滤可订阅产品 3. 构建响应数据
|
||||
func (s *ProductApplicationServiceImpl) GetAvailableProducts(ctx context.Context, query *appQueries.GetAvailableProductsQuery) (*responses.ProductListResponse, error) {
|
||||
// GetAvailableProducts 获取可选子产品列表(管理员端,返回包含成本价的数据)
|
||||
// 业务流程:1. 获取启用产品 2. 过滤可订阅产品 3. 构建管理员响应数据
|
||||
func (s *ProductApplicationServiceImpl) GetAvailableProducts(ctx context.Context, query *appQueries.GetAvailableProductsQuery) (*responses.ProductAdminListResponse, error) {
|
||||
// 构建筛选条件
|
||||
filters := make(map[string]interface{})
|
||||
filters["is_package"] = false // 只获取非组合包产品
|
||||
@@ -385,13 +385,13 @@ func (s *ProductApplicationServiceImpl) GetAvailableProducts(ctx context.Context
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换为响应对象
|
||||
items := make([]responses.ProductInfoResponse, len(products))
|
||||
// 转换为管理员响应对象(包含成本价,用于组合包配置)
|
||||
items := make([]responses.ProductAdminInfoResponse, len(products))
|
||||
for i := range products {
|
||||
items[i] = *s.convertToProductInfoResponse(products[i])
|
||||
items[i] = *s.convertToProductAdminInfoResponse(products[i])
|
||||
}
|
||||
|
||||
return &responses.ProductListResponse{
|
||||
return &responses.ProductAdminListResponse{
|
||||
Total: total,
|
||||
Page: options.Page,
|
||||
Size: options.PageSize,
|
||||
@@ -514,6 +514,7 @@ func (s *ProductApplicationServiceImpl) convertToProductInfoResponse(product *en
|
||||
ProductName: item.Product.Name,
|
||||
SortOrder: item.SortOrder,
|
||||
Price: item.Product.Price.InexactFloat64(),
|
||||
CostPrice: item.Product.CostPrice.InexactFloat64(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,6 +561,7 @@ func (s *ProductApplicationServiceImpl) convertToProductAdminInfoResponse(produc
|
||||
ProductName: item.Product.Name,
|
||||
SortOrder: item.SortOrder,
|
||||
Price: item.Product.Price.InexactFloat64(),
|
||||
CostPrice: item.Product.CostPrice.InexactFloat64(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user