Просмотр исходного кода

fix:未登录用户供应检索数量限制

duxin 1 год назад
Родитель
Сommit
f32534cda5
3 измененных файлов с 9 добавлено и 0 удалено
  1. 7 0
      api/internal/logic/supplysearchlogic.go
  2. 1 0
      api/internal/types/types.go
  3. 1 0
      api/jyinfo.api

+ 7 - 0
api/internal/logic/supplysearchlogic.go

@@ -27,6 +27,13 @@ func NewSupplySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Supp
 }
 
 func (l *SupplySearchLogic) SupplySearch(req *types.PubSupplyInfoReq) (resp *types.CommonRes, err error) {
+	if req.UserId == "" { //未登录用户每次搜索100条数据
+		req.PageIndex = common.Int64All(common.If(req.PageIndex == 0, 1, req.PageIndex))
+		if req.PageIndex*req.PageSize > 100 {
+			req.PageIndex = 1
+			req.PageSize = 100
+		}
+	}
 	supplySearch, err0 := l.svcCtx.Consumer.SupplyInfoSearch(l.ctx, &consumerinfo.SupplyInfoSearchReq{
 		Keywords:   req.Keywords,
 		SearchType: req.SearchType,

+ 1 - 0
api/internal/types/types.go

@@ -92,6 +92,7 @@ type AssProjecctReq struct {
 }
 
 type PubSupplyInfoReq struct {
+	UserId     string `header:"userId,optional"`
 	Keywords   string `json:"keywords"`
 	SearchType string `json:"searchType"`
 	Province   string `json:"province,optional"`

+ 1 - 0
api/jyinfo.api

@@ -83,6 +83,7 @@ type (
 		Type    int64  `json:"type,optional"`
 	}
 	pubSupplyInfoReq {
+		UserId     string `header:"userId,optional"`
 		Keywords   string `json:"keywords"`
 		SearchType string `json:"searchType"`
 		Province   string `json:"province,optional"`