feat: add limit owner
This commit is contained in:
@@ -405,6 +405,9 @@ func ProductAnalyticsPerParentCategoryModelToContract(resp *models.ProductAnalyt
|
||||
data = append(data, contract.ProductAnalyticsPerParentCategoryData{
|
||||
ParentCategoryID: item.ParentCategoryID,
|
||||
ParentCategoryName: item.ParentCategoryName,
|
||||
OwnerFeePercent: item.OwnerFeePercent,
|
||||
TopProduct: parentCategoryTopProductModelToContract(item.TopProduct),
|
||||
SDL: item.SDL,
|
||||
TotalRevenue: item.TotalRevenue,
|
||||
TotalQuantity: item.TotalQuantity,
|
||||
CategoryCount: item.CategoryCount,
|
||||
@@ -427,6 +430,19 @@ func ProductAnalyticsPerParentCategoryModelToContract(resp *models.ProductAnalyt
|
||||
}
|
||||
}
|
||||
|
||||
// parentCategoryTopProductModelToContract converts the top product of a parent category to contract
|
||||
func parentCategoryTopProductModelToContract(product *models.ParentCategoryTopProduct) *contract.ParentCategoryTopProduct {
|
||||
if product == nil {
|
||||
return nil
|
||||
}
|
||||
return &contract.ParentCategoryTopProduct{
|
||||
ProductID: product.ProductID,
|
||||
ProductName: product.ProductName,
|
||||
QuantitySold: product.QuantitySold,
|
||||
Revenue: product.Revenue,
|
||||
}
|
||||
}
|
||||
|
||||
// budgetPeriodModelToContract converts one budget period to contract
|
||||
func budgetPeriodModelToContract(period models.BudgetPeriod) contract.BudgetPeriod {
|
||||
return contract.BudgetPeriod{
|
||||
@@ -435,7 +451,7 @@ func budgetPeriodModelToContract(period models.BudgetPeriod) contract.BudgetPeri
|
||||
Revenue: period.Revenue,
|
||||
OrderCount: period.OrderCount,
|
||||
LimitPurchase: period.LimitPurchase,
|
||||
LimitOwner: period.LimitOwner,
|
||||
SDL: period.SDL,
|
||||
LimitTeam: period.LimitTeam,
|
||||
}
|
||||
}
|
||||
@@ -548,6 +564,9 @@ func ParentCategoryAnalyticsDetailModelToContract(resp *models.ParentCategoryAna
|
||||
ParentCategoryID: resp.ParentCategoryID,
|
||||
ParentCategoryName: resp.ParentCategoryName,
|
||||
Summary: contract.ParentCategoryAnalyticsDetailSummary{
|
||||
OwnerFeePercent: resp.Summary.OwnerFeePercent,
|
||||
TopProduct: parentCategoryTopProductModelToContract(resp.Summary.TopProduct),
|
||||
SDL: resp.Summary.SDL,
|
||||
TotalRevenue: resp.Summary.TotalRevenue,
|
||||
TotalQuantity: resp.Summary.TotalQuantity,
|
||||
CategoryCount: resp.Summary.CategoryCount,
|
||||
|
||||
Reference in New Issue
Block a user