Browse Source

Merge branch 'dev/v1.1.21_wh' of BaseService/jyMicroservices into feature/v1.1.21

王浩 2 years ago
parent
commit
b28e4d02fd

+ 26 - 26
jyBXSubscribe/api/bxsubscribe.api

@@ -10,32 +10,32 @@ info (
 type (
 	//订阅列表
 	subscribeReq {
-		AppId          string `header:"appId"`
-		UserId         string `header:"userId"`
-		EntId          string `header:"entId,optional"`
-		EntUserId      string `header:"entUserId,optional"`
-		DeptId         string `header:"deptId,optional"` //部门id
-		PageNum        int64  `json:"pageNum,optional"`
-		PageSize       int64  `json:"pageSize,optional"`
-		SelectTime     string `json:"selectTime,optional"`
-		Area           string `json:"area,optional"`
-		City           string `json:"city,optional"`
-		Industry       string `json:"industry,optional"`
-		BuyerClass     string `json:"buyerClass,optional"`
-		KeyWords       string `json:"keyWords,optional"`
-		Subtype        string `json:"subtype,optional"`
-		Price          string `json:"price,optional"`
-		FileExists     string `json:"fileExists,optional"`
-		Source         string `json:"source,optional"`                                        //信息来源
-		IsRead         string `json:"isRead,optional"`                                        //是否已读
-		Staffs         string `json:"staffs,optional"`                                        //分发的员工
-		UserType       string `path:"userType,default=fType,options=fType|vType|mType|eType"` //fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户;
-		NewUserId      int64  `header:"newUserId"`
-		IsEnt          bool   `json:"isEnt,optional"`
-		SelectIds      string `json:"selectIds,optional"`
-		PositionType   int64  `header:"positionType,optional"`
-		NotReturnCount int64  `json:"notReturnCount,optional"`
-		Item           string `json:"item,optional"`
+		AppId          string                 `header:"appId"`
+		UserId         string                 `header:"userId"`
+		EntId          string                 `header:"entId,optional"`
+		EntUserId      string                 `header:"entUserId,optional"`
+		DeptId         string                 `header:"deptId,optional"` //部门id
+		PageNum        int64                  `json:"pageNum,optional"`
+		PageSize       int64                  `json:"pageSize,optional"`
+		SelectTime     string                 `json:"selectTime,optional"`
+		Area           string                 `json:"area,optional"`
+		City           string                 `json:"city,optional"`
+		Industry       string                 `json:"industry,optional"`
+		BuyerClass     string                 `json:"buyerClass,optional"`
+		KeyWords       string                 `json:"keyWords,optional"`
+		Subtype        string                 `json:"subtype,optional"`
+		Price          string                 `json:"price,optional"`
+		FileExists     string                 `json:"fileExists,optional"`
+		Source         string                 `json:"source,optional"`                                        //信息来源
+		IsRead         string                 `json:"isRead,optional"`                                        //是否已读
+		Staffs         string                 `json:"staffs,optional"`                                        //分发的员工
+		UserType       string                 `path:"userType,default=fType,options=fType|vType|mType|eType"` //fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户;
+		NewUserId      int64                  `header:"newUserId"`
+		IsEnt          bool                   `json:"isEnt,optional"`
+		SelectIds      string                 `json:"selectIds,optional"`
+		PositionType   int64                  `header:"positionType,optional"`
+		NotReturnCount int64                  `json:"notReturnCount,optional"`
+		Item           map[string]interface{} `json:"item,optional"`
 	}
 	//
 	someInfoReq {

+ 27 - 2
jyBXSubscribe/api/internal/logic/byPushHistoryLogic.go

@@ -1,8 +1,10 @@
 package logic
 
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	"context"
 	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"strings"
 
 	"jyBXSubscribe/api/internal/svc"
 	"jyBXSubscribe/api/internal/types"
@@ -25,6 +27,29 @@ func NewByPushHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ByP
 }
 
 func (l *ByPushHistoryLogic) ByPushHistory(req *types.SubscribeReq) (resp *types.CommonResp, err error) {
+	//关键词处理
+	//分类
+	matchitemsArr := []string{}
+	matchitems := ""
+	//关键词
+	matchkeysArr := []string{}
+	matchkeys := ""
+	if req.PositionType == 0 {
+		for k, v := range req.Item {
+			if common.InterfaceToStr(v) == "" {
+				matchitemsArr = append(matchitemsArr, common.InterfaceToStr(v))
+			} else {
+				matchkeysArr = append(matchkeysArr, common.InterfaceToStr(k))
+			}
+		}
+		if len(matchitemsArr) == 0 {
+			matchkeys = strings.Join(matchkeysArr, ",")
+		} else {
+			matchitems = strings.Join(matchitemsArr, ",")
+		}
+	} else {
+		matchkeys = req.KeyWords
+	}
 	res, err := l.svcCtx.Suscribe.ByPushHistory(l.ctx, &bxsubscribe.SubscribeInfosReq{
 		PageNum:        req.PageNum,
 		PageSize:       req.PageSize,
@@ -33,7 +58,7 @@ func (l *ByPushHistoryLogic) ByPushHistory(req *types.SubscribeReq) (resp *types
 		City:           req.City,
 		Industry:       req.Industry,
 		BuyerClass:     req.BuyerClass,
-		KeyWords:       req.KeyWords,
+		KeyWords:       matchkeys,
 		Subtype:        req.Subtype,
 		UserType:       req.UserType,
 		Price:          req.Price,
@@ -50,7 +75,7 @@ func (l *ByPushHistoryLogic) ByPushHistory(req *types.SubscribeReq) (resp *types
 		SelectIds:      req.SelectIds,
 		PositionType:   req.PositionType,
 		NotReturnCount: req.NotReturnCount,
-		Item:           req.Item,
+		Item:           matchitems,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 49 - 22
jyBXSubscribe/api/internal/logic/subscribeListLogic.go

@@ -1,11 +1,13 @@
 package logic
 
 import (
+	"app.yhyue.com/moapp/jybase/common"
 	"context"
 	"jyBXSubscribe/api/internal/svc"
 	"jyBXSubscribe/api/internal/types"
 	"jyBXSubscribe/rpc/type/bxsubscribe"
 	"net/http"
+	"strings"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -27,29 +29,54 @@ func NewSubscribeListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *h
 }
 
 func (l *SubscribeListLogic) SubscribeList(req *types.SubscribeReq) (resp *types.CommonResp, err error) {
+	//关键词处理
+	//分类
+	matchitemsArr := []string{}
+	matchitems := ""
+	//关键词
+	matchkeysArr := []string{}
+	matchkeys := ""
+	if req.PositionType == 0 {
+		for k, v := range req.Item {
+			if common.InterfaceToStr(v) == "" {
+				matchitemsArr = append(matchitemsArr, common.InterfaceToStr(v))
+			} else {
+				matchkeysArr = append(matchkeysArr, common.InterfaceToStr(k))
+			}
+		}
+		if len(matchitemsArr) == 0 {
+			matchkeys = strings.Join(matchkeysArr, ",")
+		} else {
+			matchitems = strings.Join(matchitemsArr, ",")
+		}
+	} else {
+		matchkeys = req.KeyWords
+	}
 	res, err := l.svcCtx.Suscribe.GetSubList(l.ctx, &bxsubscribe.SubscribeInfosReq{
-		PageNum:      req.PageNum,
-		PageSize:     req.PageSize,
-		SelectTime:   req.SelectTime,
-		Area:         req.Area,
-		City:         req.City,
-		Industry:     req.Industry,
-		BuyerClass:   req.BuyerClass,
-		KeyWords:     req.KeyWords,
-		Subtype:      req.Subtype,
-		UserType:     req.UserType,
-		Price:        req.Price,
-		FileExists:   req.FileExists,
-		IsRead:       req.IsRead,
-		Source:       req.Source,
-		Staffs:       req.Staffs,
-		UserId:       req.UserId,
-		EntId:        req.EntId,
-		EntUserId:    req.EntUserId,
-		DeptId:       req.DeptId,
-		NewUserId:    req.NewUserId,
-		IsEnt:        req.IsEnt,
-		PositionType: req.PositionType,
+		PageNum:        req.PageNum,
+		PageSize:       req.PageSize,
+		SelectTime:     req.SelectTime,
+		Area:           req.Area,
+		City:           req.City,
+		Industry:       req.Industry,
+		BuyerClass:     req.BuyerClass,
+		KeyWords:       matchkeys,
+		Subtype:        req.Subtype,
+		UserType:       req.UserType,
+		Price:          req.Price,
+		FileExists:     req.FileExists,
+		IsRead:         req.IsRead,
+		Source:         req.Source,
+		Staffs:         req.Staffs,
+		UserId:         req.UserId,
+		EntId:          req.EntId,
+		EntUserId:      req.EntUserId,
+		DeptId:         req.DeptId,
+		NewUserId:      req.NewUserId,
+		IsEnt:          req.IsEnt,
+		PositionType:   req.PositionType,
+		NotReturnCount: req.NotReturnCount,
+		Item:           matchitems,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 26 - 26
jyBXSubscribe/api/internal/types/types.go

@@ -2,32 +2,32 @@
 package types
 
 type SubscribeReq struct {
-	AppId          string `header:"appId"`
-	UserId         string `header:"userId"`
-	EntId          string `header:"entId,optional"`
-	EntUserId      string `header:"entUserId,optional"`
-	DeptId         string `header:"deptId,optional"` //部门id
-	PageNum        int64  `json:"pageNum,optional"`
-	PageSize       int64  `json:"pageSize,optional"`
-	SelectTime     string `json:"selectTime,optional"`
-	Area           string `json:"area,optional"`
-	City           string `json:"city,optional"`
-	Industry       string `json:"industry,optional"`
-	BuyerClass     string `json:"buyerClass,optional"`
-	KeyWords       string `json:"keyWords,optional"`
-	Subtype        string `json:"subtype,optional"`
-	Price          string `json:"price,optional"`
-	FileExists     string `json:"fileExists,optional"`
-	Source         string `json:"source,optional"`                                        //信息来源
-	IsRead         string `json:"isRead,optional"`                                        //是否已读
-	Staffs         string `json:"staffs,optional"`                                        //分发的员工
-	UserType       string `path:"userType,default=fType,options=fType|vType|mType|eType"` //fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户;
-	NewUserId      int64  `header:"newUserId"`
-	IsEnt          bool   `json:"isEnt,optional"`
-	SelectIds      string `json:"selectIds,optional"`
-	PositionType   int64  `header:"positionType,optional"`
-	NotReturnCount int64  `json:"notReturnCount,optional"`
-	Item           string `json:"item,optional"`
+	AppId          string                 `header:"appId"`
+	UserId         string                 `header:"userId"`
+	EntId          string                 `header:"entId,optional"`
+	EntUserId      string                 `header:"entUserId,optional"`
+	DeptId         string                 `header:"deptId,optional"` //部门id
+	PageNum        int64                  `json:"pageNum,optional"`
+	PageSize       int64                  `json:"pageSize,optional"`
+	SelectTime     string                 `json:"selectTime,optional"`
+	Area           string                 `json:"area,optional"`
+	City           string                 `json:"city,optional"`
+	Industry       string                 `json:"industry,optional"`
+	BuyerClass     string                 `json:"buyerClass,optional"`
+	KeyWords       string                 `json:"keyWords,optional"`
+	Subtype        string                 `json:"subtype,optional"`
+	Price          string                 `json:"price,optional"`
+	FileExists     string                 `json:"fileExists,optional"`
+	Source         string                 `json:"source,optional"`                                        //信息来源
+	IsRead         string                 `json:"isRead,optional"`                                        //是否已读
+	Staffs         string                 `json:"staffs,optional"`                                        //分发的员工
+	UserType       string                 `path:"userType,default=fType,options=fType|vType|mType|eType"` //fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户;
+	NewUserId      int64                  `header:"newUserId"`
+	IsEnt          bool                   `json:"isEnt,optional"`
+	SelectIds      string                 `json:"selectIds,optional"`
+	PositionType   int64                  `header:"positionType,optional"`
+	NotReturnCount int64                  `json:"notReturnCount,optional"`
+	Item           map[string]interface{} `json:"item,optional"`
 }
 
 type SomeInfoReq struct {

+ 13 - 13
jyBXSubscribe/rpc/bxsubscribe.proto

@@ -28,8 +28,8 @@ message SubscribeInfosReq {
   bool IsEnt = 22;
   string SelectIds = 23;
   int64 positionType = 24;
-  int64 notReturnCount=25;
-  string item=26;
+  int64 notReturnCount = 25;
+  string item = 26;
 }
 
 message SubscribeInfosResp {
@@ -275,8 +275,8 @@ message UserStatus {
   int64 isvisit = 3;
   string visittime = 4;
   string date = 5;
-  string phone =6;
-  int64 source =7;
+  string phone = 6;
+  int64 source = 7;
 }
 message GetUserInfoReq{
   string  appId = 1;
@@ -296,8 +296,8 @@ message GetUserInfo{
   string mail = 1;
   int64  state = 2;
   string imgUrl = 3;
-  string appUrl=4;
-  bool   showWx=5;
+  string appUrl = 4;
+  bool   showWx = 5;
 }
 message SetUserInfoReq{
   string  appId = 1;
@@ -320,7 +320,7 @@ message GetPushSetReq{
 
 message GetPushSetResp{
   map<string, PushSet> data = 1;
-  map<int64,TimeJson> timeData=3;
+  map<int64, TimeJson> timeData = 3;
   string error_msg = 4;
   int64 error_code = 5;
 }
@@ -334,8 +334,8 @@ message PushSet{
   int64 i_mailpush = 4;
   int64 i_ratemode = 5;
   int64 isWxShow = 6;
-  int64 interested=7;
-  int64 isMailShow=8;
+  int64 interested = 7;
+  int64 isMailShow = 8;
 }
 message SetPushSetReq{
   string appId = 1;
@@ -360,14 +360,14 @@ message StaffSubscribeReq {
   int64 eStatus = 6;
   int64 pStatus = 7;
   int64 pageNum = 8;
-  int64 pageSize =9;
+  int64 pageSize = 9;
 }
 
 
 message StaffSubscribeListResp {
   int64 err_code = 1;
   string err_msg = 2;
-  int64 total =3;
+  int64 total = 3;
   repeated StaffSubscribe items = 4;
 }
 message StaffSubscribe {
@@ -381,13 +381,13 @@ message StaffSubscribe {
 message StaffSubscribeDetailReq{
   int64  entId = 1;
   int64  entUserId = 2;
-  string  token =3;
+  string  token = 3;
 }
 
 message StaffSubscribeDetail{
   int64 err_code = 1;
   string err_msg = 2;
-  bytes  data =3;
+  bytes  data = 3;
 }
 
 

+ 7 - 13
jyBXSubscribe/rpc/model/push.go

@@ -496,19 +496,13 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		//关键词
 		find_in_set := []string{}
 		if spqp.PositionType == 0 {
-			if spqp.Item != "" {
-				keyMap := make(map[string][]string)
-				json.Unmarshal([]byte(spqp.Key), &keyMap)
-				for k, v := range keyMap {
-					if len(v) == 0 {
-						//关键词分类名称搜索
-						find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchitems,'+',','),' ',','))", k))
-					} else {
-						//关键词搜索
-						for _, v := range v {
-							find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchkeys,'+',','),' ',','))", v))
-						}
-					}
+			if spqp.Item == "" {
+				for _, v := range strings.Split(spqp.Key, ",") {
+					find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchkeys,'+',','),' ',','))", v))
+				}
+			} else {
+				for _, v := range strings.Split(spqp.Item, ",") {
+					find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchitems,'+',','),' ',','))", v))
 				}
 			}
 		} else {