This commit is contained in:
laodaming 2023-09-12 18:09:38 +08:00
parent df73e8d5ce
commit 0aef122f1b
3 changed files with 4 additions and 5 deletions

View File

@ -73,13 +73,9 @@ func (l *GetSizeByPidLogic) GetSizeByPid(req *types.GetSizeByPidReq, userinfo *a
}
sizeIds := make([]int64, 0, len(sizeList))
productIds := make([]int64, 0, len(sizeList))
for k, v := range sizeList {
for _, v := range sizeList {
sizeIds = append(sizeIds, v.Id)
productIds = append(productIds, *v.ProductId)
//把默认的排第一
if v.Id == defaultSizeId {
sizeList[0], sizeList[k] = sizeList[k], sizeList[0]
}
}
//获取产品价格列表
productPriceList, err := l.svcCtx.AllModels.FsProductPrice.GetSimplePriceListByProductIds(l.ctx, productIds)
@ -142,6 +138,7 @@ func (l *GetSizeByPidLogic) GetSizeByPid(req *types.GetSizeByPidReq, userinfo *a
ModelId: modelList[modelIndex].Id,
IsPopular: *sizeInfo.IsHot > 0,
MinPrice: float64(minPrice) / 100,
IsDefault: defaultSizeId == sizeInfo.Id,
})
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", listRsp)

View File

@ -345,6 +345,7 @@ type GetSizeByPidRsp struct {
ModelId int64 `json:"model_id"` //产品主模型id
IsPopular bool `json:"is_popular"` //是否受欢迎
MinPrice float64 `json:"min_price"` //最小价格
IsDefault bool `json:"is_default"` //是否默认(这里的默认是跟列表页一致)
}
type GetTemplateByPidReq struct {

View File

@ -390,6 +390,7 @@ type GetSizeByPidRsp {
ModelId int64 `json:"model_id"` //产品主模型id
IsPopular bool `json:"is_popular"` //是否受欢迎
MinPrice float64 `json:"min_price"` //最小价格
IsDefault bool `json:"is_default"` //是否默认(这里的默认是跟列表页一致)
}
//获取产品模板
type GetTemplateByPidReq {