From 3a9de995b2f4ec56bec7877abf9985676fb643fe Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 10:49:00 +0800 Subject: [PATCH 01/11] fix --- server/product/internal/logic/gettagproductlistlogic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index afb6c5aa..947e3cf7 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -335,7 +335,7 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL continue } parent.ChildTagList = append(parent.ChildTagList, tagItem) - //排序 + //排序子菜单 sort.SliceStable(parent.ChildTagList, func(i, j int) bool { return parent.ChildTagList[i].Sort < parent.ChildTagList[j].Sort }) @@ -363,7 +363,7 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL productCount += len(mapTagLevel[prefix].TagProductList) rspList = append(rspList, *mapTagLevel[prefix]) } - //排序 + //排序主菜单 sort.SliceStable(rspList, func(i, j int) bool { return rspList[i].Sort < rspList[j].Sort }) From c8e6467e9a3838e74bd3f45262affe33550c7433 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:18:50 +0800 Subject: [PATCH 02/11] fix --- .../internal/logic/gettagproductlistlogic.go | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index 947e3cf7..b084003a 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -132,7 +132,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR return resp.SetStatusAddMessage(basic.CodeServiceErr, "failed to deal with tag data") } //组装等级从属关系 - rspTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel) + rspTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel, productList) return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{ TotalCategoryProduct: TotalCategoryProduct, TagList: rspTagList, @@ -308,7 +308,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) }) //tag中产品 for _, tmpProduct := range productListRsp { - tagTem.TagProductList = append(tagTem.TagProductList, tmpProduct) + tagTem.TagProductList = append(tagTem.TagProductList, tmpProduct.ProductId) } } //加入分类 @@ -318,7 +318,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) } // 组织等级从属关系 -func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem) (rspTagList []types.TagItem, productCount int) { +func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem, productList []gmodel.FsProduct) (rspTagList []types.TagItem, productCount int) { mapTop := make(map[string]struct{}) //设置归属关系 for prefix, tagItem := range mapTagLevel { @@ -341,16 +341,25 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL }) mapTagLevel[parentPrefix] = parent } - //把子类的产品列表变成产品id列表并且把产品列表都放到最顶级父级中 + //父类聚合子类所有产品 for _, v := range mapTagLevel { if _, ok := mapTop[v.LevelPrefix]; ok { continue } - topPrefixSlic := strings.Split(v.LevelPrefix, "/")[:minLevel] - topPrefix := strings.Join(topPrefixSlic, "/") - for k, tmpProduct := range v.TagProductList { - v.TagProductList[k] = tmpProduct.(types.TagProduct).ProductId - mapTagLevel[topPrefix].TagProductList = append(mapTagLevel[topPrefix].TagProductList, tmpProduct) + mapTypeId := make(map[int64]struct{}) + for _, v2 := range mapTagLevel { + //包含主路径,则属于该类型 + if strings.Contains(v2.LevelPrefix, v.LevelPrefix) { + mapTypeId[v2.TypeId] = struct{}{} + } + } + //循环产品放入 + for _, p := range productList { + _, ok := mapTypeId[*p.Type] + if !ok { + continue + } + mapTagLevel[v.LevelPrefix].TagProductList = append(mapTagLevel[v.LevelPrefix].TagProductList, p) } } //最终值提取最高级别那一层出来 From 7883056deda818aaa4207641f9f0aa67260abb79 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:22:11 +0800 Subject: [PATCH 03/11] fix --- server/product/internal/logic/gettagproductlistlogic.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index b084003a..7e8a042d 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -346,6 +346,7 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL if _, ok := mapTop[v.LevelPrefix]; ok { continue } + v.TagProductList = make([]interface{}, 0, 50) mapTypeId := make(map[int64]struct{}) for _, v2 := range mapTagLevel { //包含主路径,则属于该类型 From 501c4643f462bdd2eae62e957fda9aeead6289b4 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:22:34 +0800 Subject: [PATCH 04/11] fix --- server/product/internal/logic/gettagproductlistlogic.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index 7e8a042d..07ad23ab 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -346,6 +346,7 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL if _, ok := mapTop[v.LevelPrefix]; ok { continue } + //顶部需要初始化 v.TagProductList = make([]interface{}, 0, 50) mapTypeId := make(map[int64]struct{}) for _, v2 := range mapTagLevel { From 10e794110f2b6662d9be8a18a99fdf06b44e196a Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:25:38 +0800 Subject: [PATCH 05/11] info address list --- model/gmodel/var.go | 4 ++-- server/auth/internal/logic/userresettokenlogic.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/gmodel/var.go b/model/gmodel/var.go index 9f603ae5..71fd02ff 100644 --- a/model/gmodel/var.go +++ b/model/gmodel/var.go @@ -38,12 +38,12 @@ func FsBool(v bool) *bool { // SubscriptionStatus 订阅状态 type SubscriptionStatus struct { - NotificationEmail *struct { + NotificationEmail struct { OrderUpdate bool `json:"order_update"` Newseleter bool `json:"newseleter"` } `json:"notification_email"` - NotificationPhone *struct { + NotificationPhone struct { OrderUpdate bool `json:"order_update"` Newseleter bool `json:"newseleter"` } `json:"notification_phone"` diff --git a/server/auth/internal/logic/userresettokenlogic.go b/server/auth/internal/logic/userresettokenlogic.go index b7150b9a..61ab8fdb 100644 --- a/server/auth/internal/logic/userresettokenlogic.go +++ b/server/auth/internal/logic/userresettokenlogic.go @@ -39,7 +39,7 @@ func (l *UserResetTokenLogic) UserResetToken(req *types.RequestUserResetToken, u user, err := l.svcCtx.AllModels.FsUser.FindUserByEmail(context.TODO(), req.Email) if err != nil { logx.Error(err) - return resp.SetStatus(basic.CodeRequestParamsErr, err.Error()) + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, err.Error()) } token := &auth.ResetToken{ From 8f8419b8c17305239fa2050158331d88ae2dd86f Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:26:11 +0800 Subject: [PATCH 06/11] fix --- .../internal/logic/gettagproductlistlogic.go | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index 07ad23ab..afb6c5aa 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -132,7 +132,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR return resp.SetStatusAddMessage(basic.CodeServiceErr, "failed to deal with tag data") } //组装等级从属关系 - rspTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel, productList) + rspTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel) return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{ TotalCategoryProduct: TotalCategoryProduct, TagList: rspTagList, @@ -308,7 +308,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) }) //tag中产品 for _, tmpProduct := range productListRsp { - tagTem.TagProductList = append(tagTem.TagProductList, tmpProduct.ProductId) + tagTem.TagProductList = append(tagTem.TagProductList, tmpProduct) } } //加入分类 @@ -318,7 +318,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) } // 组织等级从属关系 -func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem, productList []gmodel.FsProduct) (rspTagList []types.TagItem, productCount int) { +func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem) (rspTagList []types.TagItem, productCount int) { mapTop := make(map[string]struct{}) //设置归属关系 for prefix, tagItem := range mapTagLevel { @@ -335,33 +335,22 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL continue } parent.ChildTagList = append(parent.ChildTagList, tagItem) - //排序子菜单 + //排序 sort.SliceStable(parent.ChildTagList, func(i, j int) bool { return parent.ChildTagList[i].Sort < parent.ChildTagList[j].Sort }) mapTagLevel[parentPrefix] = parent } - //父类聚合子类所有产品 + //把子类的产品列表变成产品id列表并且把产品列表都放到最顶级父级中 for _, v := range mapTagLevel { if _, ok := mapTop[v.LevelPrefix]; ok { continue } - //顶部需要初始化 - v.TagProductList = make([]interface{}, 0, 50) - mapTypeId := make(map[int64]struct{}) - for _, v2 := range mapTagLevel { - //包含主路径,则属于该类型 - if strings.Contains(v2.LevelPrefix, v.LevelPrefix) { - mapTypeId[v2.TypeId] = struct{}{} - } - } - //循环产品放入 - for _, p := range productList { - _, ok := mapTypeId[*p.Type] - if !ok { - continue - } - mapTagLevel[v.LevelPrefix].TagProductList = append(mapTagLevel[v.LevelPrefix].TagProductList, p) + topPrefixSlic := strings.Split(v.LevelPrefix, "/")[:minLevel] + topPrefix := strings.Join(topPrefixSlic, "/") + for k, tmpProduct := range v.TagProductList { + v.TagProductList[k] = tmpProduct.(types.TagProduct).ProductId + mapTagLevel[topPrefix].TagProductList = append(mapTagLevel[topPrefix].TagProductList, tmpProduct) } } //最终值提取最高级别那一层出来 @@ -374,7 +363,7 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL productCount += len(mapTagLevel[prefix].TagProductList) rspList = append(rspList, *mapTagLevel[prefix]) } - //排序主菜单 + //排序 sort.SliceStable(rspList, func(i, j int) bool { return rspList[i].Sort < rspList[j].Sort }) From 5b483dadb51a066be304a90f7415c301155fc0a3 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:36:09 +0800 Subject: [PATCH 07/11] info nofitycation --- model/gmodel/var.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/gmodel/var.go b/model/gmodel/var.go index 71fd02ff..fca355d3 100644 --- a/model/gmodel/var.go +++ b/model/gmodel/var.go @@ -44,8 +44,8 @@ type SubscriptionStatus struct { } `json:"notification_email"` NotificationPhone struct { - OrderUpdate bool `json:"order_update"` - Newseleter bool `json:"newseleter"` + // OrderUpdate bool `json:"order_update"` + Newseleter bool `json:"newseleter"` } `json:"notification_phone"` } From 77cb2591244917b5438f61a99549a59df860d16d Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:49:04 +0800 Subject: [PATCH 08/11] fix --- .../internal/logic/gettagproductlistlogic.go | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index afb6c5aa..c71d45e2 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -113,10 +113,12 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR mapTagLevel := make(map[string]*types.TagItem) //处理tags数据 minLevel := 0 //层级最高层(即prefix层级路径最短) + mapTagProduct := make(map[int64]types.TagProduct) if err = l.dealWithTagMenuData(dealWithTagMenuDataReq{ TagList: tagList, WithProduct: req.WithProduct, ProductList: productList, + MapTagProduct: mapTagProduct, MapTagProp: mapTagProp, MapProductMinPrice: mapProductMinPrice, MapProductTemplate: mapProductTemplate, @@ -132,7 +134,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR return resp.SetStatusAddMessage(basic.CodeServiceErr, "failed to deal with tag data") } //组装等级从属关系 - rspTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel) + rspTagList, TotalCategoryProduct := l.organizationLevelRelation(minLevel, mapTagLevel, productList, mapTagProduct) return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetTagProductListRsp{ TotalCategoryProduct: TotalCategoryProduct, TagList: rspTagList, @@ -262,6 +264,7 @@ type dealWithTagMenuDataReq struct { TagList []gmodel.FsTags WithProduct bool ProductList []gmodel.FsProduct + MapTagProduct map[int64]types.TagProduct MapTagProp map[int64][]types.CoverDefaultItem ProductTagPropList []gmodel.FsProductTagProp MapProductMinPrice map[int64]int64 @@ -308,7 +311,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) }) //tag中产品 for _, tmpProduct := range productListRsp { - tagTem.TagProductList = append(tagTem.TagProductList, tmpProduct) + tagTem.TagProductList = append(tagTem.TagProductList, tmpProduct.ProductId) } } //加入分类 @@ -318,7 +321,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) } // 组织等级从属关系 -func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem) (rspTagList []types.TagItem, productCount int) { +func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagLevel map[string]*types.TagItem, productList []gmodel.FsProduct, mapTagProduct map[int64]types.TagProduct) (rspTagList []types.TagItem, productCount int) { mapTop := make(map[string]struct{}) //设置归属关系 for prefix, tagItem := range mapTagLevel { @@ -346,11 +349,24 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL if _, ok := mapTop[v.LevelPrefix]; ok { continue } - topPrefixSlic := strings.Split(v.LevelPrefix, "/")[:minLevel] - topPrefix := strings.Join(topPrefixSlic, "/") - for k, tmpProduct := range v.TagProductList { - v.TagProductList[k] = tmpProduct.(types.TagProduct).ProductId - mapTagLevel[topPrefix].TagProductList = append(mapTagLevel[topPrefix].TagProductList, tmpProduct) + //初始化 + v.TagProductList = make([]interface{}, 0, 20) + mapTypeId := make(map[int64]struct{}) + for _, v2 := range mapTagLevel { + if strings.Contains(v2.LevelPrefix, v.LevelPrefix) { + mapTypeId[v.TypeId] = struct{}{} + } + } + for _, p := range productList { + _, ok := mapTypeId[*p.Type] + if !ok { + continue + } + tagProduct, ok := mapTagProduct[p.Id] + if !ok { + continue + } + v.TagProductList = append(v.TagProductList, tagProduct) } } //最终值提取最高级别那一层出来 From 543099c8d7ab233c56c110077c6a2f669dcab8f9 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:52:54 +0800 Subject: [PATCH 09/11] fix --- server/product/internal/logic/gettagproductlistlogic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index c71d45e2..73d75f9c 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -344,9 +344,9 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL }) mapTagLevel[parentPrefix] = parent } - //把子类的产品列表变成产品id列表并且把产品列表都放到最顶级父级中 + //顶层集子类产品于一身 for _, v := range mapTagLevel { - if _, ok := mapTop[v.LevelPrefix]; ok { + if _, ok := mapTop[v.LevelPrefix]; !ok { continue } //初始化 From c6fa875148c183ed0bfc4df237f73588a227da1e Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 11:55:44 +0800 Subject: [PATCH 10/11] email limit & password limit --- server/auth/internal/logic/useremailregisterlogic.go | 4 ++++ server/auth/internal/logic/userregisterlogic.go | 4 ++++ server/auth/internal/logic/userresetpasswordlogic.go | 4 ++++ utils/auth/register.go | 2 +- utils/basic/basic.go | 1 + 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/server/auth/internal/logic/useremailregisterlogic.go b/server/auth/internal/logic/useremailregisterlogic.go index 60e66a2c..edc2d10c 100644 --- a/server/auth/internal/logic/useremailregisterlogic.go +++ b/server/auth/internal/logic/useremailregisterlogic.go @@ -47,6 +47,10 @@ func (l *UserEmailRegisterLogic) UserEmailRegister(req *types.RequestEmailRegist return resp.SetStatus(basic.CodeOAuthEmailErr) } + if len(req.Email) > 50 { + return resp.SetStatusWithMessage(basic.CodeOAuthEmailErr, "email len must < 50") + } + if !TimeLimit.Is(req.Email) { return resp.SetStatus(basic.CodeEmailTimeShortErr) } diff --git a/server/auth/internal/logic/userregisterlogic.go b/server/auth/internal/logic/userregisterlogic.go index d9ed3fa3..45f0d73c 100644 --- a/server/auth/internal/logic/userregisterlogic.go +++ b/server/auth/internal/logic/userregisterlogic.go @@ -41,6 +41,10 @@ func (l *UserRegisterLogic) UserRegister(req *types.RequestUserRegister, userinf return resp.SetStatus(basic.CodeOAuthEmailErr) } + if len(req.Email) > 50 { + return resp.SetStatusWithMessage(basic.CodeOAuthEmailErr, "email len must < 50") + } + // _, err := l.svcCtx.AllModels.FsUser.FindUserByEmail(l.ctx, req.Email) // if err == nil { // return resp.SetStatus(basic.CodeEmailExistsErr) diff --git a/server/auth/internal/logic/userresetpasswordlogic.go b/server/auth/internal/logic/userresetpasswordlogic.go index aa9ab591..cc7a55a2 100644 --- a/server/auth/internal/logic/userresetpasswordlogic.go +++ b/server/auth/internal/logic/userresetpasswordlogic.go @@ -39,6 +39,10 @@ func (l *UserResetPasswordLogic) UserResetPassword(req *types.RequestUserResetPa // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) // userinfo 传入值时, 一定不为null + if len(req.NewPassword) > 30 { + return resp.SetStatusWithMessage(basic.CodePasswordErr, "password len must < 30") + } + rt, err := l.svcCtx.ResetTokenManger.Decrypt(req.ResetToken) // ResetToken if err != nil { logx.Error(err) diff --git a/utils/auth/register.go b/utils/auth/register.go index dec96fb2..3531a3be 100644 --- a/utils/auth/register.go +++ b/utils/auth/register.go @@ -118,7 +118,7 @@ func ValidateEmail(email string) bool { // ValidatePassword checks if the provided password is strong enough. // In this example, we just check if the password length is 8 or more. func ValidatePassword(password string) bool { - const minPasswordLength = 8 + const minPasswordLength = 30 return len(password) >= minPasswordLength } diff --git a/utils/basic/basic.go b/utils/basic/basic.go index 8ce30032..3621d6bb 100644 --- a/utils/basic/basic.go +++ b/utils/basic/basic.go @@ -58,6 +58,7 @@ var ( CodeEmailExistsErr = &StatusResponse{5053, "email exists"} // email存在 CodeEmailTimeShortErr = &StatusResponse{5053, "email with the time of resend is too short"} // email重发的时间太短 CodeResetPasswordErr = &StatusResponse{5054, "reset password error"} // 无效密码 + CodeEmailErr = &StatusResponse{5054, "email error"} CodeSafeValueRangeErr = &StatusResponse{5040, "value not in range"} // 值不在范围内 CodeTemplateErr = &StatusResponse{5040, "template parsed error"} // 模板解析错误 From b86d6748b48936c01c35f182cc8ae5c68b2408a9 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 11 Oct 2023 12:10:08 +0800 Subject: [PATCH 11/11] fix --- server/product/internal/logic/gettagproductlistlogic.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index 73d75f9c..ef025139 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -312,6 +312,7 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq) //tag中产品 for _, tmpProduct := range productListRsp { tagTem.TagProductList = append(tagTem.TagProductList, tmpProduct.ProductId) + req.MapTagProduct[tmpProduct.ProductId] = tmpProduct } } //加入分类 @@ -354,7 +355,7 @@ func (l *GetTagProductListLogic) organizationLevelRelation(minLevel int, mapTagL mapTypeId := make(map[int64]struct{}) for _, v2 := range mapTagLevel { if strings.Contains(v2.LevelPrefix, v.LevelPrefix) { - mapTypeId[v.TypeId] = struct{}{} + mapTypeId[v2.TypeId] = struct{}{} } } for _, p := range productList {