上传logo

This commit is contained in:
Hiven 2023-08-02 18:14:53 +08:00
commit 464133be97
3 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@ type FsTags struct {
Description *string `gorm:"default:'';" json:"description"` // 介绍 Seo Description *string `gorm:"default:'';" json:"description"` // 介绍 Seo
RecommendProduct *string `gorm:"default:'';" json:"recommend_product"` // RecommendProduct *string `gorm:"default:'';" json:"recommend_product"` //
RecommendProductSort *string `gorm:"default:'';" json:"recommend_product_sort"` // RecommendProductSort *string `gorm:"default:'';" json:"recommend_product_sort"` //
Category *int64 `gorm:"default:1;" json:"category"` // 分类1前台用的 2后台用的
} }
type FsTagsModel struct { type FsTagsModel struct {
db *gorm.DB db *gorm.DB

View File

@ -36,6 +36,7 @@ type GetAllTagByParamsReq struct {
OrderBy string OrderBy string
LevelPrefixLeftLike string //右模糊 LevelPrefixLeftLike string //右模糊
WithChild bool //是否包含子层级 WithChild bool //是否包含子层级
Category int64
} }
func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByParamsReq) (resp []FsTags, err error) { func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByParamsReq) (resp []FsTags, err error) {
@ -46,6 +47,9 @@ func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByPara
if req.Status != nil { if req.Status != nil {
db = db.Where("`status` = ?", *req.Status) db = db.Where("`status` = ?", *req.Status)
} }
if req.Category != 0 {
db = db.Where("`category` = ?", req.Category)
}
if req.LevelPrefixLeftLike != "" { if req.LevelPrefixLeftLike != "" {
//查询子集 //查询子集
if req.WithChild { if req.WithChild {

View File

@ -50,6 +50,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
Status: &tStatus, Status: &tStatus,
OrderBy: "`sort` DESC", OrderBy: "`sort` DESC",
WithChild: true, //需要子集 WithChild: true, //需要子集
Category: 1, //前台网站用的
} }
//传入分类id //传入分类id
if req.Cid > 0 { if req.Cid > 0 {
@ -62,6 +63,9 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
logx.Error(err) logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get tag info") return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get tag info")
} }
if *tagData.Category != 1 {
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "invalid tag")
}
tReq.LevelPrefixLeftLike = *tagData.LevelPrefix tReq.LevelPrefixLeftLike = *tagData.LevelPrefix
} }
tagList, err := l.svcCtx.AllModels.FsTags.GetAllTagByParams(l.ctx, tReq) tagList, err := l.svcCtx.AllModels.FsTags.GetAllTagByParams(l.ctx, tReq)