소스 검색

fenzhihebing

lianbingjie 1 년 전
부모
커밋
fae8a4144a

+ 60 - 32
jyBXSubscribe/api/bxsubscribe.api

@@ -1,10 +1,10 @@
 syntax = "v1"
 
 info (
-	title: "剑鱼标讯" // TODO: add title
-	desc: "订阅模块"// TODO: add description
+	title:  "剑鱼标讯" // TODO: add title
+	desc:   "订阅模块" // TODO: add description
 	author: "wangshan"
-	email: "wangshan@topnet.net.cn"
+	email:  "wangshan@topnet.net.cn"
 )
 
 type (
@@ -26,9 +26,9 @@ type (
 		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"`                                        //分发的员工
+		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"`
@@ -41,6 +41,7 @@ type (
 		PositionId     string                 `header:"positionId,optional"`
 		MgoUserId      string                 `header:"mgoUserId,optional"` //原userId
 		District       string                 `json:"district,optional"`
+		Stag           string                 `json:"stag,optional"` // home
 	}
 	//
 	someInfoReq {
@@ -62,16 +63,16 @@ type (
 	}
 	//
 	subscribeUpdateReq {
-		Area            map[string]interface{}   `json:"area,optional"`            //地区
-		Buyerclass      []string                 `json:"buyerclass,optional"`      //采购单位类型
-		Items           []map[string]interface{} `json:"items,optional"`           //关键词
-		Infotype        []string                 `json:"infotype,optional"`        //信息类型
-		Matchway        string                   `json:"matchway,optional"`        //匹配方式 1标题 2正文
-		Projectmatch    string                   `json:"projectmatch,optional"`    //项目匹配 1开始 0关闭
-		Ratemode        string                   `json:"ratemode,optional"`        // 1:实时推送,2:每天9点推送,3:每周推送,4:每月推送 5:每日推送两次
-		Apppush         string                   `json:"apppush,optional"`         //app推送 1开启 0关闭
-		Mailpush        string                   `json:"mailpush,optional"`        //邮箱推送 1开启 0关闭
-		Mail            string                   `json:"mail,optional"`            //邮箱
+		Area            map[string]interface{}   `json:"area,optional"` //地区
+		Buyerclass      []string                 `json:"buyerclass,optional"` //采购单位类型
+		Items           []map[string]interface{} `json:"items,optional"` //关键词
+		Infotype        []string                 `json:"infotype,optional"` //信息类型
+		Matchway        string                   `json:"matchway,optional"` //匹配方式 1标题 2正文
+		Projectmatch    string                   `json:"projectmatch,optional"` //项目匹配 1开始 0关闭
+		Ratemode        string                   `json:"ratemode,optional"` // 1:实时推送,2:每天9点推送,3:每周推送,4:每月推送 5:每日推送两次
+		Apppush         string                   `json:"apppush,optional"` //app推送 1开启 0关闭
+		Mailpush        string                   `json:"mailpush,optional"` //邮箱推送 1开启 0关闭
+		Mail            string                   `json:"mail,optional"` //邮箱
 		Otherbuyerclass string                   `json:"otherbuyerclass,optional"` //匹配未分类类型 1匹配 0不匹配
 		AppId           string                   `header:"appId,optional"`
 		UserType        string                   `path:"userType,optional"`
@@ -191,7 +192,6 @@ type (
 		Err_msg  string      `json:"error_msg"`
 		Data     interface{} `json:"data"`
 	}
-
 	BidDistributor {
 		AppId     string   `header:"appId"`
 		EntId     string   `header:"entId,optional"`
@@ -199,38 +199,66 @@ type (
 		Infoids   []string `json:"infoids"`
 		Staffs    string   `json:"staffs"`
 	}
+	BidRecListReq {
+		AppId        string `header:"appId"`
+		UserId       string `header:"userId"`
+		EntId        string `header:"entId,optional"`
+		EntUserId    string `header:"entUserId,optional"`
+		Spath        string `json:"spath"` // 页面入口,1: 订阅更多;2:模版消息
+		PositionType int64  `header:"positionType,optional"`
+	}
 )
+
 service bxsubscribe-api {
 	@handler subscribeList
-	post /jybx/subscribe/:userType/list(subscribeReq) returns (commonResp)
+	post /jybx/subscribe/:userType/list (subscribeReq) returns (commonResp)
+
 	@handler someInfo
-	post /jybx/subscribe/:userType/someInfo(someInfoReq) returns (commonResp)
+	post /jybx/subscribe/:userType/someInfo (someInfoReq) returns (commonResp)
+
 	@handler subscribeUpdate
-	post /jybx/subscribe/:userType/update(subscribeUpdateReq) returns (commonResp)
+	post /jybx/subscribe/:userType/update (subscribeUpdateReq) returns (commonResp)
+
 	@handler ByPushHistory
-	post /jybx/subscribe/:userType/byPushHistory(subscribeReq) returns (commonResp)
+	post /jybx/subscribe/:userType/byPushHistory (subscribeReq) returns (commonResp)
+
 	@handler SetRead
-	post /jybx/subscribe/:userType/setRead(SetReadReq) returns (commonResp)
+	post /jybx/subscribe/:userType/setRead (SetReadReq) returns (commonResp)
+
 	@handler getKey
-	post /jybx/subscribe/:userType/getKey(GetKeyReq) returns (commonResp)
+	post /jybx/subscribe/:userType/getKey (GetKeyReq) returns (commonResp)
+
 	@handler distributor
-	post /jybx/subscribe/:userType/distributor(DistributorReq) returns (commonResp)
+	post /jybx/subscribe/:userType/distributor (DistributorReq) returns (commonResp)
+
 	@handler viewStatus
-	post /jybx/subscribe/:userType/viewStatus(viewStatusReq) returns (commonResp)
+	post /jybx/subscribe/:userType/viewStatus (viewStatusReq) returns (commonResp)
+
 	@handler msgDistributor
-	post /jybx/subscribe/msgDistributor(msgDistributor) returns (commonResp)
+	post /jybx/subscribe/msgDistributor (msgDistributor) returns (commonResp)
+
 	@handler getUser //查询用户信息
 	post /jybx/subscribe/getUser (GetUserReq) returns (commonResp)
-	@handler setUser  //设置用户信息
+
+	@handler setUser //设置用户信息
 	post /jybx/subscribe/setUser (SetUserReq) returns (commonResp)
-	@handler getPushSet  //推送设置查询
+
+	@handler getPushSet //推送设置查询
 	post /jybx/subscribe/getPushSet (GetUserReq) returns (commonResp)
-	@handler setPushSet  //推送设置修改
+
+	@handler setPushSet //推送设置修改
 	post /jybx/subscribe/setPushSet (SetPushSetReq) returns (commonResp)
+
 	@handler getStaffSubscribeList //查询企业员工订阅状态
 	post /jybx/subscribe/getStaffSubscribe (GetStaffSubscribeListReq) returns (StaffSubscribeCommonResp)
+
 	@handler getStaffSubscribeDetail //查询企业员工订阅详情
 	post /jybx/subscribe/getStaffSubscribeDetail (GetStaffSubscribeDetailReq) returns (StaffSubscribeCommonResp)
-	@handler bidDistributor  //标讯分发
-	post /jybx/subscribe/bidDistributor(BidDistributor) returns (commonResp)
-}
+
+	@handler bidDistributor //标讯分发
+	post /jybx/subscribe/bidDistributor (BidDistributor) returns (commonResp)
+
+	@handler bidRecList // 订阅推荐列表
+	post /jybx/subscribe/getRecList (BidRecListReq) returns (commonResp)
+}
+

+ 28 - 0
jyBXSubscribe/api/internal/handler/bidRecListHandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"jyBXSubscribe/api/internal/logic"
+	"jyBXSubscribe/api/internal/svc"
+	"jyBXSubscribe/api/internal/types"
+)
+
+func bidRecListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.BidRecListReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewBidRecListLogic(r.Context(), svcCtx)
+		resp, err := l.BidRecList(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 33 - 28
jyBXSubscribe/api/internal/handler/routes.go

@@ -14,23 +14,23 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 		[]rest.Route{
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/:userType/list",
-				Handler: subscribeListHandler(serverCtx),
+				Path:    "/jybx/subscribe/:userType/byPushHistory",
+				Handler: ByPushHistoryHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/:userType/someInfo",
-				Handler: someInfoHandler(serverCtx),
+				Path:    "/jybx/subscribe/:userType/distributor",
+				Handler: distributorHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/:userType/update",
-				Handler: subscribeUpdateHandler(serverCtx),
+				Path:    "/jybx/subscribe/:userType/getKey",
+				Handler: getKeyHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/:userType/byPushHistory",
-				Handler: ByPushHistoryHandler(serverCtx),
+				Path:    "/jybx/subscribe/:userType/list",
+				Handler: subscribeListHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -39,13 +39,13 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/:userType/getKey",
-				Handler: getKeyHandler(serverCtx),
+				Path:    "/jybx/subscribe/:userType/someInfo",
+				Handler: someInfoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/:userType/distributor",
-				Handler: distributorHandler(serverCtx),
+				Path:    "/jybx/subscribe/:userType/update",
+				Handler: subscribeUpdateHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -54,18 +54,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/msgDistributor",
-				Handler: msgDistributorHandler(serverCtx),
-			},
-			{
-				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/getUser",
-				Handler: getUserHandler(serverCtx),
-			},
-			{
-				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/setUser",
-				Handler: setUserHandler(serverCtx),
+				Path:    "/jybx/subscribe/bidDistributor",
+				Handler: bidDistributorHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -74,8 +64,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/setPushSet",
-				Handler: setPushSetHandler(serverCtx),
+				Path:    "/jybx/subscribe/getRecList",
+				Handler: bidRecListHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -89,8 +79,23 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/jybx/subscribe/bidDistributor",
-				Handler: bidDistributorHandler(serverCtx),
+				Path:    "/jybx/subscribe/getUser",
+				Handler: getUserHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/msgDistributor",
+				Handler: msgDistributorHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/setPushSet",
+				Handler: setPushSetHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/setUser",
+				Handler: setUserHandler(serverCtx),
 			},
 		},
 	)

+ 43 - 0
jyBXSubscribe/api/internal/logic/bidRecListLogic.go

@@ -0,0 +1,43 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/bxsubscribe"
+
+	"jyBXSubscribe/api/internal/svc"
+	"jyBXSubscribe/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type BidRecListLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewBidRecListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BidRecListLogic {
+	return &BidRecListLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *BidRecListLogic) BidRecList(req *types.BidRecListReq) (resp *types.CommonResp, err error) {
+	res, err := l.svcCtx.Suscribe.BidRecList(l.ctx, &bxsubscribe.BidRecListReq{
+		AppId:        req.AppId,
+		EntId:        req.EntId,
+		SPath:        req.Spath,
+		UserId:       req.UserId,
+		EntUserId:    req.EntUserId,
+		PositionType: req.PositionType,
+	})
+	return &types.CommonResp{
+		Err_code: res.ErrCode,
+		Err_msg:  res.ErrMsg,
+		Data:     res.Data,
+	}, err
+
+	return
+}

+ 1 - 0
jyBXSubscribe/api/internal/logic/subscribeListLogic.go

@@ -83,6 +83,7 @@ func (l *SubscribeListLogic) SubscribeList(req *types.SubscribeReq) (resp *types
 		PositionId:     req.PositionId,
 		MgoUserId:      req.MgoUserId,
 		District:       req.District,
+		Stag:           req.Stag,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 141 - 55
jyBXSubscribe/api/internal/types/types.go

@@ -1,6 +1,7 @@
 // Code generated by goctl. DO NOT EDIT.
 package types
 
+<<<<<<< HEAD
 type SubscribeReq struct {
 	AppId          string                 `header:"appId"`
 	UserId         string                 `header:"userId"`
@@ -77,21 +78,35 @@ type SubscribeUpdateReq struct {
 	ISwitch         int64                    `json:"iSwitch,optional"`
 	Amount          string                   `json:"amount,optional"`
 	Matchmode       string                   `json:"matchmode,optional"`
+=======
+type BidDistributor struct {
+	AppId     string   `header:"appId"`
+	EntId     string   `header:"entId,optional"`
+	EntUserId string   `header:"entUserId,optional"`
+	Infoids   []string `json:"infoids"`
+	Staffs    string   `json:"staffs"`
+>>>>>>> master
 }
 
-type SetReadReq struct {
+type BidRecListReq 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
-	Vsid         int64  `form:"vsid"`
-	NewUserId    int64  `header:"newUserId"`
-	IsEnt        bool   `form:"isEnt,optional"`
-	UserType     string `path:"userType,optional"`
+	Spath        string `json:"spath"` // 页面入口,1: 订阅更多;2:模版消息
 	PositionType int64  `header:"positionType,optional"`
 }
 
+type DistributorReq struct {
+	AppId     string `header:"appId"`
+	EntId     string `header:"entId,optional"`
+	EntUserId string `header:"entUserId,optional"`
+	UserType  string `path:"userType,optional"`
+	Region    string `json:"region,optional"`
+	SelectIds string `json:"selectIds,optional"`
+	QueryType string `json:"queryType,optional"`
+}
+
 type GetKeyReq struct {
 	AppId        string `header:"appId"`
 	UserId       string `header:"userId"`
@@ -108,30 +123,22 @@ type GetKeyReq struct {
 	PositionType int64  `header:"positionType,optional"`
 }
 
-type DistributorReq struct {
-	AppId     string `header:"appId"`
-	EntId     string `header:"entId,optional"`
-	EntUserId string `header:"entUserId,optional"`
-	UserType  string `path:"userType,optional"`
-	Region    string `json:"region,optional"`
-	SelectIds string `json:"selectIds,optional"`
-	QueryType string `json:"queryType,optional"`
-}
-
-type ViewStatusReq struct {
+type GetStaffSubscribeDetailReq struct {
 	AppId     string `header:"appId"`
-	EntId     string `header:"entId,optional"`
-	EntUserId string `header:"entUserId,optional"`
-	UserType  string `path:"userType,optional"`
-	InfoId    string `json:"infoId,optional"`
+	EntId     int64  `header:"entId,optional"`
+	EntUserId int64  `header:"entUserId,optional"`
+	Token     string `json:"token,optional"`
 }
 
-type MsgDistributor struct {
+type GetStaffSubscribeListReq struct {
 	AppId     string `header:"appId"`
-	EntId     string `header:"entId,optional"`
-	EntUserId string `header:"entUserId,optional"`
-	MessageId string `json:"messageId"`
-	Staffs    string `json:"staffs"`
+	EntId     int64  `header:"entId,optional"`
+	EntUserId int64  `header:"entUserId,optional"`
+	EStatus   int64  `json:"e_status,optional"`
+	PStatus   int64  `json:"p_status,optional"`
+	Search    string `json:"search,optional"`
+	PageNum   int64  `json:"pageNum,optional"`
+	PageSize  int64  `json:"pageSize,optional"`
 }
 
 type GetUserReq struct {
@@ -147,15 +154,6 @@ type GetUserReq struct {
 	MgoUserId    string `header:"mgoUserId,optional"` //原userId
 }
 
-type SetUserReq struct {
-	AppId        string `header:"appId"`
-	EntId        int64  `header:"entId,optional"`
-	EntUserId    int64  `header:"entUserId,optional"`
-	PositionType int64  `header:"positionType,optional"`
-	UserId       string `header:"userId,optional"`
-	Mail         string `json:"mail,optional"`
-}
-
 type SetPushSetReq struct {
 	AppId        string   `header:"appId"`
 	EntId        int64    `header:"entId,optional"`
@@ -171,22 +169,26 @@ type SetPushSetReq struct {
 	Interested   int64    `json:"interested,optional"`
 }
 
-type GetStaffSubscribeListReq struct {
-	AppId     string `header:"appId"`
-	EntId     int64  `header:"entId,optional"`
-	EntUserId int64  `header:"entUserId,optional"`
-	EStatus   int64  `json:"e_status,optional"`
-	PStatus   int64  `json:"p_status,optional"`
-	Search    string `json:"search,optional"`
-	PageNum   int64  `json:"pageNum,optional"`
-	PageSize  int64  `json:"pageSize,optional"`
+type SetReadReq 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
+	Vsid         int64  `form:"vsid"`
+	NewUserId    int64  `header:"newUserId"`
+	IsEnt        bool   `form:"isEnt,optional"`
+	UserType     string `path:"userType,optional"`
+	PositionType int64  `header:"positionType,optional"`
 }
 
-type GetStaffSubscribeDetailReq struct {
-	AppId     string `header:"appId"`
-	EntId     int64  `header:"entId,optional"`
-	EntUserId int64  `header:"entUserId,optional"`
-	Token     string `json:"token,optional"`
+type SetUserReq struct {
+	AppId        string `header:"appId"`
+	EntId        int64  `header:"entId,optional"`
+	EntUserId    int64  `header:"entUserId,optional"`
+	PositionType int64  `header:"positionType,optional"`
+	UserId       string `header:"userId,optional"`
+	Mail         string `json:"mail,optional"`
 }
 
 type StaffSubscribeCommonResp struct {
@@ -195,10 +197,94 @@ type StaffSubscribeCommonResp struct {
 	Data     interface{} `json:"data"`
 }
 
-type BidDistributor struct {
-	AppId     string   `header:"appId"`
-	EntId     string   `header:"entId,optional"`
-	EntUserId string   `header:"entUserId,optional"`
-	Infoids   []string `json:"infoids"`
-	Staffs    string   `json:"staffs"`
+type CommonResp struct {
+	Err_code int64       `json:"error_code"`
+	Err_msg  string      `json:"error_msg"`
+	Data     interface{} `json:"data"`
+	TimeData interface{} `json:"timeData"`
+}
+
+type MsgDistributor struct {
+	AppId     string `header:"appId"`
+	EntId     string `header:"entId,optional"`
+	EntUserId string `header:"entUserId,optional"`
+	MessageId string `json:"messageId"`
+	Staffs    string `json:"staffs"`
+}
+
+type SomeInfoReq struct {
+	AppId        string `header:"appId"`
+	UserType     string `path:"userType"`
+	UserId       string `header:"userId,optional"`
+	NewUserId    string `header:"newUserId,optional"`
+	EntId        string `header:"entId,optional"`
+	AccountId    string `header:"accountId,optional"`
+	PositionType string `header:"positionType,optional"`
+	PositionId   string `header:"positionId,optional"`
+}
+
+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"`
+	SelectKeys     string                 `json:"selectKeys,optional"`
+	PositionType   int64                  `header:"positionType,optional"`
+	NotReturnCount int64                  `json:"notReturnCount,optional"`
+	Item           map[string]interface{} `json:"item,optional"`
+	AccountId      string                 `header:"accountId,optional"`
+	PositionId     string                 `header:"positionId,optional"`
+	MgoUserId      string                 `header:"mgoUserId,optional"` //原userId
+	District       string                 `json:"district,optional"`
+	Stag           string                 `json:"stag,optional"` // home
+}
+
+type SubscribeUpdateReq struct {
+	Area            map[string]interface{}   `json:"area,optional"`            //地区
+	Buyerclass      []string                 `json:"buyerclass,optional"`      //采购单位类型
+	Items           []map[string]interface{} `json:"items,optional"`           //关键词
+	Infotype        []string                 `json:"infotype,optional"`        //信息类型
+	Matchway        string                   `json:"matchway,optional"`        //匹配方式 1标题 2正文
+	Projectmatch    string                   `json:"projectmatch,optional"`    //项目匹配 1开始 0关闭
+	Ratemode        string                   `json:"ratemode,optional"`        // 1:实时推送,2:每天9点推送,3:每周推送,4:每月推送 5:每日推送两次
+	Apppush         string                   `json:"apppush,optional"`         //app推送 1开启 0关闭
+	Mailpush        string                   `json:"mailpush,optional"`        //邮箱推送 1开启 0关闭
+	Mail            string                   `json:"mail,optional"`            //邮箱
+	Otherbuyerclass string                   `json:"otherbuyerclass,optional"` //匹配未分类类型 1匹配 0不匹配
+	AppId           string                   `header:"appId,optional"`
+	UserType        string                   `path:"userType,optional"`
+	UserId          string                   `header:"userId,optional"`
+	PositionType    int64                    `header:"positionType,optional"`
+	NewUserId       int64                    `header:"newUserId,optional"`
+	EntId           int64                    `header:"entId,optional"`
+	AccountId       int64                    `header:"accountId,optional"`
+	PositionId      int64                    `header:"positionId,optional"`
+	District        map[string]interface{}   `json:"district,optional"`
+}
+
+type ViewStatusReq struct {
+	AppId     string `header:"appId"`
+	EntId     string `header:"entId,optional"`
+	EntUserId string `header:"entUserId,optional"`
+	UserType  string `path:"userType,optional"`
+	InfoId    string `json:"infoId,optional"`
 }

+ 4 - 5
jyBXSubscribe/entity/db.go

@@ -6,7 +6,6 @@ type Mongo struct {
 	Bidding *MongoStruct `json:"bidding,optional"`
 }
 
-//
 type MongoStruct struct {
 	Address        string `json:"address"`
 	Size           int    `json:"size"`
@@ -19,14 +18,14 @@ type MongoStruct struct {
 	MaxIdleConns   int    `json:"maxIdleConns,optional"`
 }
 
-//
 type Mysql struct {
 	Main             *MysqlStruct `json:"main,omitempty"`
 	BaseService      *MysqlStruct `json:"baseService,omitempty"`
 	GlobalCommonData *MysqlStruct `json:"globalCommonData,omitempty"`
+	JyCk             *MysqlStruct `json:"jyCk"`
 }
 
-//mysql
+// mysql
 type MysqlStruct struct {
 	DbName       string `json:"dbName"`
 	Address      string `json:"address"`
@@ -36,12 +35,12 @@ type MysqlStruct struct {
 	MaxIdleConns int    `json:"maxIdleConns"`
 }
 
-//redis
+// redis
 type RedisStuct struct {
 	Addr []string `json:"addr"`
 }
 
-//es
+// es
 type EsStruct struct {
 	Addr     string `json:"addr"`
 	Size     int    `json:"size"`

+ 5 - 1
jyBXSubscribe/go.mod

@@ -3,11 +3,12 @@ module jyBXSubscribe
 go 1.19
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20240205092729-2959d78b7619
+	app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66
 	app.yhyue.com/moapp/jylogx v0.0.0-20230522075659-ae6fbedb92bc
 	app.yhyue.com/moapp/jypkg v1.1.7
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20231115092908-cb4608f3a96d
+	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 	github.com/go-sql-driver/mysql v1.7.1
 	github.com/gogf/gf/v2 v2.0.6
 	github.com/zeromicro/go-zero v1.5.3
@@ -79,13 +80,16 @@ require (
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic/v7 v7.0.22 // indirect
 	github.com/openzipkin/zipkin-go v0.4.1 // indirect
+	github.com/paulmach/orb v0.7.1 // indirect
 	github.com/pelletier/go-toml/v2 v2.0.8 // indirect
+	github.com/pierrec/lz4/v4 v4.1.17 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
 	github.com/prometheus/client_golang v1.15.1 // indirect
 	github.com/prometheus/client_model v0.3.0 // indirect
 	github.com/prometheus/common v0.42.0 // indirect
 	github.com/prometheus/procfs v0.9.0 // indirect
 	github.com/rivo/uniseg v0.2.0 // indirect
+	github.com/shopspring/decimal v1.3.1 // indirect
 	github.com/sirupsen/logrus v1.8.3 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/spf13/afero v1.9.3 // indirect

+ 7 - 2
jyBXSubscribe/go.sum

@@ -9,8 +9,8 @@ app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jybase v0.0.0-20240205092729-2959d78b7619 h1:rzjJ4pK1P+DcoOYA4+hCOJUoLdSInQa3EHsYY2DKWqA=
-app.yhyue.com/moapp/jybase v0.0.0-20240205092729-2959d78b7619/go.mod h1:fjaD11Z3FIk9EyfOpdKAMQNs7nPZCpT/qKIw1oVsb9w=
+app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66 h1:kCRYqzclN4dtGuGC89ID2w5lGrJgqZC8bNL8mRR+tiU=
+app.yhyue.com/moapp/jybase v0.0.0-20240226084952-7e7b38ef8a66/go.mod h1:XHNATN6tsJKHdCB0DbUtFdPPHXexTUFyB3RlO+lUUoM=
 app.yhyue.com/moapp/jylog v0.0.0-20230522075550-05d7230ca545 h1:+Lak4m1zgsigQloOsvp8AJ+0XeX/+PGp9QP550xlbBQ=
 app.yhyue.com/moapp/jylog v0.0.0-20230522075550-05d7230ca545/go.mod h1:uFrsdUBFbETiJlEmr4PtJWPsZlUpPj2bHQRhryu6ggk=
 app.yhyue.com/moapp/jylogx v0.0.0-20230522075659-ae6fbedb92bc h1:QEwc+V6ZTvk3VMFiMgPYJpsAVqRvTeIMupVfpO5PQYk=
@@ -94,6 +94,7 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
 github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
 github.com/ClickHouse/clickhouse-go v1.5.1/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
 github.com/ClickHouse/clickhouse-go v1.5.4/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
+github.com/ClickHouse/clickhouse-go/v2 v2.2.0 h1:dj00TDKY+xwuTJdbpspCSmTLFyWzRJerTHwaBxut1C0=
 github.com/ClickHouse/clickhouse-go/v2 v2.2.0/go.mod h1:8f2XZUi7XoeU+uPIytSi1cvx8fmJxi7vIgqpvYTF1+o=
 github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
 github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
@@ -689,6 +690,7 @@ github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0
 github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
 github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A=
 github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM=
+github.com/paulmach/orb v0.7.1 h1:Zha++Z5OX/l168sqHK3k4z18LDvr+YAO/VjK0ReQ9rU=
 github.com/paulmach/orb v0.7.1/go.mod h1:FWRlTgl88VI1RBx/MkrwWDRhQ96ctqMCh8boXhmqB/A=
 github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=
 github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
@@ -700,6 +702,8 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
 github.com/pierrec/lz4 v2.5.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
 github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
 github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
+github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc=
+github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -769,6 +773,7 @@ github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q
 github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
 github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
 github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
+github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
 github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
 github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
 github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=

+ 3 - 4
jyBXSubscribe/rpc/bxsubscribe.go

@@ -7,16 +7,15 @@ import (
 	logrusx "app.yhyue.com/moapp/jylogx/logx"
 	"flag"
 	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gcfg"
+	"github.com/zeromicro/go-zero/core/conf"
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/internal/server"
 	"jyBXSubscribe/rpc/internal/svc"
 	"jyBXSubscribe/rpc/type/bxsubscribe"
 	"log"
 
-	"github.com/gogf/gf/v2/frame/g"
-	"github.com/gogf/gf/v2/os/gcfg"
-	"github.com/zeromicro/go-zero/core/conf"
-
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/service"
 	"github.com/zeromicro/go-zero/zrpc"

+ 21 - 7
jyBXSubscribe/rpc/bxsubscribe.proto

@@ -35,6 +35,7 @@ message SubscribeInfosReq {
   string item = 29;
   string selectKeys = 30;
   string district = 31;
+  string stag = 32;
 }
 
 message SubscribeInfosResp {
@@ -47,6 +48,7 @@ message subscribeData{
   int64 count = 1;
   bool hasNextPage = 2;
   repeated subscribeInfo list = 3;
+  string isRecommend = 4;
 }
 
 message subscribeInfo {
@@ -82,9 +84,9 @@ message subscribeInfo {
   int64 bidendTime = 30;// 投标截止日期
   repeated WinnerInfo winnerInfo = 31;// 中标企业信息
   string spiderCode = 33;//网站代码
-  string city =34; //城市
-  string toptype =35; //一级信息类型
-  bool isValidFile =36; //是否有附件
+  string city = 34; //城市
+  string toptype = 35; //一级信息类型
+  bool isValidFile = 36; //是否有附件
   string sourceAll = 37; //来源;1:个人订阅 2:企业自动分发 3:企业手动分发 多个
 }
 //
@@ -139,8 +141,8 @@ message UpdateSubScribeInfoReq{
   bytes subSet = 1;//订阅设置
   string userId = 2;//用户id
   int64  PositionType = 3;
-  int64 positionId =4;
-  int64 baseUserId=5;
+  int64 positionId = 4;
+  int64 baseUserId = 5;
 }
 
 //城市
@@ -346,8 +348,9 @@ message PushSet{
   int64 i_ratemode = 5;
   int64 isWxShow = 6;
   int64 interested = 7;
-  int64 i_nomsgtip=9;
-  int64 i_apppush_tip=10;
+  int64 isMailShow = 8;
+  int64 i_nomsgtip = 9;
+  int64 i_apppush_tip = 10;
 }
 message SetPushSetReq{
   string appId = 1;
@@ -410,6 +413,15 @@ message BidDistributorReq{
   string  staffs = 5; //分发的员工
 }
 
+message BidRecListReq {
+  string  appId = 1;
+  string  entId = 2;
+  string  sPath = 3;
+  string  userId = 4;
+  string  entUserId = 5;
+  int64  positionType = 6;
+}
+
 
 service Bxsubscribe {
   //获取订阅推送列表
@@ -446,4 +458,6 @@ service Bxsubscribe {
   rpc getStaffSubscribeDetail(StaffSubscribeDetailReq)returns(StaffSubscribeDetail);
   //标讯信息分发
   rpc bidDistributor(BidDistributorReq)returns(StatusResp);
+  // 订阅推荐列表
+  rpc bidRecList(BidRecListReq)returns(SubscribeInfosResp);
 }

+ 9 - 0
jyBXSubscribe/rpc/bxsubscribe/bxsubscribe.go

@@ -14,6 +14,7 @@ import (
 
 type (
 	BidDistributorReq       = bxsubscribe.BidDistributorReq
+	BidRecListReq           = bxsubscribe.BidRecListReq
 	ByPushHistoryResp       = bxsubscribe.ByPushHistoryResp
 	CityList                = bxsubscribe.CityList
 	DistributorResp         = bxsubscribe.DistributorResp
@@ -94,6 +95,8 @@ type (
 		GetStaffSubscribeDetail(ctx context.Context, in *StaffSubscribeDetailReq, opts ...grpc.CallOption) (*StaffSubscribeDetail, error)
 		// 标讯信息分发
 		BidDistributor(ctx context.Context, in *BidDistributorReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 订阅推荐列表
+		BidRecList(ctx context.Context, in *BidRecListReq, opts ...grpc.CallOption) (*SubscribeInfosResp, error)
 	}
 
 	defaultBxsubscribe struct {
@@ -208,3 +211,9 @@ func (m *defaultBxsubscribe) BidDistributor(ctx context.Context, in *BidDistribu
 	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
 	return client.BidDistributor(ctx, in, opts...)
 }
+
+// 订阅推荐列表
+func (m *defaultBxsubscribe) BidRecList(ctx context.Context, in *BidRecListReq, opts ...grpc.CallOption) (*SubscribeInfosResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.BidRecList(ctx, in, opts...)
+}

+ 10 - 3
jyBXSubscribe/rpc/etc/db.yaml

@@ -1,9 +1,9 @@
 mysql:
     main:
         dbName: jianyu
-        address: jymysql.jydev.jy360.cn:33066
-        userName: jianyu
-        password: Topnet123
+        address: 192.168.3.14:4000
+        userName: root
+        password: '=PDT49#80Z!RVv52_z'
         maxOpenConns: 5
         maxIdleConns: 5
     baseService:
@@ -20,6 +20,13 @@ mysql:
         password: '=PDT49#80Z!RVv52_z'
         maxOpenConns: 5
         maxIdleConns: 5
+    jyCk:
+        address: 192.168.3.207:19000
+        dbName: jianyu
+        userName: jytop
+        password: 'pwdTopJy123'
+        maxOpenConns: 5
+        maxIdleConns: 5
 redis:
     addr:
         - other=192.168.3.149:1712

+ 8 - 5
jyBXSubscribe/rpc/init/db.go

@@ -4,14 +4,15 @@
 package init
 
 import (
+	"fmt"
 	"strings"
 
 	elastic "app.yhyue.com/moapp/jybase/es"
 	P "app.yhyue.com/moapp/jybase/mapping"
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/middleground"
+	_ "github.com/ClickHouse/clickhouse-go/v2"
 	"github.com/zeromicro/go-zero/core/logx"
-
 	"jyBXSubscribe/entity"
 
 	"app.yhyue.com/moapp/jybase/mongodb"
@@ -26,11 +27,11 @@ var (
 	MgoBidding       mongodb.MongodbSim
 	GlobalCommonData *mysql.Mysql
 	MgoLog           mongodb.MongodbSim
+	CkJy             *mysql.Mysql
 )
 var Middleground *middleground.Middleground
 var Compatible *compatible.Compatible
 
-//
 func MongoDBInit(em *entity.Mongo) {
 	//初始化 mongodb
 	if em.Main.Address != "" {
@@ -68,7 +69,6 @@ func MongoDBInit(em *entity.Mongo) {
 	}
 }
 
-//
 func MysqlInit(mm *entity.Mysql) {
 	//初始化 mysql-main
 	if mm.Main.Address != "" {
@@ -109,10 +109,14 @@ func MysqlInit(mm *entity.Mysql) {
 		}
 		GlobalCommonData.Init()
 	}
+	if mm.JyCk.Address != "" {
+		logx.Info("--初始化 jy clickhouse--")
+		CkJy = mysql.NewInit(mysql.CLICKHOUSE, fmt.Sprintf("clickhouse://%s:%s@%s/%s", mm.JyCk.UserName, mm.JyCk.Password, mm.JyCk.Address, mm.JyCk.DbName),
+			mm.JyCk.MaxOpenConns, mm.JyCk.MaxIdleConns)
+	}
 	P.BidCodeMapping.Init(BaseServiceMysql)
 }
 
-//
 func RedisInit(rm *entity.RedisStuct) {
 	//初始化 redis
 	if len(rm.Addr) > 0 {
@@ -121,7 +125,6 @@ func RedisInit(rm *entity.RedisStuct) {
 	}
 }
 
-//
 func EsInit(es *entity.EsStruct) {
 	//初始化 elasticsearch
 	if es.Addr != "" {

+ 43 - 0
jyBXSubscribe/rpc/internal/logic/bidreclistlogic.go

@@ -0,0 +1,43 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"context"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/model"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type BidRecListLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewBidRecListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BidRecListLogic {
+	return &BidRecListLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 订阅推荐列表
+func (l *BidRecListLogic) BidRecList(in *bxsubscribe.BidRecListReq) (*bxsubscribe.SubscribeInfosResp, error) {
+	var list []*bxsubscribe.SubscribeInfo
+	hasNextPage, total, list := model.NewSubscribePush("").SubRecList(common.ObjToString(common.If(in.PositionType == 0, in.UserId, in.EntUserId)), []model.ViewKeyWord{})
+	//if len(list) == 0 && in.SPath == "1" { // 订阅更多
+	//	hasNextPage, total, list = model.NewSubscribePush("").GetRecListByEs()
+	//}
+	return &bxsubscribe.SubscribeInfosResp{
+		ErrCode: 0,
+		ErrMsg:  "",
+		Data: &bxsubscribe.SubscribeData{
+			List:        list,
+			Count:       total,
+			HasNextPage: hasNextPage,
+		},
+	}, nil
+}

+ 13 - 0
jyBXSubscribe/rpc/internal/logic/getsublistlogic.go

@@ -115,9 +115,21 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 	 *免费用户默认推送50条
 	 *大会员、新版商机管理、超级订阅用户 默认推送1000条记录
 	 */
+	isRecommend := "1" //1:老数据 2:历史(clickhouse) 3:新数据
 	if in.PageNum == 1 && spqp.IsEmpty() && (len(list) == 0 || (in.PositionType == 0 && spqp.SubPushInactive == -1)) && in.IsEnt == false {
 		hasNextPage, total, list = model.NewSubscribePush(in.UserType).DefaultDatas(spqp, bsp, in.UserType)
+		if in.Stag == "home" {
+			if len(list) == 0 {
+				isRecommend = "2"
+				hasNextPage, total, list = model.NewSubscribePush(in.UserType).SubRecList(common.ObjToString(common.If(in.PositionType == 0, spqp.UserId, spqp.EntUserId)), bsp.Keyword)
+			}
+			if len(list) == 0 {
+				isRecommend = "3"
+				hasNextPage, total, list = model.NewSubscribePush(in.UserType).GetRecListByEs()
+			}
+		}
 	}
+
 	start2 := time.Now().Unix()
 	logx.Info("2、查询数据用户", start2-start1)
 	//查询是否收藏
@@ -130,6 +142,7 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 			List:        list,
 			Count:       total,
 			HasNextPage: hasNextPage,
+			IsRecommend: isRecommend,
 		},
 	}, nil
 }

+ 6 - 0
jyBXSubscribe/rpc/internal/server/bxsubscribeserver.go

@@ -123,3 +123,9 @@ func (s *BxsubscribeServer) BidDistributor(ctx context.Context, in *bxsubscribe.
 	l := logic.NewBidDistributorLogic(ctx, s.svcCtx)
 	return l.BidDistributor(in)
 }
+
+// 订阅推荐列表
+func (s *BxsubscribeServer) BidRecList(ctx context.Context, in *bxsubscribe.BidRecListReq) (*bxsubscribe.SubscribeInfosResp, error) {
+	l := logic.NewBidRecListLogic(ctx, s.svcCtx)
+	return l.BidRecList(in)
+}

+ 71 - 0
jyBXSubscribe/rpc/model/push.go

@@ -2239,3 +2239,74 @@ func (s *SubPushQueryParam) ExportPushFormat() (ids, keyWords []string) {
 	}
 	return
 }
+
+// @Author jianghan
+// @Description	clickhouse获取推荐的列表数据
+// @Date 2024/3/11
+func (s *subscribePush) SubRecList(userId string, keyword []ViewKeyWord) (hasNextPage bool, total int64, resultList []*bxsubscribe.SubscribeInfo) {
+	sql := "select bitmapToArray(infoids) infoids, userid from jianyu.sub_recommend_list where userid = ?"
+	infos := IC.CkJy.SelectBySql(sql, userId)
+	if infos != nil && len(*infos) > 0 {
+		if ids, ok := (*infos)[0]["infoids"].([]uint64); ok && len(ids) > 0 {
+			length := len(ids)
+			resultList = make([]*bxsubscribe.SubscribeInfo, length)
+			esq := `{"query": {"bool": {"must": [{"terms": {"autoid": [` + strings.Join(gconv.Strings(ids), ",") + ` ]}}]}}}`
+			binfo := elastic.GetAllByNgram(INDEX, TYPE, esq, findfields, bidSort, bidField, 0, 100, length, false)
+			if binfo != nil && len(*binfo) > 0 {
+				for i, m := range *binfo {
+					title := strings.Replace(common.ObjToString(m["title"]), " ", "", -1)
+					matchkeys := getKeys(title, keyword)
+					resultList[i] = s.InfoFormat(&PushCa{
+						InfoId:     mongodb.BsonIdToSId(m["_id"]),
+						Date:       time.Now().Unix(),
+						Keys:       matchkeys,
+						FileExists: m["filetext"] != nil,
+					}, &m, false)
+				}
+			}
+			total = int64(len(resultList))
+			if total > pageSize {
+				resultList = resultList[:pageSize]
+				hasNextPage = true
+			}
+		}
+	}
+	return
+}
+
+// @Author jianghan
+// @Description es获取最新10条数据
+// @Date 2024/3/13
+func (s *subscribePush) GetRecListByEs() (hasNextPage bool, total int64, resultList []*bxsubscribe.SubscribeInfo) {
+	resultList = make([]*bxsubscribe.SubscribeInfo, 10)
+	if jsonStr := redis.GetStr("pushcache_2_c", "bid_sub_recommend"); jsonStr != "" {
+		var data []map[string]interface{}
+		_ = json.Unmarshal([]byte(jsonStr), &data)
+		for i := 0; i < 10; i++ {
+			resultList[i] = s.InfoFormat(&PushCa{
+				InfoId:     common.ObjToString(data[i]["_id"]),
+				Date:       time.Now().Unix(),
+				Keys:       []string{},
+				FileExists: data[i]["filetext"] != nil,
+			}, &data[i], false)
+		}
+	} else {
+		qstr := `{"query": {"bool": {"must": [{"match_all": {}}]}}}`
+		list := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSort, bidField, 0, 10, 10, false)
+		redis.Put("pushcache_2_c", "bid_sub_recommend", 1, 86400)
+		for i := 0; i < len(*list); i++ {
+			resultList[i] = s.InfoFormat(&PushCa{
+				InfoId:     common.ObjToString((*list)[i]["_id"]),
+				Date:       time.Now().Unix(),
+				Keys:       []string{},
+				FileExists: (*list)[i]["filetext"] != nil,
+			}, &(*list)[i], false)
+		}
+	}
+	total = int64(len(resultList))
+	if total > pageSize {
+		resultList = resultList[:pageSize]
+		hasNextPage = true
+	}
+	return
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 693 - 473
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go


+ 40 - 1
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.3.0
-// - protoc             v3.15.1
+// - protoc             v4.25.2
 // source: bxsubscribe.proto
 
 //import "google/protobuf/struct.proto";
@@ -38,6 +38,7 @@ const (
 	Bxsubscribe_GetStaffSubscribeList_FullMethodName   = "/bxsubscribe.Bxsubscribe/getStaffSubscribeList"
 	Bxsubscribe_GetStaffSubscribeDetail_FullMethodName = "/bxsubscribe.Bxsubscribe/getStaffSubscribeDetail"
 	Bxsubscribe_BidDistributor_FullMethodName          = "/bxsubscribe.Bxsubscribe/bidDistributor"
+	Bxsubscribe_BidRecList_FullMethodName              = "/bxsubscribe.Bxsubscribe/bidRecList"
 )
 
 // BxsubscribeClient is the client API for Bxsubscribe service.
@@ -78,6 +79,8 @@ type BxsubscribeClient interface {
 	GetStaffSubscribeDetail(ctx context.Context, in *StaffSubscribeDetailReq, opts ...grpc.CallOption) (*StaffSubscribeDetail, error)
 	// 标讯信息分发
 	BidDistributor(ctx context.Context, in *BidDistributorReq, opts ...grpc.CallOption) (*StatusResp, error)
+	// 订阅推荐列表
+	BidRecList(ctx context.Context, in *BidRecListReq, opts ...grpc.CallOption) (*SubscribeInfosResp, error)
 }
 
 type bxsubscribeClient struct {
@@ -241,6 +244,15 @@ func (c *bxsubscribeClient) BidDistributor(ctx context.Context, in *BidDistribut
 	return out, nil
 }
 
+func (c *bxsubscribeClient) BidRecList(ctx context.Context, in *BidRecListReq, opts ...grpc.CallOption) (*SubscribeInfosResp, error) {
+	out := new(SubscribeInfosResp)
+	err := c.cc.Invoke(ctx, Bxsubscribe_BidRecList_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // BxsubscribeServer is the server API for Bxsubscribe service.
 // All implementations must embed UnimplementedBxsubscribeServer
 // for forward compatibility
@@ -279,6 +291,8 @@ type BxsubscribeServer interface {
 	GetStaffSubscribeDetail(context.Context, *StaffSubscribeDetailReq) (*StaffSubscribeDetail, error)
 	// 标讯信息分发
 	BidDistributor(context.Context, *BidDistributorReq) (*StatusResp, error)
+	// 订阅推荐列表
+	BidRecList(context.Context, *BidRecListReq) (*SubscribeInfosResp, error)
 	mustEmbedUnimplementedBxsubscribeServer()
 }
 
@@ -337,6 +351,9 @@ func (UnimplementedBxsubscribeServer) GetStaffSubscribeDetail(context.Context, *
 func (UnimplementedBxsubscribeServer) BidDistributor(context.Context, *BidDistributorReq) (*StatusResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method BidDistributor not implemented")
 }
+func (UnimplementedBxsubscribeServer) BidRecList(context.Context, *BidRecListReq) (*SubscribeInfosResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method BidRecList not implemented")
+}
 func (UnimplementedBxsubscribeServer) mustEmbedUnimplementedBxsubscribeServer() {}
 
 // UnsafeBxsubscribeServer may be embedded to opt out of forward compatibility for this service.
@@ -656,6 +673,24 @@ func _Bxsubscribe_BidDistributor_Handler(srv interface{}, ctx context.Context, d
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Bxsubscribe_BidRecList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(BidRecListReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BxsubscribeServer).BidRecList(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: Bxsubscribe_BidRecList_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BxsubscribeServer).BidRecList(ctx, req.(*BidRecListReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Bxsubscribe_ServiceDesc is the grpc.ServiceDesc for Bxsubscribe service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -731,6 +766,10 @@ var Bxsubscribe_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "bidDistributor",
 			Handler:    _Bxsubscribe_BidDistributor_Handler,
 		},
+		{
+			MethodName: "bidRecList",
+			Handler:    _Bxsubscribe_BidRecList_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "bxsubscribe.proto",

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.