Bladeren bron

Merge branch 'feature/v1.1.49' into dev/v1.1.49_wjh

* feature/v1.1.49:
  订阅设置新增字段处理
  xg
  xg
  xg
  xg
  pc首页
  协议文件提交
  配置文件提交
  是否是推荐处理
  xg
  xg
  no message
  xg
  测试
  xg
  xg
  xg
  p432需求
Jianghan 1 jaar geleden
bovenliggende
commit
e0acc060c7

+ 15 - 0
jyBXSubscribe/api/bxsubscribe.api

@@ -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 {
@@ -82,6 +83,9 @@ type (
 		AccountId       int64                    `header:"accountId,optional"`
 		PositionId      int64                    `header:"positionId,optional"`
 		District        map[string]interface{}   `json:"district,optional"`
+		ISwitch         int64                    `json:"iSwitch,optional"`
+		Amount          string                   `json:"amount,optional"`
+		Matchmode       string                   `json:"matchmode,optional"`
 	}
 	SetReadReq {
 		AppId        string `header:"appId"`
@@ -195,6 +199,14 @@ 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 {
@@ -245,5 +257,8 @@ service bxsubscribe-api {
 
 	@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)
+		}
+	}
+}

+ 5 - 0
jyBXSubscribe/api/internal/handler/routes.go

@@ -62,6 +62,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/jybx/subscribe/getPushSet",
 				Handler: getPushSetHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/getRecList",
+				Handler: bidRecListHandler(serverCtx),
+			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/jybx/subscribe/getStaffSubscribe",

+ 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{

+ 3 - 0
jyBXSubscribe/api/internal/logic/subscribeupdatelogic.go

@@ -52,6 +52,9 @@ func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (r
 		Mail:            req.Mail,
 		Otherbuyerclass: req.Otherbuyerclass,
 		District:        req.District,
+		Amount:          req.Amount,
+		ISwitch:         req.ISwitch,
+		Matchmode:       req.Matchmode,
 	}
 	fmt.Println("###")
 	b, _ := json.Marshal(su)

+ 13 - 0
jyBXSubscribe/api/internal/types/types.go

@@ -9,6 +9,15 @@ type BidDistributor struct {
 	Staffs    string   `json:"staffs"`
 }
 
+type BidRecListReq struct {
+	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"`
+}
+
 type DistributorReq struct {
 	AppId     string `header:"appId"`
 	EntId     string `header:"entId,optional"`
@@ -167,6 +176,7 @@ type SubscribeReq struct {
 	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 {
@@ -190,6 +200,9 @@ type SubscribeUpdateReq struct {
 	AccountId       int64                    `header:"accountId,optional"`
 	PositionId      int64                    `header:"positionId,optional"`
 	District        map[string]interface{}   `json:"district,optional"`
+	ISwitch         int64                    `json:"iSwitch,optional"`
+	Amount          string                   `json:"amount,optional"`
+	Matchmode       string                   `json:"matchmode,optional"`
 }
 
 type ViewStatusReq struct {

+ 3 - 0
jyBXSubscribe/entity/common.go

@@ -20,4 +20,7 @@ type SubscribeUpdate struct {
 	Mail            string                   `json:"mail,optional"`            //邮箱
 	Otherbuyerclass string                   `json:"otherbuyerclass,optional"` //匹配未分类类型 1匹配 0不匹配
 	District        map[string]interface{}   `json:"district,optional"`        //区县
+	Amount          string                   `json:"amount,optional"`
+	ISwitch         int64                    `json:"iSwitch,optional"`
+	Matchmode       string                   `json:"matchmode,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"

+ 20 - 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;
 }
 
 //城市
@@ -347,8 +349,8 @@ message PushSet{
   int64 isWxShow = 6;
   int64 interested = 7;
   int64 isMailShow = 8;
-  int64 i_nomsgtip=9;
-  int64 i_apppush_tip=10;
+  int64 i_nomsgtip = 9;
+  int64 i_apppush_tip = 10;
 }
 message SetPushSetReq{
   string appId = 1;
@@ -411,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 {
   //获取订阅推送列表
@@ -447,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)
+}

+ 8 - 0
jyBXSubscribe/rpc/model/service/subscribe.go

@@ -6,6 +6,7 @@ import (
 	"jyBXSubscribe/entity"
 	IC "jyBXSubscribe/rpc/init"
 	"strconv"
+	"strings"
 
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mongodb"
@@ -62,6 +63,10 @@ func (this *SubseribeService) Update() (int64, error) {
 	if this.Buyerclass != nil {
 		setMap["o_vipjy.a_buyerclass"] = this.Buyerclass
 	}
+	if this.Amount != "" {
+		setMap["o_vipjy.amount"] = this.Amount
+	}
+	setMap["o_vipjy.i_switch"] = this.ISwitch
 	if this.Items != nil {
 		setMap["o_vipjy.a_items"] = this.Items
 		//判断是否新增
@@ -85,6 +90,9 @@ func (this *SubseribeService) Update() (int64, error) {
 	if this.Infotype != nil {
 		setMap["o_vipjy.a_infotype"] = this.Infotype
 	}
+	if this.Matchmode != "" {
+		setMap["o_vipjy.i_matchmode"] = strings.Split(this.Matchmode, ",")
+	}
 	if this.Matchway != "" {
 		i_matchway, _ := strconv.Atoi(this.Matchway)
 		setMap["o_vipjy.i_matchway"] = i_matchway

+ 19 - 7
jyBXSubscribe/rpc/model/staffSubscribe.go

@@ -28,11 +28,14 @@ type PersonSubscribe struct {
 			Matchway float64  `json:"matchway"`
 		} `json:"a_key"`
 	} `json:"a_items"`
-	IEntFastimport int `json:"i_ent_fastimport"`
-	IApppush       int `json:"i_apppush"`
-	IMailpush      int `json:"i_mailpush"`
-	IMatchway      int `json:"i_matchway"`
-	IRatemode      int `json:"i_ratemode"`
+	IEntFastimport int      `json:"i_ent_fastimport"`
+	IApppush       int      `json:"i_apppush"`
+	IMailpush      int      `json:"i_mailpush"`
+	IMatchway      int      `json:"i_matchmode"`
+	IMatchmode     []string `json:"i_matchmode"`
+	IRatemode      int      `json:"i_ratemode"`
+	Amount         string   `json:"amount"`
+	ISwitch        int      `json:"i_switch"`
 }
 
 // IsEmpty 判断订阅内容是否为空
@@ -324,9 +327,12 @@ func getPersonSubscribe(query map[string]interface{}) (rData map[string]interfac
 		rData["district"] = subDetail.Odistrict
 		rData["infotype"] = subDetail.AInfotype
 		rData["projectmatch"] = subDetail.IProjectmatch
-		rData["matchway"] = common.If(subDetail.IMatchway == 0, 1, subDetail.IMatchway) //匹配方式 默认标题匹配 1
+		rData["matchway"] = common.If(subDetail.IMatchway == 0, 1, subDetail.IMatchway)                        //匹配方式 默认标题匹配 1
+		rData["matchmode"] = common.If(len(subDetail.IMatchmode) > 0, subDetail.IMatchmode, []string{"title"}) //匹配方式 默认标题匹配 1
 		rData["wordsList"] = wordsList
 		rData["buyerClass"] = subDetail.ABuyerclass
+		rData["switch"] = subDetail.ISwitch
+		rData["amount"] = subDetail.Amount
 		regionMap := map[string]map[string][]string{}
 		if subDetail.OArea != nil {
 			district := map[string]interface{}{}
@@ -384,7 +390,7 @@ func getEntDistribute(ruleId string, entId, uid int64) (rData map[string]interfa
 		wordsRes, _ = IC.Mgo.FindOne("entniche_rule", map[string]interface{}{"i_entid": entId, "i_deptid": map[string]interface{}{"$exists": 0}, "i_userid": map[string]interface{}{"$exists": 0}})
 	}
 	wordsList := []map[string]interface{}{}
-	infotype, i_projectmatch, i_matchway := []string{}, 0, 0
+	infotype, i_projectmatch, i_matchway, amount, iSwitch, i_matchmode := []string{}, 0, 1, "", 0, []string{"title"}
 	if wordsRes != nil && len(*wordsRes) > 0 {
 		thisSub := &PersonSubscribe{}
 		if gconv.Struct((*wordsRes)["o_entniche"], thisSub) == nil {
@@ -402,8 +408,11 @@ func getEntDistribute(ruleId string, entId, uid int64) (rData map[string]interfa
 				}
 			}
 			i_matchway = thisSub.IMatchway
+			i_matchmode = thisSub.IMatchmode
 			i_projectmatch = thisSub.IProjectmatch
 			infotype = thisSub.AInfotype
+			amount = thisSub.Amount
+			iSwitch = thisSub.ISwitch
 		}
 	}
 	rData["buyerClass"] = (*ruleRes)["a_buyerclass"] //采购单位类型
@@ -436,6 +445,9 @@ func getEntDistribute(ruleId string, entId, uid int64) (rData map[string]interfa
 	rData["regionMap"] = regionMap
 	rData["infotype"] = infotype
 	rData["projectmatch"] = i_projectmatch
+	rData["switch"] = iSwitch
+	rData["amount"] = amount
+	rData["matchmode"] = i_matchmode
 	rData["matchway"] = i_matchway
 	rData["wordsList"] = wordsList
 	return

File diff suppressed because it is too large
+ 688 - 566
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go


+ 39 - 0
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe_grpc.pb.go

@@ -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",

Some files were not shown because too many files changed in this diff