From edd4104ce7eaf701dd353808114753a89e88170f Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 21 Jul 2023 10:33:43 +0800 Subject: [PATCH] fix --- model/gmodel/fs_product_recommend_gen.go | 2 +- model/gmodel/fs_product_size_gen.go | 1 + server/product/internal/logic/getsizebypidlogic.go | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/model/gmodel/fs_product_recommend_gen.go b/model/gmodel/fs_product_recommend_gen.go index 3c7c6363..16988d7a 100644 --- a/model/gmodel/fs_product_recommend_gen.go +++ b/model/gmodel/fs_product_recommend_gen.go @@ -7,7 +7,7 @@ import ( // fs_product_recommend 推荐商品表 type FsProductRecommend struct { Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // - ProductId *int64 `gorm:"unique_key;default:0;" json:"product_id"` // 产品ID + ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品ID Status *int64 `gorm:"default:1;" json:"status"` // 状态 1正常 0不正常 Category *int64 `gorm:"default:1;" json:"category"` // 推荐类别1:详情推荐 2:列表页推荐 Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 diff --git a/model/gmodel/fs_product_size_gen.go b/model/gmodel/fs_product_size_gen.go index c8779e7a..0c3560e3 100644 --- a/model/gmodel/fs_product_size_gen.go +++ b/model/gmodel/fs_product_size_gen.go @@ -8,6 +8,7 @@ import ( type FsProductSize struct { Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID + IsPopular *int64 `gorm:"default:0;" json:"is_popular"` // 是否受欢迎 0否1是 Title *string `gorm:"default:'';" json:"title"` // 标题 10*10*20 Cover *string `gorm:"default:'';" json:"cover"` // CoverImg *string `gorm:"default:'';" json:"cover_img"` // diff --git a/server/product/internal/logic/getsizebypidlogic.go b/server/product/internal/logic/getsizebypidlogic.go index b04e9a44..8939f02b 100644 --- a/server/product/internal/logic/getsizebypidlogic.go +++ b/server/product/internal/logic/getsizebypidlogic.go @@ -46,7 +46,7 @@ func (l *GetSizeByPidLogic) GetSizeByPid(req *types.GetSizeByPidReq, userinfo *a return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product info") } //获取产品尺寸列表(需要正序排序) - sizeList, err := l.svcCtx.AllModels.FsProductSize.GetAllByProductIds(l.ctx, []int64{productInfo.Id}, "sort ASC") + sizeList, err := l.svcCtx.AllModels.FsProductSize.GetAllByProductIds(l.ctx, []int64{productInfo.Id}, "is_popular DESC,sort ASC") if err != nil { logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get size list")