diff --git a/model/gmodel/fs_merchant_category_gen.go b/model/gmodel/fs_merchant_category_gen.go new file mode 100644 index 00000000..732ec88b --- /dev/null +++ b/model/gmodel/fs_merchant_category_gen.go @@ -0,0 +1,25 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_merchant_category 商户类型表 +type FsMerchantCategory struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // Id + ZnName *string `gorm:"default:'';" json:"zn_name"` // 中文名 + EnName *string `gorm:"default:'';" json:"en_name"` // 英文名 + Icon *string `gorm:"default:'';" json:"icon"` // 图标 + RecommendProduct *string `gorm:"default:'';" json:"recommend_product"` // 推荐商品 + Sort *int64 `gorm:"default:0;" json:"sort"` // 排序 + Status *int64 `gorm:"default:0;" json:"status"` // 状态 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 +} +type FsMerchantCategoryModel struct { + db *gorm.DB + name string +} + +func NewFsMerchantCategoryModel(db *gorm.DB) *FsMerchantCategoryModel { + return &FsMerchantCategoryModel{db: db, name: "fs_merchant_category"} +} diff --git a/model/gmodel/fs_merchant_category_logic.go b/model/gmodel/fs_merchant_category_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_merchant_category_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_product_recommend_gen.go b/model/gmodel/fs_product_recommend_gen.go index 930a3da8..111494f6 100644 --- a/model/gmodel/fs_product_recommend_gen.go +++ b/model/gmodel/fs_product_recommend_gen.go @@ -6,10 +6,11 @@ import ( // fs_product_recommend 推荐商品表 type FsProductRecommend struct { - Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // - ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品ID - Status *int64 `gorm:"default:1;" json:"status"` // 状态 1正常 0不正常 - Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品ID + MerchantType *int64 `gorm:"default:0;" json:"merchant_type"` // 商家类型 + Status *int64 `gorm:"default:1;" json:"status"` // 状态 1正常 0不正常 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 } type FsProductRecommendModel struct { db *gorm.DB diff --git a/model/gmodel/fs_product_recommend_logic.go b/model/gmodel/fs_product_recommend_logic.go index 02e33584..0646203d 100644 --- a/model/gmodel/fs_product_recommend_logic.go +++ b/model/gmodel/fs_product_recommend_logic.go @@ -7,9 +7,10 @@ import ( ) type GetRecommendProductListReq struct { - Ctx context.Context - Page int - Limit int + Ctx context.Context + MerchantType int64 + Page int + Limit int } func (r *FsProductRecommendModel) GetRecommendProductList(req GetRecommendProductListReq) (resp []FsProduct, total int64, err error) { @@ -18,6 +19,9 @@ func (r *FsProductRecommendModel) GetRecommendProductList(req GetRecommendProduc Joins("inner join fs_product as p on r.product_id = p.id"). Where("r.status = ? ", 1). Where("p.is_shelf = ? and p.is_del = ? and p.status = ?", 1, 0, 1) + if req.MerchantType > 0 { + db = db.Where("merchant_type = ?", req.MerchantType) + } if err = db.Limit(1).Count(&total).Error; err != nil { return nil, 0, err } diff --git a/model/gmodel/fs_product_template_v2_gen.go b/model/gmodel/fs_product_template_v2_gen.go index d72b388a..07ad37fc 100644 --- a/model/gmodel/fs_product_template_v2_gen.go +++ b/model/gmodel/fs_product_template_v2_gen.go @@ -9,21 +9,21 @@ type FsProductTemplateV2 struct { Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID ModelId *int64 `gorm:"default:0;" json:"model_id"` // 模型ID - Title *string `gorm:"default:'';" json:"title"` // 模板(sku),预留字段 - Name *string `gorm:"default:'';" json:"name"` // 名称 - CoverImg *string `gorm:"default:'';" json:"cover_img"` // 模板背景图 - TemplateInfo *string `gorm:"default:'';" json:"template_info"` // 模板详情 - MaterialImg *string `gorm:"default:'';" json:"material_img"` // 合成好的贴图 + Title *string `gorm:"default:'';" json:"title"` // + Name *string `gorm:"default:'';" json:"name"` // + CoverImg *string `gorm:"default:'';" json:"cover_img"` // + TemplateInfo *string `gorm:"default:'';" json:"template_info"` // + MaterialImg *string `gorm:"default:'';" json:"material_img"` // Sort *int64 `gorm:"default:0;" json:"sort"` // 排序 LogoWidth *int64 `gorm:"default:0;" json:"logo_width"` // logo图最大宽度 LogoHeight *int64 `gorm:"default:0;" json:"logo_height"` // logo图最大高度 IsPublic *int64 `gorm:"default:0;" json:"is_public"` // 是否可公用(1:可以,0:不可以) Status *int64 `gorm:"default:0;" json:"status"` // 状态1正常 2异常 Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 - Tag *string `gorm:"default:'';" json:"tag"` // 标签(用户自填) + Tag *string `gorm:"default:'';" json:"tag"` // IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除 - SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息 - GroupOptions *string `gorm:"default:'';" json:"group_options"` // 颜色分组 + SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // + GroupOptions *string `gorm:"default:'';" json:"group_options"` // Version *int64 `gorm:"default:0;" json:"version"` // } type FsProductTemplateV2Model struct { diff --git a/model/gmodel/var_gen.go b/model/gmodel/var_gen.go index 46818f31..905e8301 100644 --- a/model/gmodel/var_gen.go +++ b/model/gmodel/var_gen.go @@ -45,6 +45,7 @@ type AllModelsGen struct { FsLog *FsLogModel // fs_log 日志表 FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库 FsMenu *FsMenuModel // fs_menu 后台菜单 + FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表 FsMigration *FsMigrationModel // fs_migration 版本库 FsOrder *FsOrderModel // fs_order FsOrderAffiliate *FsOrderAffiliateModel // fs_order_affiliate 订单附属表-流程控制时间等 @@ -140,6 +141,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen { FsLog: NewFsLogModel(gdb), FsMapLibrary: NewFsMapLibraryModel(gdb), FsMenu: NewFsMenuModel(gdb), + FsMerchantCategory: NewFsMerchantCategoryModel(gdb), FsMigration: NewFsMigrationModel(gdb), FsOrder: NewFsOrderModel(gdb), FsOrderAffiliate: NewFsOrderAffiliateModel(gdb), diff --git a/server/product/internal/logic/homepagerecommendproductlistlogic.go b/server/product/internal/logic/homepagerecommendproductlistlogic.go index b41c7dd0..e542aec4 100644 --- a/server/product/internal/logic/homepagerecommendproductlistlogic.go +++ b/server/product/internal/logic/homepagerecommendproductlistlogic.go @@ -54,9 +54,10 @@ func (l *HomePageRecommendProductListLogic) HomePageRecommendProductList(req *ty ) //获取列表推荐产品 recommendProductList, _, err = l.svcCtx.AllModels.FsProductRecommend.GetRecommendProductList(gmodel.GetRecommendProductListReq{ - Ctx: l.ctx, - Page: 1, - Limit: 500, //设置最大500 + Ctx: l.ctx, + MerchantType: req.MerchantType, + Page: 1, + Limit: 500, //设置最大500 }) if len(recommendProductList) == 0 { return resp.SetStatusWithMessage(basic.CodeOK, "success", []interface{}{}) diff --git a/server/product/internal/types/types.go b/server/product/internal/types/types.go index 8e718fb7..5cb5c2d4 100644 --- a/server/product/internal/types/types.go +++ b/server/product/internal/types/types.go @@ -342,12 +342,6 @@ type GetSizeByPidRsp struct { type GetTemplateByPidReq struct { Pid string `form:"pid"` ProductTemplateTagId int64 `form:"product_template_tag_id"` - ProductSizeId int64 `form:"product_size_id,optional"` -} - -type GetTemplateByPidRsp struct { - TemplateId int64 `json:"template_id"` //模板id - TemplateInfo interface{} `json:"template_info"` //模板信息 } type GetFittingByPidReq struct { @@ -395,7 +389,8 @@ type GetLastProductDesignRsp struct { } type HomePageRecommendProductListReq struct { - Size uint32 `form:"size"` + Size uint32 `form:"size"` + MerchantType int64 `form:"merchant_type"` } type HomePageRecommendProductListRsp struct { diff --git a/server_api/product.api b/server_api/product.api index e710a978..1f37a789 100644 --- a/server_api/product.api +++ b/server_api/product.api @@ -432,7 +432,8 @@ type GetLastProductDesignRsp { } //获取列表页推荐产品(返回是这个维度数组) type HomePageRecommendProductListReq { - Size uint32 `form:"size"` + Size uint32 `form:"size"` + MerchantType int64 `form:"merchant_type"` } type HomePageRecommendProductListRsp { Id int64 `json:"id"`