lianbingjie преди 2 години
родител
ревизия
90d1376e4a
променени са 51 файла, в които са добавени 2964 реда и са изтрити 999 реда
  1. BIN
      jyBXBase/rpc/rpc.exe
  2. 5 1
      jyBXCore/api/bxcore.api
  3. 7 2
      jyBXCore/api/internal/logic/searchListLogic.go
  4. 5 1
      jyBXCore/api/internal/types/types.go
  5. 81 0
      jyBXCore/entity/rpc.go
  6. 98 4
      jyBXCore/go.mod
  7. 537 45
      jyBXCore/go.sum
  8. 6 2
      jyBXCore/rpc/bxcore.proto
  9. 22 5
      jyBXCore/rpc/entity/search.go
  10. 5 1
      jyBXCore/rpc/etc/bxcore.yaml
  11. 12 3
      jyBXCore/rpc/init/init.go
  12. 4 3
      jyBXCore/rpc/internal/config/config.go
  13. 52 8
      jyBXCore/rpc/type/bxcore/bxcore.pb.go
  14. 5 5
      jyBXCore/rpc/type/bxcore/bxcore_grpc.pb.go
  15. 5 5
      jyBXCore/rpc/util/userInfo.go
  16. BIN
      jyBXSubscribe/api/api.exe
  17. 59 48
      jyBXSubscribe/api/bxsubscribe.api
  18. 2 1
      jyBXSubscribe/api/internal/config/config.go
  19. 23 22
      jyBXSubscribe/api/internal/logic/byPushHistoryLogic.go
  20. 12 11
      jyBXSubscribe/api/internal/logic/getKeyLogic.go
  21. 9 8
      jyBXSubscribe/api/internal/logic/setReadLogic.go
  22. 8 5
      jyBXSubscribe/api/internal/logic/someInfoLogic.go
  23. 22 21
      jyBXSubscribe/api/internal/logic/subscribeListLogic.go
  24. 25 45
      jyBXSubscribe/api/internal/logic/subscribeupdatelogic.go
  25. 56 48
      jyBXSubscribe/api/internal/types/types.go
  26. 14 0
      jyBXSubscribe/entity/common.go
  27. 113 6
      jyBXSubscribe/go.mod
  28. 567 29
      jyBXSubscribe/go.sum
  29. 4 1
      jyBXSubscribe/rpc/bxsubscribe.go
  30. 40 14
      jyBXSubscribe/rpc/bxsubscribe.proto
  31. 139 0
      jyBXSubscribe/rpc/bxsubscribe/bxsubscribe.go
  32. 5 2
      jyBXSubscribe/rpc/etc/bxsubscribe.yaml
  33. 13 2
      jyBXSubscribe/rpc/init/init.go
  34. 6 2
      jyBXSubscribe/rpc/internal/config/config.go
  35. 3 18
      jyBXSubscribe/rpc/internal/logic/bypushhistorylogic.go
  36. 11 10
      jyBXSubscribe/rpc/internal/logic/getkeylogic.go
  37. 5 5
      jyBXSubscribe/rpc/internal/logic/getkeylogic_test.go
  38. 5 10
      jyBXSubscribe/rpc/internal/logic/getsublistlogic.go
  39. 9 9
      jyBXSubscribe/rpc/internal/logic/getsublistlogic_test.go
  40. 107 0
      jyBXSubscribe/rpc/internal/logic/getsubscribeinfologic.go
  41. 34 4
      jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic.go
  42. 2 2
      jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic_test.go
  43. 6 3
      jyBXSubscribe/rpc/internal/logic/setreadlogic.go
  44. 11 61
      jyBXSubscribe/rpc/internal/logic/updatesubscribeinfologic.go
  45. 6 0
      jyBXSubscribe/rpc/internal/server/bxsubscribeserver.go
  46. 6 38
      jyBXSubscribe/rpc/model/distributor.go
  47. 109 95
      jyBXSubscribe/rpc/model/push.go
  48. 9 22
      jyBXSubscribe/rpc/model/service/subscribe.go
  49. 1 2
      jyBXSubscribe/rpc/model/service/subscribe_test.go
  50. 632 369
      jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go
  51. 47 1
      jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe_grpc.pb.go

BIN
jyBXBase/rpc/rpc.exe


+ 5 - 1
jyBXCore/api/bxcore.api

@@ -36,7 +36,11 @@ type (
 		KeyWords        string `json:"keyWords,optional"`
 		AdditionalWords string `json:"additionalWords,optional"`
 		ExclusionWords  string `json:"exclusionWords,optional"`
-		BidField        string `json:"bidField,optional"` //医疗领域化信息
+		BidField        string `json:"bidField,optional"`       //医疗领域化信息
+		AccountId       string `header:"accountId,optional"`    //账户id
+		PositionType    string `header:"positionType,optional"` //职位类型 0个人 1企业
+		PositionId      string `header:"positionId,optional"`   //职位id
+		MgoUserId       string `header:"mgoUserId,optional"`    //原userId
 	}
 	//
 	commonResp {

+ 7 - 2
jyBXCore/api/internal/logic/searchListLogic.go

@@ -1,9 +1,7 @@
 package logic
 
 import (
-	"app.yhyue.com/moapp/jybase/common"
 	"context"
-	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXCore/api/init"
 	"jyBXCore/api/internal/svc"
 	"jyBXCore/api/internal/types"
@@ -12,6 +10,9 @@ import (
 	"log"
 	"net/http"
 	"time"
+
+	"app.yhyue.com/moapp/jybase/common"
+	"github.com/zeromicro/go-zero/core/logx"
 )
 
 type SearchListLogic struct {
@@ -65,6 +66,10 @@ func (l *SearchListLogic) SearchList(req *types.SearchReq) (resp *types.CommonRe
 		UserType:        req.UserType,
 		Platform:        util.CheckPlatform(l.r),
 		BidField:        req.BidField,
+		PositionType:    req.PositionType,
+		PositionId:      req.PositionId,
+		AccountId:       req.AccountId,
+		MgoUserId:       req.MgoUserId,
 		LimitFlag:       limitFlag,
 		IsNew:           isNew,
 	})

+ 5 - 1
jyBXCore/api/internal/types/types.go

@@ -29,7 +29,11 @@ type SearchReq struct {
 	KeyWords        string `json:"keyWords,optional"`
 	AdditionalWords string `json:"additionalWords,optional"`
 	ExclusionWords  string `json:"exclusionWords,optional"`
-	BidField        string `json:"bidField,optional"` //医疗领域化信息
+	BidField        string `json:"bidField,optional"`       //医疗领域化信息
+	AccountId       string `header:"accountId,optional"`    //账户id
+	PositionType    string `header:"positionType,optional"` //职位类型 0个人 1企业
+	PositionId      string `header:"positionId,optional"`   //职位id
+	MgoUserId       string `header:"mgoUserId,optional"`    //原userId
 }
 
 type CommonResp struct {

+ 81 - 0
jyBXCore/entity/rpc.go

@@ -0,0 +1,81 @@
+package entity
+
+import (
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
+	"context"
+	"strings"
+)
+
+var (
+	PowerCheck powercheck.PowerCheck
+)
+
+type UserInfoRpc struct {
+	AppId        string //appId 剑鱼 10000
+	UserId       string //用户id
+	BaseUserId   int64  //用户基本id
+	EntId        int64  //企业id
+	EntUserId    int64  //企业用户id
+	AccountId    int64  //账户id
+	PositionType int64  //职位类型 @个人 1企业
+	PositionId   int64  //职位id
+	MgoUserId    string //原userId
+}
+
+// GetUserPowers  获取用户权益信息
+func (ui *UserInfoRpc) GetUserPowers() *powercheck.CheckResp {
+	req := &powercheck.CheckReq{
+		Appid:        ui.AppId,
+		Userid:       ui.MgoUserId,
+		BaseUserId:   ui.BaseUserId,
+		AccountId:    ui.AccountId,
+		EntId:        ui.EntId,
+		PositionType: ui.PositionType,
+		PositionId:   ui.PositionId,
+	}
+	checkResp, err := PowerCheck.Check(context.Background(), req)
+	if err == nil {
+		return checkResp
+	}
+	return nil
+}
+
+// GetQueryItems 免费 标题(title)  正文(content) 老用户【中标企业(winner)】
+// 付费用户 全部(all)、标题(title)  正文(content)  会员: 采购单位(buyer) 中标企业(winner) 招标代理机构(agency) 附件(file)
+// 项目名称projectname和标的物purchasing(ppa)
+func (ui *UserInfoRpc) GetQueryItems(selectType string, limitOldTime, registerData int64, isPay bool) (items []string) {
+	if isPay {
+		for _, t := range strings.Split(selectType, ",") {
+			if t == "content" {
+				items = append(items, "detail")
+			} else if t == "buyer" {
+				items = append(items, "mbuyer")
+			} else if t == "winner" {
+				items = append(items, "mwinner")
+			} else if t == "agency" {
+				items = append(items, "magency")
+			} else if t == "title" {
+				items = append(items, "title")
+			} else if t == "ppa" {
+				items = append(items, []string{"purchasing", "projectname.pname"}...)
+			} else if t == "file" { //dev4.7.8 标讯优化:搜索范围附件-》全部用户可用
+				items = append(items, "filetext")
+			}
+		}
+		return
+	}
+	//老用户 使用付费功能
+	isOldUser := registerData != 0 && registerData < limitOldTime
+	for _, t := range strings.Split(selectType, ",") {
+		if t == "winner" && isOldUser {
+			items = append(items, "mwinner")
+		} else if t == "title" {
+			items = append(items, "title")
+		} else if t == "content" {
+			items = append(items, "detail")
+		} else if t == "file" { //dev4.7.8 标讯优化:搜索范围附件-》全部用户可用
+			items = append(items, "filetext")
+		}
+	}
+	return
+}

+ 98 - 4
jyBXCore/go.mod

@@ -1,12 +1,106 @@
 module jyBXCore
 
-go 1.16
+go 1.18
 
 require (
 	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	github.com/go-sql-driver/mysql v1.6.0
-	github.com/zeromicro/go-zero v1.4.0
-	google.golang.org/grpc v1.49.0
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230210052334-7b32c3b8c773
+	github.com/go-sql-driver/mysql v1.7.0
+	github.com/zeromicro/go-zero v1.4.4
+	google.golang.org/grpc v1.53.0
 	google.golang.org/protobuf v1.28.1
 )
+
+require (
+	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
+	github.com/beorn7/perks v1.0.1 // indirect
+	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
+	github.com/cespare/xxhash/v2 v2.2.0 // indirect
+	github.com/coreos/go-semver v0.3.0 // indirect
+	github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+	github.com/davecgh/go-spew v1.1.1 // indirect
+	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
+	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
+	github.com/fatih/color v1.13.0 // indirect
+	github.com/felixge/fgprof v0.9.3 // indirect
+	github.com/garyburd/redigo v1.6.2 // indirect
+	github.com/go-logr/logr v1.2.3 // indirect
+	github.com/go-logr/stdr v1.2.2 // indirect
+	github.com/go-redis/redis/v8 v8.11.5 // indirect
+	github.com/gogo/protobuf v1.3.2 // indirect
+	github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
+	github.com/golang/mock v1.6.0 // indirect
+	github.com/golang/protobuf v1.5.2 // indirect
+	github.com/golang/snappy v0.0.4 // indirect
+	github.com/gomodule/redigo v1.8.9 // indirect
+	github.com/google/go-cmp v0.5.9 // indirect
+	github.com/google/gofuzz v1.2.0 // indirect
+	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
+	github.com/google/uuid v1.3.0 // indirect
+	github.com/googleapis/gnostic v0.5.5 // indirect
+	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
+	github.com/jinzhu/inflection v1.0.0 // indirect
+	github.com/jinzhu/now v1.1.1 // indirect
+	github.com/json-iterator/go v1.1.12 // indirect
+	github.com/klauspost/compress v1.13.6 // indirect
+	github.com/mattn/go-colorable v0.1.9 // indirect
+	github.com/mattn/go-isatty v0.0.14 // indirect
+	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+	github.com/modern-go/reflect2 v1.0.2 // indirect
+	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
+	github.com/olivere/elastic v6.2.37+incompatible // indirect
+	github.com/openzipkin/zipkin-go v0.4.0 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/prometheus/client_golang v1.13.0 // indirect
+	github.com/prometheus/client_model v0.2.0 // indirect
+	github.com/prometheus/common v0.37.0 // indirect
+	github.com/prometheus/procfs v0.8.0 // indirect
+	github.com/spaolacci/murmur3 v1.1.0 // indirect
+	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
+	github.com/xdg-go/scram v1.1.1 // indirect
+	github.com/xdg-go/stringprep v1.0.3 // indirect
+	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
+	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
+	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
+	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
+	go.mongodb.org/mongo-driver v1.11.1 // indirect
+	go.opentelemetry.io/otel v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
+	go.opentelemetry.io/otel/sdk v1.10.0 // indirect
+	go.opentelemetry.io/otel/trace v1.10.0 // indirect
+	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
+	go.uber.org/atomic v1.9.0 // indirect
+	go.uber.org/automaxprocs v1.5.1 // indirect
+	go.uber.org/multierr v1.8.0 // indirect
+	go.uber.org/zap v1.21.0 // indirect
+	golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
+	golang.org/x/net v0.5.0 // indirect
+	golang.org/x/oauth2 v0.4.0 // indirect
+	golang.org/x/sync v0.1.0 // indirect
+	golang.org/x/sys v0.4.0 // indirect
+	golang.org/x/term v0.4.0 // indirect
+	golang.org/x/text v0.6.0 // indirect
+	golang.org/x/time v0.3.0 // indirect
+	google.golang.org/appengine v1.6.7 // indirect
+	google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
+	gopkg.in/inf.v0 v0.9.1 // indirect
+	gopkg.in/yaml.v2 v2.4.0 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
+	gorm.io/driver/mysql v1.0.5 // indirect
+	gorm.io/gorm v1.21.3 // indirect
+	k8s.io/api v0.22.9 // indirect
+	k8s.io/apimachinery v0.22.9 // indirect
+	k8s.io/client-go v0.22.9 // indirect
+	k8s.io/klog/v2 v2.80.1 // indirect
+	k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 // indirect
+	sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
+	sigs.k8s.io/yaml v1.2.0 // indirect
+)

Файловите разлики са ограничени, защото са твърде много
+ 537 - 45
jyBXCore/go.sum


+ 6 - 2
jyBXCore/rpc/bxcore.proto

@@ -36,8 +36,12 @@ message SearchReq {
   string interceptKeyWords = 30;//关键词截取后的关键词;
   string interceptOtherWords = 31;//关键词截取后 后面三个字
   string bidField = 32;//领域化标识
-  string limitFlag =33; //未登录用户生成一个随机id
-  bool isNew=34;//未登录用户首次请求
+  string accountId = 33; //账户id
+  string positionType =34; //职位类型 0个人 1企业
+  string positionId = 35;  //职位id
+  string mgoUserId = 36;  //原userId
+  string limitFlag =37; //未登录用户生成一个随机id
+  bool isNew=38;//未登录用户首次请求
 }
 
 message SearchResp {

+ 22 - 5
jyBXCore/rpc/entity/search.go

@@ -6,10 +6,12 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXCore/entity"
 	"jyBXCore/rpc/bxcore"
 	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/service"
 	"jyBXCore/rpc/util"
+	"strconv"
 	"strings"
 	"time"
 )
@@ -156,15 +158,30 @@ func (kws *KeyWordsSearch) GetSearchKeyWordsQueryStr(in *bxcore.SearchReq) (sear
 
 // SearchParamsHandle 搜索条件 处理
 func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
+	baseUserId, _ := strconv.ParseInt(in.NewUserId, 10, 64)
+	accountId, _ := strconv.ParseInt(in.AccountId, 10, 64)
+	positionType, _ := strconv.ParseInt(in.PositionType, 10, 64)
+	positionId, _ := strconv.ParseInt(in.PositionId, 10, 64)
+	userInfoRpc := entity.UserInfoRpc{
+		AppId:        in.AppId,
+		UserId:       in.UserId,
+		BaseUserId:   baseUserId,
+		EntId:        in.EntId,
+		EntUserId:    in.EntUserId,
+		AccountId:    accountId,
+		PositionType: positionType,
+		PositionId:   positionId,
+		MgoUserId:    in.MgoUserId,
+	}
 	//判断用户身份
-	userInfo := util.GetVipState(IC.MainMysql, IC.Mgo, in.UserId, in.EntId)
+	userInfo := userInfoRpc.GetUserPowers()
 	//是否是付费用户
-	in.IsPay = userInfo.IsPayedUser()
+	in.IsPay = !userInfo.Free.IsFree
 	//默认搜索范围
 	if in.SelectType == "" {
 		in.SelectType = "title,content"
 	}
-	queryItems := userInfo.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit)
+	queryItems := userInfoRpc.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit, userInfo.Free.Registedate, in.IsPay)
 	in.SelectType = strings.Join(queryItems, ",")
 	// in.SearchGroup 搜索分组 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
 	//	详情页判断是否能使用超前项目  老版超级订阅、大会员、商机管理有权限
@@ -192,7 +209,7 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
 	if in.PublishTime == "" {
 		//付费用户最新5年;免费用户||未登录用户最新1年
 		in.PublishTime = fmt.Sprintf("%d-%d", time.Now().AddDate(-1, 0, 0).Unix(), time.Now().Unix())
-		if userInfo.IsPayedUser() {
+		if in.IsPay {
 			in.PublishTime = fmt.Sprintf("%d-%d", time.Now().AddDate(-5, 0, 0).Unix(), time.Now().Unix())
 		}
 	}
@@ -209,7 +226,7 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
 		in.Industry = strings.TrimSpace(in.Industry)
 	}
 	//免费用户:高级筛选 采购单位类型、采购单位联系方式、中标企业联系方式、排除词、城市
-	if !userInfo.IsPayedUser() {
+	if userInfo.Free.IsFree {
 		in.BuyerClass = ""
 		in.BuyerTel = ""
 		in.WinnerTel = ""

+ 5 - 1
jyBXCore/rpc/etc/bxcore.yaml

@@ -42,4 +42,8 @@ DefaultTopTypes:
   - 拟建,采购意向
 JYKeyMark: " "
 ContextOldVipLimit: 1664553600
-
+PowersEtcdConf:
+  Etcd:
+    Hosts:
+      - 192.168.3.206:2379
+    Key: powercheck.rpc

+ 12 - 3
jyBXCore/rpc/init/init.go

@@ -1,11 +1,14 @@
 package init
 
 import (
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
 	"flag"
 	"fmt"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/zeromicro/go-zero/core/conf"
+	"github.com/zeromicro/go-zero/core/discov"
 	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/zrpc"
 	"jyBXCore/entity"
 	"jyBXCore/rpc/internal/config"
 )
@@ -14,15 +17,13 @@ var configFile = flag.String("cf", "etc/bxcore.yaml", "the config file")
 var C config.Config
 var err error
 
-//
 var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 
-//
 var logFile = flag.String("lf", "etc/logs.yaml", "the logs file")
 var logc entity.Logc
 
-//全文或附件搜索限制
+// 全文或附件搜索限制
 var SearchLimitKey = "jy_limitSearchText_new"
 var SearchLimitFlag = "jy_limitSearchText_%s"
 
@@ -56,4 +57,12 @@ func init() {
 	LabelInit()
 	//
 	SearchLimitKey = fmt.Sprintf(C.LimitSearchText.LimitKey, "jy_limitSearchText")
+	//初始化权益中台相关
+	powersClient := zrpc.MustNewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: C.PowersEtcdConf.Etcd.Hosts,
+			Key:   C.PowersEtcdConf.Etcd.Key,
+		},
+	})
+	entity.PowerCheck = powercheck.NewPowerCheck(powersClient)
 }

+ 4 - 3
jyBXCore/rpc/internal/config/config.go

@@ -41,9 +41,10 @@ type Config struct {
 		Count    int
 		PayCount int
 	} //招标信息初始化
-	DefaultTopTypes    []string //信息类型初始值
-	JYKeyMark          string   //关键词分组标识
-	ContextOldVipLimit int64    //老版超级订阅 超前项目权限
+	DefaultTopTypes    []string           //信息类型初始值
+	JYKeyMark          string             //关键词分组标识
+	ContextOldVipLimit int64              //老版超级订阅 超前项目权限
+	PowersEtcdConf     zrpc.RpcClientConf //权益中台
 }
 
 type Db struct {

+ 52 - 8
jyBXCore/rpc/type/bxcore/bxcore.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.28.1
-// 	protoc        v3.19.4
+// 	protoc-gen-go v1.27.1
+// 	protoc        v3.20.0--rc2
 // source: bxcore.proto
 
 package bxcore
@@ -57,8 +57,12 @@ type SearchReq struct {
 	InterceptKeyWords   string `protobuf:"bytes,30,opt,name=interceptKeyWords,proto3" json:"interceptKeyWords,omitempty"`     //关键词截取后的关键词;
 	InterceptOtherWords string `protobuf:"bytes,31,opt,name=interceptOtherWords,proto3" json:"interceptOtherWords,omitempty"` //关键词截取后 后面三个字
 	BidField            string `protobuf:"bytes,32,opt,name=bidField,proto3" json:"bidField,omitempty"`                       //领域化标识
-	LimitFlag           string `protobuf:"bytes,33,opt,name=limitFlag,proto3" json:"limitFlag,omitempty"`                     //未登录用户生成一个随机id
-	IsNew               bool   `protobuf:"varint,34,opt,name=isNew,proto3" json:"isNew,omitempty"`                            //未登录用户首次请求
+	AccountId           string `protobuf:"bytes,33,opt,name=accountId,proto3" json:"accountId,omitempty"`                     //账户id
+	PositionType        string `protobuf:"bytes,34,opt,name=positionType,proto3" json:"positionType,omitempty"`               //职位类型 0个人 1企业
+	PositionId          string `protobuf:"bytes,35,opt,name=positionId,proto3" json:"positionId,omitempty"`                   //职位id
+	MgoUserId           string `protobuf:"bytes,36,opt,name=mgoUserId,proto3" json:"mgoUserId,omitempty"`                     //原userId
+	LimitFlag           string `protobuf:"bytes,37,opt,name=limitFlag,proto3" json:"limitFlag,omitempty"`                     //未登录用户生成一个随机id
+	IsNew               bool   `protobuf:"varint,38,opt,name=isNew,proto3" json:"isNew,omitempty"`                            //未登录用户首次请求
 }
 
 func (x *SearchReq) Reset() {
@@ -317,6 +321,34 @@ func (x *SearchReq) GetBidField() string {
 	return ""
 }
 
+func (x *SearchReq) GetAccountId() string {
+	if x != nil {
+		return x.AccountId
+	}
+	return ""
+}
+
+func (x *SearchReq) GetPositionType() string {
+	if x != nil {
+		return x.PositionType
+	}
+	return ""
+}
+
+func (x *SearchReq) GetPositionId() string {
+	if x != nil {
+		return x.PositionId
+	}
+	return ""
+}
+
+func (x *SearchReq) GetMgoUserId() string {
+	if x != nil {
+		return x.MgoUserId
+	}
+	return ""
+}
+
 func (x *SearchReq) GetLimitFlag() string {
 	if x != nil {
 		return x.LimitFlag
@@ -808,6 +840,7 @@ func (x *SearchList) GetWinner() string {
 	return ""
 }
 
+//
 type WinnerInfo struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -879,6 +912,7 @@ func (x *WinnerInfo) GetWinnerId() string {
 	return ""
 }
 
+//
 type PInfo struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -974,6 +1008,7 @@ func (x *PInfo) GetApproveNumber() string {
 	return ""
 }
 
+//
 type SearchLimitReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1069,6 +1104,7 @@ func (x *SearchLimitReq) GetSearchType() string {
 	return ""
 }
 
+//
 type SearchLimitResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1136,7 +1172,7 @@ var File_bxcore_proto protoreflect.FileDescriptor
 
 var file_bxcore_proto_rawDesc = []byte{
 	0x0a, 0x0c, 0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
-	0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x22, 0xf5, 0x07, 0x0a, 0x09, 0x53, 0x65, 0x61, 0x72, 0x63,
+	0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x22, 0xf5, 0x08, 0x0a, 0x09, 0x53, 0x65, 0x61, 0x72, 0x63,
 	0x68, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20,
 	0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73,
 	0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
@@ -1196,10 +1232,18 @@ var file_bxcore_proto_rawDesc = []byte{
 	0x72, 0x64, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x69, 0x6e, 0x74, 0x65, 0x72,
 	0x63, 0x65, 0x70, 0x74, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x1a,
 	0x0a, 0x08, 0x62, 0x69, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x20, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x08, 0x62, 0x69, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x69,
-	0x6d, 0x69, 0x74, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x21, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c,
+	0x52, 0x08, 0x62, 0x69, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63,
+	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61,
+	0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x6f, 0x73, 0x69,
+	0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
+	0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a,
+	0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x23, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09,
+	0x6d, 0x67, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x09, 0x6d, 0x67, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x69,
+	0x6d, 0x69, 0x74, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c,
 	0x69, 0x6d, 0x69, 0x74, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x4e, 0x65,
-	0x77, 0x18, 0x22, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x4e, 0x65, 0x77, 0x22, 0x68,
+	0x77, 0x18, 0x26, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x4e, 0x65, 0x77, 0x22, 0x68,
 	0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x19, 0x0a, 0x08,
 	0x65, 0x72, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07,
 	0x65, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x5f, 0x6d,

+ 5 - 5
jyBXCore/rpc/type/bxcore/bxcore_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.4
+// - protoc             v3.20.0--rc2
 // source: bxcore.proto
 
 package bxcore
@@ -22,9 +22,9 @@ const _ = grpc.SupportPackageIsVersion7
 //
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
 type BxCoreClient interface {
-	// 标讯搜索结果列表数据
+	//标讯搜索结果列表数据
 	GetSearchList(ctx context.Context, in *SearchReq, opts ...grpc.CallOption) (*SearchResp, error)
-	// 标讯搜索限制内容
+	//标讯搜索限制内容
 	SearchLimit(ctx context.Context, in *SearchLimitReq, opts ...grpc.CallOption) (*SearchLimitResp, error)
 }
 
@@ -58,9 +58,9 @@ func (c *bxCoreClient) SearchLimit(ctx context.Context, in *SearchLimitReq, opts
 // All implementations must embed UnimplementedBxCoreServer
 // for forward compatibility
 type BxCoreServer interface {
-	// 标讯搜索结果列表数据
+	//标讯搜索结果列表数据
 	GetSearchList(context.Context, *SearchReq) (*SearchResp, error)
-	// 标讯搜索限制内容
+	//标讯搜索限制内容
 	SearchLimit(context.Context, *SearchLimitReq) (*SearchLimitResp, error)
 	mustEmbedUnimplementedBxCoreServer()
 }

+ 5 - 5
jyBXCore/rpc/util/userInfo.go

@@ -8,7 +8,7 @@ import (
 	"strings"
 )
 
-//是否是付费用户
+// VipState 是否是付费用户
 type VipState struct {
 	VipState     int64 //超级订阅状态(1普通 2升级版)
 	BigMember    int64 //大会员状态
@@ -62,14 +62,14 @@ func GetVipState(mysql *mysql.Mysql, mg mongodb.MongodbSim, userId string, entId
 	return
 }
 
-//是否是付费账户
+// IsPayedUser 是否是付费账户
 func (vs *VipState) IsPayedUser() bool {
 	return vs.VipState > 0 || vs.BigMember > 0 || vs.EntMember > 0
 }
 
-//免费 标题(title)  正文(content) 老用户【中标企业(winner)】
-//付费用户 全部(all)、标题(title)  正文(content)  会员: 采购单位(buyer) 中标企业(winner) 招标代理机构(agency) 附件(file)
-//项目名称projectname和标的物purchasing(ppa)
+// GetQueryItems 免费 标题(title)  正文(content) 老用户【中标企业(winner)】
+// 付费用户 全部(all)、标题(title)  正文(content)  会员: 采购单位(buyer) 中标企业(winner) 招标代理机构(agency) 附件(file)
+// 项目名称projectname和标的物purchasing(ppa)
 func (vs *VipState) GetQueryItems(selectType string, limitOldTime int64) (items []string) {
 	if vs.IsPayedUser() {
 		for _, t := range strings.Split(selectType, ",") {

BIN
jyBXSubscribe/api/api.exe


+ 59 - 48
jyBXSubscribe/api/bxsubscribe.api

@@ -10,36 +10,41 @@ 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"`
+		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"`
 	}
 	//
 	someInfoReq {
-		AppId     string `header:"appId"`
-		UserType  string `path:"userType"`
-		NewUserId int64  `header:"newUserId"`
-		EntId     string `header:"entId,optional"`
+		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"`
 	}
 	//
 	commonResp {
@@ -63,31 +68,34 @@ type (
 		AppId           string                   `header:"appId,optional"`
 		UserType        string                   `path:"userType,optional"`
 		UserId          string                   `header:"userId,optional"`
+		PositionType    int64                    `header:"positionType,optional"`
 	}
 	SetReadReq {
-		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"`
+		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"`
 	}
 	GetKeyReq {
-		AppId       string `header:"appId"`
-		UserId      string `header:"userId"`
-		EntId       string `header:"entId,optional"`
-		EntUserId   string `header:"entUserId,optional"`
-		DeptId      string `header:"deptId,optional"` //部门id
-		NewUserId   int64  `header:"newUserId"`
-		IsEnt       bool   `form:"isEnt,optional"`
-		UserType    string `path:"userType,optional"`
-		VipPower    int64  `form:"ent_buy_vip ,optional"`
-		MemberPower int64  `form:"ent_buy_member ,optional"`
-		PowerSource int64  `form:"powerSource,optional"`
-		UserPower   int64  `form:"userPower,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
+		NewUserId    int64  `header:"newUserId"`
+		IsEnt        bool   `form:"isEnt,optional"`
+		UserType     string `path:"userType,optional"`
+		VipPower     int64  `form:"ent_buy_vip ,optional"`
+		MemberPower  int64  `form:"ent_buy_member ,optional"`
+		PowerSource  int64  `form:"powerSource,optional"`
+		UserPower    int64  `form:"userPower,optional"`
+		PositionType int64  `header:"positionType,optional"`
 	}
 	DistributorReq {
 		AppId     string `header:"appId"`
@@ -140,8 +148,11 @@ service bxsubscribe-api {
 	post /jybx/subscribe/:userType/viewStatus(viewStatusReq) returns (commonResp)
 	@handler msgDistributor
 	post /jybx/subscribe/msgDistributor(msgDistributor) returns (commonResp)
+<<<<<<< HEAD
 	@handler deriveShow //数据导出筛选条件回显
 	post /jybx/subscribe/deriveShow(deriveReq) returns (commonResp)
 	@handler deriveDel//数据导出筛选条件删除
 	post /jybx/subscribe/deriveDel(deriveReq) returns (commonResp)
+=======
+>>>>>>> master
 }

+ 2 - 1
jyBXSubscribe/api/internal/config/config.go

@@ -1,9 +1,10 @@
 package config
 
 import (
+	"jyBXSubscribe/entity"
+
 	"github.com/zeromicro/go-zero/rest"
 	"github.com/zeromicro/go-zero/zrpc"
-	"jyBXSubscribe/entity"
 )
 
 type Config struct {

+ 23 - 22
jyBXSubscribe/api/internal/logic/byPushHistoryLogic.go

@@ -26,28 +26,29 @@ func NewByPushHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ByP
 
 func (l *ByPushHistoryLogic) ByPushHistory(req *types.SubscribeReq) (resp *types.CommonResp, err error) {
 	res, err := l.svcCtx.Suscribe.ByPushHistory(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,
-		SelectIds:  req.SelectIds,
+		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,
+		SelectIds:    req.SelectIds,
+		PositionType: req.PositionType,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 12 - 11
jyBXSubscribe/api/internal/logic/getKeyLogic.go

@@ -27,17 +27,18 @@ func NewGetKeyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetKeyLogi
 func (l *GetKeyLogic) GetKey(req *types.GetKeyReq) (resp *types.CommonResp, err error) {
 	// todo: add your logic here and delete this line
 	res, err := l.svcCtx.Suscribe.GetKey(l.ctx, &bxsubscribe.GetKeyReq{
-		UserType:    req.UserType,
-		UserId:      req.UserId,
-		EntId:       req.EntId,
-		EntUserId:   req.EntUserId,
-		NewUserId:   req.NewUserId,
-		IsEnt:       req.IsEnt,
-		PowerSource: req.PowerSource,
-		UserPower:   req.UserPower,
-		VipPower:    req.VipPower,
-		MemberPower: req.MemberPower,
-		DeptId:      req.DeptId,
+		UserType:     req.UserType,
+		UserId:       req.UserId,
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		NewUserId:    req.NewUserId,
+		IsEnt:        req.IsEnt,
+		PowerSource:  req.PowerSource,
+		UserPower:    req.UserPower,
+		VipPower:     req.VipPower,
+		MemberPower:  req.MemberPower,
+		DeptId:       req.DeptId,
+		PositionType: req.PositionType,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 9 - 8
jyBXSubscribe/api/internal/logic/setReadLogic.go

@@ -27,14 +27,15 @@ func NewSetReadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetReadLo
 func (l *SetReadLogic) SetRead(req *types.SetReadReq) (resp *types.CommonResp, err error) {
 	// todo: add your logic here and delete this line
 	res, err := l.svcCtx.Suscribe.SetRead(l.ctx, &bxsubscribe.SetReadReq{
-		AppId:     req.AppId,
-		UserType:  req.UserType,
-		UserId:    req.UserId,
-		NewUserId: req.NewUserId,
-		EntId:     req.EntId,
-		IsEnt:     req.IsEnt,
-		EntUserId: req.EntUserId,
-		Vsid:      req.Vsid,
+		AppId:        req.AppId,
+		UserType:     req.UserType,
+		UserId:       req.UserId,
+		NewUserId:    req.NewUserId,
+		EntId:        req.EntId,
+		IsEnt:        req.IsEnt,
+		EntUserId:    req.EntUserId,
+		Vsid:         req.Vsid,
+		PositionType: req.PositionType,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 8 - 5
jyBXSubscribe/api/internal/logic/someInfoLogic.go

@@ -31,11 +31,14 @@ func NewSomeInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.R
 
 func (l *SomeInfoLogic) SomeInfo(req *types.SomeInfoReq) (resp *types.CommonResp, err error) {
 	res, err := l.svcCtx.Suscribe.GetSubSomeInfo(l.ctx, &bxsubscribe.SomeInfoReq{
-		AppId:     req.AppId,
-		UserType:  req.UserType,
-		UserId:    l.r.Header.Get("userId"),
-		NewUserId: req.NewUserId,
-		EntId:     req.EntId,
+		AppId:        req.AppId,
+		UserType:     req.UserType,
+		UserId:       req.UserId,
+		NewUserId:    req.NewUserId,
+		EntId:        req.EntId,
+		PositionId:   req.PositionId,
+		AccountId:    req.AccountId,
+		PositionType: req.PositionType,
 	})
 	if err != nil {
 		return &types.CommonResp{

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

@@ -28,27 +28,28 @@ func NewSubscribeListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *h
 
 func (l *SubscribeListLogic) SubscribeList(req *types.SubscribeReq) (resp *types.CommonResp, err error) {
 	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,
+		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,
 	})
 	if err != nil {
 		return &types.CommonResp{

+ 25 - 45
jyBXSubscribe/api/internal/logic/subscribeupdatelogic.go

@@ -2,15 +2,16 @@ package logic
 
 import (
 	"context"
+	"encoding/json"
 	"fmt"
 	it "jyBXSubscribe/api/init"
 	"jyBXSubscribe/api/internal/svc"
 	"jyBXSubscribe/api/internal/types"
-	"jyBXSubscribe/rpc/model/service"
+	. "jyBXSubscribe/entity"
+	"jyBXSubscribe/rpc/bxsubscribe"
 	"time"
 
 	"app.yhyue.com/moapp/jybase/common"
-
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
@@ -30,56 +31,35 @@ func NewSubscribeUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *S
 
 //
 func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (resp *types.CommonResp, err error) {
-	resp = &types.CommonResp{} //出参
-
+	resp = &types.CommonResp{}
 	if req.UserId == "" {
 		return
-	}
-	subService := &service.SubseribeService{
-		UserId: req.UserId,
-		Mgo:    it.Mgo,
-	}
-	if req.Area != nil {
-		subService.Area = req.Area
-	}
-	if req.Apppush != "" {
-		subService.Apppush = req.Apppush
-	}
-	if req.Buyerclass != nil {
-		subService.Buyerclass = req.Buyerclass
-	}
-	if req.Infotype != nil {
-		subService.Infotype = req.Infotype
-	}
-	if KeyWordsRepeat(req.Items) {
+	} else if KeyWordsRepeat(req.Items) {
 		resp.Data = map[string]interface{}{
 			"status": -1,
 		}
 		resp.Err_code, resp.Err_msg = -1, "关键词设置异常"
 		return
 	}
-	if req.Items != nil {
-		subService.Items = req.Items
-	}
-	if req.Mail != "" {
-		subService.Mail = req.Mail
-	}
-	if req.Mailpush != "" {
-		subService.Mailpush = req.Mailpush
-	}
-	if req.Matchway != "" {
-		subService.Matchway = req.Matchway
-	}
-	if req.Otherbuyerclass != "" {
-		subService.Otherbuyerclass = req.Otherbuyerclass
-	}
-	if req.Projectmatch != "" {
-		subService.Projectmatch = req.Projectmatch
-	}
-	if req.Ratemode != "" {
-		subService.Ratemode = req.Ratemode
-	}
-	status, err := subService.Update()
+	su := &SubscribeUpdate{
+		Area:            req.Area,
+		Buyerclass:      req.Buyerclass,
+		Items:           req.Items,
+		Infotype:        req.Infotype,
+		Matchway:        req.Matchway,
+		Projectmatch:    req.Projectmatch,
+		Ratemode:        req.Ratemode,
+		Apppush:         req.Apppush,
+		Mailpush:        req.Mailpush,
+		Mail:            req.Mail,
+		Otherbuyerclass: req.Otherbuyerclass,
+	}
+	b, _ := json.Marshal(su)
+	rp, err := l.svcCtx.Suscribe.UpdateSubScribeInfo(l.ctx, &bxsubscribe.UpdateSubScribeInfoReq{
+		UserId:       req.UserId,
+		PositionType: req.PositionType,
+		SubSet:       b,
+	})
 	if err != nil {
 		resp.Err_code, resp.Err_msg = -1, "修改失败"
 		l.Error(fmt.Sprintf("%+v", req), resp.Err_msg)
@@ -91,7 +71,7 @@ func (l *SubscribeUpdateLogic) SubscribeUpdate(req *types.SubscribeUpdateReq) (r
 			"type":       "o_vipjy",
 		})
 		resp.Data = map[string]interface{}{
-			"status": status,
+			"status": rp.Status,
 		}
 	}
 	return

+ 56 - 48
jyBXSubscribe/api/internal/types/types.go

@@ -2,36 +2,41 @@
 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"`
+	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"`
 }
 
 type SomeInfoReq struct {
-	AppId     string `header:"appId"`
-	UserType  string `path:"userType"`
-	NewUserId int64  `header:"newUserId"`
-	EntId     string `header:"entId,optional"`
+	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 CommonResp struct {
@@ -55,33 +60,36 @@ type SubscribeUpdateReq struct {
 	AppId           string                   `header:"appId,optional"`
 	UserType        string                   `path:"userType,optional"`
 	UserId          string                   `header:"userId,optional"`
+	PositionType    int64                    `header:"positionType,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"`
+	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 GetKeyReq 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
-	NewUserId   int64  `header:"newUserId"`
-	IsEnt       bool   `form:"isEnt,optional"`
-	UserType    string `path:"userType,optional"`
-	VipPower    int64  `form:"ent_buy_vip ,optional"`
-	MemberPower int64  `form:"ent_buy_member ,optional"`
-	PowerSource int64  `form:"powerSource,optional"`
-	UserPower   int64  `form:"userPower,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
+	NewUserId    int64  `header:"newUserId"`
+	IsEnt        bool   `form:"isEnt,optional"`
+	UserType     string `path:"userType,optional"`
+	VipPower     int64  `form:"ent_buy_vip ,optional"`
+	MemberPower  int64  `form:"ent_buy_member ,optional"`
+	PowerSource  int64  `form:"powerSource,optional"`
+	UserPower    int64  `form:"userPower,optional"`
+	PositionType int64  `header:"positionType,optional"`
 }
 
 type DistributorReq struct {

+ 14 - 0
jyBXSubscribe/entity/common.go

@@ -6,3 +6,17 @@ const (
 	/*********************errorMsg****************/
 	UPDATE_ERROR_MSG = "修改失败"
 )
+
+type SubscribeUpdate 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不匹配
+}

+ 113 - 6
jyBXSubscribe/go.mod

@@ -1,14 +1,121 @@
 module jyBXSubscribe
 
-go 1.16
+go 1.18
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20220617085837-48c1bf245c2f
+	app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a
+	app.yhyue.com/moapp/jypkg v0.0.0-20230218064127-1de4f4f3e6a3
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/jyCodeService v0.0.0-20220927093612-72958b15cdf0
-	github.com/go-sql-driver/mysql v1.6.0
-	github.com/zeromicro/go-zero v1.4.0
-	go.mongodb.org/mongo-driver v1.10.1
-	google.golang.org/grpc v1.48.0
+	github.com/go-sql-driver/mysql v1.7.0
+	github.com/gogf/gf/v2 v2.0.6
+	github.com/zeromicro/go-zero v1.4.4
+	go.mongodb.org/mongo-driver v1.11.1
+	google.golang.org/grpc v1.51.0
 	google.golang.org/protobuf v1.28.1
 )
+
+require (
+	app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d // indirect
+	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230209051900-1e7dcb8f83b7 // indirect
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230207054315-b05f3dd4c4d3 // indirect
+	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.7 // indirect
+	bp.jydev.jianyu360.cn/BaseService/userCenter v0.0.0-20230129060002-f69424aa14ba // indirect
+	github.com/BurntSushi/toml v0.4.1 // indirect
+	github.com/beorn7/perks v1.0.1 // indirect
+	github.com/cenkalti/backoff/v4 v4.1.3 // indirect
+	github.com/cespare/xxhash/v2 v2.1.2 // indirect
+	github.com/clbanning/mxj/v2 v2.5.5 // indirect
+	github.com/coreos/go-semver v0.3.0 // indirect
+	github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+	github.com/davecgh/go-spew v1.1.1 // indirect
+	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
+	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
+	github.com/fatih/color v1.13.0 // indirect
+	github.com/felixge/fgprof v0.9.3 // indirect
+	github.com/fsnotify/fsnotify v1.5.1 // indirect
+	github.com/garyburd/redigo v1.6.2 // indirect
+	github.com/go-logr/logr v1.2.3 // indirect
+	github.com/go-logr/stdr v1.2.2 // indirect
+	github.com/go-redis/redis/v8 v8.11.5 // indirect
+	github.com/gogo/protobuf v1.3.2 // indirect
+	github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
+	github.com/golang/mock v1.6.0 // indirect
+	github.com/golang/protobuf v1.5.2 // indirect
+	github.com/golang/snappy v0.0.4 // indirect
+	github.com/gomodule/redigo v1.8.9 // indirect
+	github.com/google/go-cmp v0.5.9 // indirect
+	github.com/google/gofuzz v1.2.0 // indirect
+	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
+	github.com/google/uuid v1.3.0 // indirect
+	github.com/googleapis/gnostic v0.5.5 // indirect
+	github.com/gorilla/websocket v1.5.0 // indirect
+	github.com/grokify/html-strip-tags-go v0.0.1 // indirect
+	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
+	github.com/jinzhu/inflection v1.0.0 // indirect
+	github.com/jinzhu/now v1.1.1 // indirect
+	github.com/json-iterator/go v1.1.12 // indirect
+	github.com/klauspost/compress v1.13.6 // indirect
+	github.com/longbridgeapp/sqlparser v0.3.1 // indirect
+	github.com/mattn/go-colorable v0.1.13 // indirect
+	github.com/mattn/go-isatty v0.0.16 // indirect
+	github.com/mattn/go-runewidth v0.0.13 // indirect
+	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+	github.com/modern-go/reflect2 v1.0.2 // indirect
+	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
+	github.com/olekukonko/tablewriter v0.0.5 // indirect
+	github.com/olivere/elastic v6.2.37+incompatible // indirect
+	github.com/openzipkin/zipkin-go v0.4.0 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/prometheus/client_golang v1.13.0 // indirect
+	github.com/prometheus/client_model v0.2.0 // indirect
+	github.com/prometheus/common v0.37.0 // indirect
+	github.com/prometheus/procfs v0.8.0 // indirect
+	github.com/rivo/uniseg v0.2.0 // indirect
+	github.com/spaolacci/murmur3 v1.1.0 // indirect
+	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
+	github.com/xdg-go/scram v1.1.1 // indirect
+	github.com/xdg-go/stringprep v1.0.3 // indirect
+	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
+	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
+	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
+	go.etcd.io/etcd/client/v3 v3.5.5 // indirect
+	go.opentelemetry.io/otel v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.10.0 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.11.0 // indirect
+	go.opentelemetry.io/otel/sdk v1.11.0 // indirect
+	go.opentelemetry.io/otel/trace v1.11.0 // indirect
+	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
+	go.uber.org/atomic v1.9.0 // indirect
+	go.uber.org/automaxprocs v1.5.1 // indirect
+	go.uber.org/multierr v1.8.0 // indirect
+	go.uber.org/zap v1.21.0 // indirect
+	golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
+	golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
+	golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
+	golang.org/x/sync v0.1.0 // indirect
+	golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
+	golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
+	golang.org/x/text v0.4.0 // indirect
+	golang.org/x/time v0.3.0 // indirect
+	google.golang.org/appengine v1.6.7 // indirect
+	google.golang.org/genproto v0.0.0-20221111202108-142d8a6fa32e // indirect
+	gopkg.in/inf.v0 v0.9.1 // indirect
+	gopkg.in/yaml.v2 v2.4.0 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
+	gorm.io/driver/mysql v1.0.5 // indirect
+	gorm.io/gorm v1.21.3 // indirect
+	k8s.io/api v0.22.9 // indirect
+	k8s.io/apimachinery v0.22.9 // indirect
+	k8s.io/client-go v0.22.9 // indirect
+	k8s.io/klog/v2 v2.80.1 // indirect
+	k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 // indirect
+	sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
+	sigs.k8s.io/yaml v1.2.0 // indirect
+)

Файловите разлики са ограничени, защото са твърде много
+ 567 - 29
jyBXSubscribe/go.sum


+ 4 - 1
jyBXSubscribe/rpc/bxsubscribe.go

@@ -5,6 +5,9 @@ import (
 	"fmt"
 	"log"
 
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gcfg"
+
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/internal/server"
 	"jyBXSubscribe/rpc/internal/svc"
@@ -25,6 +28,7 @@ var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
 
 func main() {
 	//初始化基本配置
+	g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("etc/config.yaml")
 	conf.MustLoad(*configF, &IC.C)
 	//初始化数据库配置
 	conf.MustLoad(*dbFile, &IC.DB)
@@ -52,7 +56,6 @@ func main() {
 	//日志记录
 	//s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
-
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	s.Start()
 }

+ 40 - 14
jyBXSubscribe/rpc/bxsubscribe.proto

@@ -27,6 +27,7 @@ message SubscribeInfosReq {
   int64 newUserId = 21;
   bool IsEnt = 22;
   string SelectIds = 23;
+  int64 positionType = 24;
 }
 
 message SubscribeInfosResp {
@@ -88,8 +89,11 @@ message SomeInfoReq{
   string  appId = 1;
   string  userId = 2;
   string  userType = 3;
-  int64   newUserId = 4;
-  string   entId = 5;
+  string  newUserId = 4;
+  string  entId = 5;
+  string  accountId = 6;
+  string  positionType = 7;
+  string  positionId = 8;
 }
 
 message SomeInfoResp {
@@ -122,18 +126,9 @@ message ByPushHistoryResp{
 
 
 message UpdateSubScribeInfoReq{
-  map<string, CityList> area = 1; //地区
-  repeated string buyerclass = 2;//采购单位类型
-  repeated Items items = 3;//关键词
-  repeated string infotype = 4;//信息类型
-  string matchway = 5;//匹配方式 1标题 2正文
-  string projectmatch = 6;//项目匹配 1开始 0关闭
-  string ratemode = 7;// 1:实时推送,2:每天9点推送,3:每周推送,4:每月推送 5:每日推送两次
-  string apppush = 8;//app推送 1开启 0关闭
-  string mailpush = 9;//邮箱推送 1开启 0关闭
-  string mail = 10;//邮箱
-  string otherbuyerclass = 11;//匹配未分类类型 1匹配 0不匹配
-  string userId = 12;//用户id
+  bytes subSet = 1;//订阅设置
+  string userId = 2;//用户id
+  int64  PositionType = 3;
 }
 
 //城市
@@ -180,6 +175,7 @@ message SetReadReq{
   int64   newUserId = 6;
   string  entUserId = 7;
   bool    isEnt = 8;
+  int64 positionType = 9;
 }
 message GetKeyReq{
   string  appId = 1;
@@ -194,6 +190,7 @@ message GetKeyReq{
   int64   powerSource = 11;
   int64   userPower = 12;
   string  deptId = 13;
+  int64   positionType = 14;
 }
 
 message GetDistributorReq{
@@ -218,6 +215,33 @@ message KeyResp {
   string err_msg = 2;
   repeated KeyItems items = 3;//关键词
 }
+message List{
+  repeated string value = 1;
+}
+//订阅设置
+message Subscribe{
+  map<string, List> area = 1;//地区
+  repeated string buyerclass = 2;//采购单位类型
+  repeated string infotype = 3;//信息类型
+  repeated Items items = 4;//关键词
+  int64 matchway = 5;//匹配方式 1标题 2正文
+  int64 projectmatch = 6;//项目匹配
+  bool  keytip = 7;
+}
+message UserReq{
+  string appId = 1;
+  int64 entUserId = 2;
+  string types = 3;//类型,不传按默认规则获取 m大会员 e商机管理 v超级订阅 f免费订阅
+  int64 positionType = 4;//职位类型 0个人 1企业
+  string userId = 5;
+  int64 entId = 6;
+}
+//用户权益
+message UserResq{
+  Subscribe data = 1;
+  string error_msg = 2;
+  int64 error_code = 3;
+}
 
 message DistributorResp {
   int64 err_code = 1;
@@ -298,6 +322,8 @@ service Bxsubscribe {
   rpc SetRead(SetReadReq)returns(StatusResp);
   //关键词获取
   rpc GetKey(GetKeyReq)returns(KeyResp);
+  //订阅设置获取
+  rpc GetSubScribeInfo(UserReq)returns(UserResq);
   //信息分发
   rpc MsgDistributor(MsgDistributorReq)returns(StatusResp);
   //手动分发人员查询

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

@@ -0,0 +1,139 @@
+// Code generated by goctl. DO NOT EDIT!
+// Source: bxsubscribe.proto
+
+package bxsubscribe
+
+import (
+	"context"
+
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+
+	"github.com/zeromicro/go-zero/zrpc"
+	"google.golang.org/grpc"
+)
+
+type (
+	ByPushHistoryResp      = bxsubscribe.ByPushHistoryResp
+	CityList               = bxsubscribe.CityList
+	DistributorResp        = bxsubscribe.DistributorResp
+	GetDistributorReq      = bxsubscribe.GetDistributorReq
+	GetKeyReq              = bxsubscribe.GetKeyReq
+	GetViewStatusReq       = bxsubscribe.GetViewStatusReq
+	Items                  = bxsubscribe.Items
+	Key                    = bxsubscribe.Key
+	KeyItems               = bxsubscribe.KeyItems
+	KeyResp                = bxsubscribe.KeyResp
+	Keys                   = bxsubscribe.Keys
+	List                   = bxsubscribe.List
+	MsgDistributorReq      = bxsubscribe.MsgDistributorReq
+	SetReadReq             = bxsubscribe.SetReadReq
+	SomeInfo               = bxsubscribe.SomeInfo
+	SomeInfoReq            = bxsubscribe.SomeInfoReq
+	SomeInfoResp           = bxsubscribe.SomeInfoResp
+	StatusResp             = bxsubscribe.StatusResp
+	Subscribe              = bxsubscribe.Subscribe
+	SubscribeData          = bxsubscribe.SubscribeData
+	SubscribeInfo          = bxsubscribe.SubscribeInfo
+	SubscribeInfosReq      = bxsubscribe.SubscribeInfosReq
+	SubscribeInfosResp     = bxsubscribe.SubscribeInfosResp
+	UpdateSubScribeInfoReq = bxsubscribe.UpdateSubScribeInfoReq
+	UserReq                = bxsubscribe.UserReq
+	UserResp               = bxsubscribe.UserResp
+	UserResq               = bxsubscribe.UserResq
+	UserStatus             = bxsubscribe.UserStatus
+	ViewStatusResp         = bxsubscribe.ViewStatusResp
+	WinnerInfo             = bxsubscribe.WinnerInfo
+
+	Bxsubscribe interface {
+		// 获取订阅推送列表
+		GetSubList(ctx context.Context, in *SubscribeInfosReq, opts ...grpc.CallOption) (*SubscribeInfosResp, error)
+		// 获取订阅推送相关信息
+		GetSubSomeInfo(ctx context.Context, in *SomeInfoReq, opts ...grpc.CallOption) (*SomeInfoResp, error)
+		// 修改订阅信息接口
+		UpdateSubScribeInfo(ctx context.Context, in *UpdateSubScribeInfoReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 推送页面筛选导出
+		ByPushHistory(ctx context.Context, in *SubscribeInfosReq, opts ...grpc.CallOption) (*ByPushHistoryResp, error)
+		// 推送数据浏览状态修改
+		SetRead(ctx context.Context, in *SetReadReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 关键词获取
+		GetKey(ctx context.Context, in *GetKeyReq, opts ...grpc.CallOption) (*KeyResp, error)
+		// 订阅设置获取
+		GetSubScribeInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserResq, error)
+		// 信息分发
+		MsgDistributor(ctx context.Context, in *MsgDistributorReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 手动分发人员查询
+		GetDistributor(ctx context.Context, in *GetDistributorReq, opts ...grpc.CallOption) (*DistributorResp, error)
+		// 查看状态
+		GetViewStatus(ctx context.Context, in *GetViewStatusReq, opts ...grpc.CallOption) (*ViewStatusResp, error)
+	}
+
+	defaultBxsubscribe struct {
+		cli zrpc.Client
+	}
+)
+
+func NewBxsubscribe(cli zrpc.Client) Bxsubscribe {
+	return &defaultBxsubscribe{
+		cli: cli,
+	}
+}
+
+// 获取订阅推送列表
+func (m *defaultBxsubscribe) GetSubList(ctx context.Context, in *SubscribeInfosReq, opts ...grpc.CallOption) (*SubscribeInfosResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.GetSubList(ctx, in, opts...)
+}
+
+// 获取订阅推送相关信息
+func (m *defaultBxsubscribe) GetSubSomeInfo(ctx context.Context, in *SomeInfoReq, opts ...grpc.CallOption) (*SomeInfoResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.GetSubSomeInfo(ctx, in, opts...)
+}
+
+// 修改订阅信息接口
+func (m *defaultBxsubscribe) UpdateSubScribeInfo(ctx context.Context, in *UpdateSubScribeInfoReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.UpdateSubScribeInfo(ctx, in, opts...)
+}
+
+// 推送页面筛选导出
+func (m *defaultBxsubscribe) ByPushHistory(ctx context.Context, in *SubscribeInfosReq, opts ...grpc.CallOption) (*ByPushHistoryResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.ByPushHistory(ctx, in, opts...)
+}
+
+// 推送数据浏览状态修改
+func (m *defaultBxsubscribe) SetRead(ctx context.Context, in *SetReadReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.SetRead(ctx, in, opts...)
+}
+
+// 关键词获取
+func (m *defaultBxsubscribe) GetKey(ctx context.Context, in *GetKeyReq, opts ...grpc.CallOption) (*KeyResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.GetKey(ctx, in, opts...)
+}
+
+// 订阅设置获取
+func (m *defaultBxsubscribe) GetSubScribeInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserResq, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.GetSubScribeInfo(ctx, in, opts...)
+}
+
+// 信息分发
+func (m *defaultBxsubscribe) MsgDistributor(ctx context.Context, in *MsgDistributorReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.MsgDistributor(ctx, in, opts...)
+}
+
+// 手动分发人员查询
+func (m *defaultBxsubscribe) GetDistributor(ctx context.Context, in *GetDistributorReq, opts ...grpc.CallOption) (*DistributorResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.GetDistributor(ctx, in, opts...)
+}
+
+// 查看状态
+func (m *defaultBxsubscribe) GetViewStatus(ctx context.Context, in *GetViewStatusReq, opts ...grpc.CallOption) (*ViewStatusResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.GetViewStatus(ctx, in, opts...)
+}

+ 5 - 2
jyBXSubscribe/rpc/etc/bxsubscribe.yaml

@@ -13,5 +13,8 @@ DefaulCount:
 CodeServiceConf:
   Etcd:
     Hosts:
-      - 127.0.0.1:2379
-    Key: codeservice.rpc
+      - 192.168.3.149:2379
+    Key: codeservice.rpc
+UserCenterKey: "usercenter.rpc" #用户中台rpc
+PowerCheckCenterKey: "powercheck.rpc" #权益校验中台
+EntManageApplication: "entmanageapplication.rpc" #企业管理中台

+ 13 - 2
jyBXSubscribe/rpc/init/init.go

@@ -1,13 +1,16 @@
 package init
 
 import (
+	"jyBXSubscribe/entity"
+	"jyBXSubscribe/rpc/internal/config"
+
+	"app.yhyue.com/moapp/jypkg/compatible"
+	"app.yhyue.com/moapp/jypkg/middleground"
 	codePb "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/zeromicro/go-zero/core/discov"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/zrpc"
-	"jyBXSubscribe/entity"
-	"jyBXSubscribe/rpc/internal/config"
 )
 
 var C config.Config
@@ -19,6 +22,8 @@ var DB config.Db
 
 //var codLib
 var Logc entity.Logc
+var Middleground *middleground.Middleground
+var Compatible *compatible.Compatible
 
 func InitC() {
 	//初始mongodb
@@ -29,6 +34,11 @@ func InitC() {
 	RedisInit(&DB.Redis)
 	//初始es
 	EsInit(&DB.Es)
+	Middleground = middleground.NewMiddleground(C.CodeServiceConf.Etcd.Hosts).
+		RegUserCenter(C.UserCenterKey).
+		RegPowerCheckCenter(C.PowerCheckCenterKey).
+		RegEntManageApplication(C.EntManageApplication)
+	Compatible = compatible.NewCompatible(&Mgo, BaseServiceMysql, MainMysql, Middleground)
 	if len(Logc.Level) > 0 {
 		for _, v := range Logc.Level {
 			logx.MustSetup(logx.LogConf{
@@ -49,4 +59,5 @@ func InitC() {
 	})
 	logx.Info("CodeService初始化")
 	CodeLib = codePb.NewCodeService(codeClient)
+
 }

+ 6 - 2
jyBXSubscribe/rpc/internal/config/config.go

@@ -1,8 +1,9 @@
 package config
 
 import (
-	"github.com/zeromicro/go-zero/zrpc"
 	"jyBXSubscribe/entity"
+
+	"github.com/zeromicro/go-zero/zrpc"
 )
 
 type Config struct {
@@ -13,7 +14,10 @@ type Config struct {
 		Pay  int
 		Free int
 	}
-	CodeServiceConf zrpc.RpcClientConf
+	CodeServiceConf      zrpc.RpcClientConf
+	UserCenterKey        string
+	PowerCheckCenterKey  string
+	EntManageApplication string
 }
 
 type Db struct {

+ 3 - 18
jyBXSubscribe/rpc/internal/logic/bypushhistorylogic.go

@@ -67,28 +67,14 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 		IsEnt:            in.IsEnt,
 		UserType:         in.UserType,
 	}
-
 	//主体处理(fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户)
-	infoCount := int64(0)
-	if in.UserType == model.MemberFlag {
-		infoCount = IC.MainMysql.CountBySql("select  count(id) from  entniche_wait_empower where  ent_id=? and  end_time>NOW() and  product_type like '%大会员%' ", in.EntId)
-	} else if in.UserType == model.SubVipFlag {
-		infoCount = IC.MainMysql.CountBySql("select  count(id) from  entniche_wait_empower where  ent_id=? and  end_time>NOW() and product_type like '%VIP订阅%' ", in.EntId)
-	}
-	if infoCount > 0 {
-		in.UserType = model.EntnicheFlag
-		vipType = model.EntnicheFlag
-		//主体等于企业的
-		spqp.BuySubject = 1
-	}
-
-	if in.IsEnt == true {
-		newCount := IC.MainMysql.CountBySql("select  count(id) from  entniche_info where  id =? and  status=1", spqp.EntId)
-		if newCount > 0 {
+	if in.UserType == model.MemberFlag || in.UserType == model.SubVipFlag || in.UserType == model.SubFreeFlag {
+		if in.PositionType == 1 {
 			in.UserType = model.EntnicheFlag
 			vipType = model.EntnicheFlag
 		}
 	}
+
 	if in.UserType == model.EntnicheFlag {
 		spqp.UserId = common.InterfaceToStr(spqp.EntUserId)
 	}
@@ -96,7 +82,6 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 	if selectIds := strings.TrimSpace(in.SelectIds); selectIds != "" {
 		spqp.SelectInfoIds = strings.Split(selectIds, ",")
 	}
-
 	_, _, list := model.NewSubscribePush(vipType).Datas(spqp)
 	if list == nil || len(list) == 0 {
 		return &bxsubscribe.ByPushHistoryResp{

+ 11 - 10
jyBXSubscribe/rpc/internal/logic/getkeylogic.go

@@ -27,16 +27,17 @@ func NewGetKeyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetKeyLogi
 func (l *GetKeyLogic) GetKey(in *bxsubscribe.GetKeyReq) (*bxsubscribe.KeyResp, error) {
 	// todo: add your logic here and delete this line
 	spqp := &model.KeyParam{
-		UserId:      in.UserId,    //用户id
-		EntId:       in.EntId,     //商机管理企业id
-		EntUserId:   in.EntUserId, //商机管理用户id
-		NewUserId:   in.NewUserId,
-		IsEnt:       in.IsEnt,
-		VipPower:    in.VipPower,
-		MemberPower: in.MemberPower,
-		PowerSource: in.PowerSource,
-		UserPower:   in.UserPower,
-		DeptId:      in.DeptId,
+		UserId:       in.UserId,    //用户id
+		EntId:        in.EntId,     //商机管理企业id
+		EntUserId:    in.EntUserId, //商机管理用户id
+		NewUserId:    in.NewUserId,
+		IsEnt:        in.IsEnt,
+		VipPower:     in.VipPower,
+		MemberPower:  in.MemberPower,
+		PowerSource:  in.PowerSource,
+		UserPower:    in.UserPower,
+		DeptId:       in.DeptId,
+		PositionType: in.PositionType,
 	}
 	data := model.NewSubscribePush(in.UserType).Keys(spqp)
 	return &bxsubscribe.KeyResp{

+ 5 - 5
jyBXSubscribe/rpc/internal/logic/getkeylogic_test.go

@@ -30,15 +30,15 @@ func TestGetKeyLogic_GetKey(t *testing.T) {
 			name: "超级订阅获取",
 			args: args{
 				in: &bxsubscribe.GetKeyReq{
-					UserType:    "eType",
-					UserId:      "63537f6928a125cdb8a36071",
+					UserType:    "mType",
+					UserId:      "5e8eb60ae138234b4f91aacf",
 					EntId:       "14640",
 					AppId:       "10000",
 					EntUserId:   "4962",
 					NewUserId:   185483,
-					UserPower:   1,
-					MemberPower: 1,
-					IsEnt:       true,
+					UserPower:   0,
+					MemberPower: 0,
+					IsEnt:       false,
 				},
 			},
 		},

+ 5 - 10
jyBXSubscribe/rpc/internal/logic/getsublistlogic.go

@@ -81,19 +81,14 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 		IsEnt:            in.IsEnt,
 		BuySubject:       0,
 		UserType:         in.UserType,
+		PositionType:     in.PositionType,
 		IsPayUser:        isPayUser,
 	}
 	//主体处理(fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户)
-	infoCount := int64(0)
-	if in.UserType == model.MemberFlag {
-		infoCount = IC.MainMysql.CountBySql("select  count(id) from  entniche_wait_empower where  ent_id=? and  end_time>NOW() and  product_type like '%大会员%' ", in.EntId)
-	} else if in.UserType == model.SubVipFlag {
-		infoCount = IC.MainMysql.CountBySql("select  count(id) from  entniche_wait_empower where  ent_id=? and  end_time>NOW() and product_type like '%VIP订阅%' ", in.EntId)
-	}
-	if infoCount > 0 {
-		in.UserType = model.EntnicheFlag
-		//主体等于企业的
-		spqp.BuySubject = 1
+	if in.UserType == model.MemberFlag || in.UserType == model.SubVipFlag || in.UserType == model.SubFreeFlag {
+		if in.PositionType == 1 {
+			in.UserType = model.EntnicheFlag
+		}
 	}
 	if in.UserType == model.EntnicheFlag {
 		spqp.UserId = common.InterfaceToStr(spqp.EntUserId)

+ 9 - 9
jyBXSubscribe/rpc/internal/logic/getsublistlogic_test.go

@@ -123,23 +123,23 @@ func TestGetSubListLogic_GetSubList(t *testing.T) {
 				in: &bxsubscribe.SubscribeInfosReq{
 					PageNum:    1,
 					PageSize:   50,
-					SelectTime: "",
+					SelectTime: "all",
 					Area:       "",
 					City:       "",
 					BuyerClass: "",
-					Subtype:    "",
+					Subtype:    "合同",
 					KeyWords:   "",
 					Industry:   "",
-					UserType:   "fType",
-					UserId:     "5fd1bc2447da52d4c953f10a",
-					EntId:      "0",
+					UserType:   "vType",
+					UserId:     "638af5cbb5b8a4e7edf5c8dc",
+					EntId:      "15186",
 					AppId:      "10000",
 					Price:      "",
 					FileExists: "",
-					EntUserId:  "0",
-					DeptId:     "1111",
-					NewUserId:  69146,
-					IsEnt: false,
+					EntUserId:  "4852",
+					DeptId:     "",
+					NewUserId:  335887,
+					IsEnt:      false,
 				},
 			},
 			want:    nil,

+ 107 - 0
jyBXSubscribe/rpc/internal/logic/getsubscribeinfologic.go

@@ -0,0 +1,107 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"context"
+	"jyBXSubscribe/rpc/model"
+
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetSubScribeInfoLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetSubScribeInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubScribeInfoLogic {
+	return &GetSubScribeInfoLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 订阅设置获取
+func (l *GetSubScribeInfoLogic) GetSubScribeInfo(in *bxsubscribe.UserReq) (*bxsubscribe.UserResq, error) {
+	// todo: add your logic here and delete this line
+	//data := model.NewSubscribePush(in.Types).GetSubScribeInfo(in)
+	data := &map[string]interface{}{}
+	items, ok := (*data)["items"].([]map[string]interface{})
+	if !ok {
+		inter_items, _ := (*data)["items"].([]interface{})
+		items = common.ObjArrToMapArr(inter_items)
+	}
+	buyerclass, _ := (*data)["buyerclass"].([]interface{})
+	infotype, _ := (*data)["infotype"].([]interface{})
+	keytip := false
+	if in.Types == model.MemberFlag && in.PositionType == 0 {
+		keytip = (*data)["b_keytip"].(bool)
+	}
+	return &bxsubscribe.UserResq{
+		ErrorCode: 0,
+		ErrorMsg:  "",
+		Data: &bxsubscribe.Subscribe{
+			Area:         l.formatM(common.ObjToMap((*data)["area"])),
+			Buyerclass:   common.ObjArrToStringArr(buyerclass),
+			Infotype:     common.ObjArrToStringArr(infotype),
+			Matchway:     common.Int64All((*data)["matchway"]),
+			Projectmatch: common.Int64All((*data)["projectmatch"]),
+			Items:        l.formatItems(items),
+			Keytip:       keytip,
+		},
+	}, nil
+}
+
+//格式转化 map<string,list>转化
+func (l *GetSubScribeInfoLogic) formatM(m *map[string]interface{}) map[string]*bxsubscribe.List {
+	retM := map[string]*bxsubscribe.List{}
+	if len(*m) == 0 {
+		return retM
+	}
+	for k, v := range *m {
+		s_v, ok := v.([]string)
+		if !ok {
+			interf, _ := v.([]interface{})
+			s_v = common.ObjArrToStringArr(interf)
+		}
+		retM[k] = &bxsubscribe.List{
+			Value: s_v,
+		}
+	}
+	return retM
+}
+
+func (l *GetSubScribeInfoLogic) formatItems(m []map[string]interface{}) []*bxsubscribe.Items {
+	items := make([]*bxsubscribe.Items, len(m))
+	for k, v := range m {
+		items[k] = &bxsubscribe.Items{
+			SItem:      common.ObjToString(v["s_item"]),
+			UpdateTime: common.Int64All(v["updatetime"]),
+		}
+		akey, _ := v["a_key"].([]map[string]interface{})
+		pbKey := make([]*bxsubscribe.Keys, len(akey))
+		for kk, vv := range akey {
+			key, ok := vv["key"].([]string)
+			if !ok {
+				inter_vv, _ := vv["key"].([]interface{})
+				key = common.ObjArrToStringArr(inter_vv)
+			}
+			notkey, ok := vv["notkey"].([]string)
+			if !ok {
+				inter_vv, _ := vv["notkey"].([]interface{})
+				notkey = common.ObjArrToStringArr(inter_vv)
+			}
+			pbKey[kk] = &bxsubscribe.Keys{
+				Key:        key,
+				Notkey:     notkey,
+				UpdateTime: common.If(vv["updatetime"] == nil, int64(0), common.Int64All(vv["updatetime"])).(int64),
+			}
+		}
+		items[k].AKey = pbKey
+	}
+	return items
+}

+ 34 - 4
jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic.go

@@ -6,6 +6,7 @@ import (
 	"context"
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/model"
+	"strconv"
 	"time"
 
 	"jyBXSubscribe/rpc/internal/svc"
@@ -31,9 +32,27 @@ func NewGetSubSomeInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
 // 获取订阅推送相关信息
 func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsubscribe.SomeInfoResp, error) {
 	resp := &bxsubscribe.SomeInfoResp{
-		Data: &bxsubscribe.SomeInfo{},
+		Data: &bxsubscribe.SomeInfo{
+			HasKey:      false,
+			IsInTSguide: false,
+			IsExpire:    0,
+			IsOnTail:    0,
+			IsPassCount: false,
+			OtherFlag:   false,
+			IsRead:      false,
+			Industry:    nil,
+			UserId:      "",
+		},
 	}
-	user, _ := model.NewSubscribePush(in.UserType).UserInfo(in.UserId)
+	baseUserId, _ := strconv.ParseInt(in.NewUserId, 10, 64)
+	//accountId, _ := strconv.ParseInt(in.AccountId, 10, 64)
+	//positionType, _ := strconv.ParseInt(in.PositionType, 10, 64)
+	//positionId, _ := strconv.ParseInt(in.PositionId, 10, 64)
+	//entId, _ := strconv.ParseInt(in.EntId, 10, 64)
+	//userInfo := IC.Compatible.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, baseUserId, accountId, entId, positionType, positionId)
+	//logx.Info("userInfo:", userInfo)
+	//P278 身份切换,切换企业 userId从代理header 获取的值是 职位id,所以改成用base_user_id 进行查user表信息
+	user, _ := model.NewSubscribePush(in.UserType).UserInfo(baseUserId)
 	//
 	resp.Data.HasKey, resp.Data.Industry = model.GetKeySet(in.UserType, user, []string{})
 	todayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
@@ -73,8 +92,19 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 			}
 			resp.Data.IsPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+in.UserId) >= 150
 		}
+		//是否进入向导查询
+		resp.Data.IsInTSguide = func() bool {
+			//付费用户无免费订阅,不进入订阅向导页面
+			if common.IntAll((*user)["i_member_status"]) > 0 || common.IntAll((*user)["i_vip_status"]) > 0 {
+				return false
+			}
+			o_jy, _ := (*user)["o_jy"].(map[string]interface{})
+			iTsGuide := common.IntAll((*user)["i_ts_guide"])
+			if iTsGuide == 2 || (iTsGuide == 0 && len(o_jy) == 0) {
+				return true
+			}
+			return false
+		}()
 	}
-	//是否进入想到查询
-	resp.Data.IsInTSguide = model.NewSubscribePush().IsInTsGuide(in.UserId)
 	return resp, nil
 }

+ 2 - 2
jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic_test.go

@@ -3,8 +3,8 @@ package logic
 import (
 	"context"
 	"github.com/zeromicro/go-zero/core/logx"
-	"jyBXSubscribe/rpc/bxsubscribe"
 	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
 	"reflect"
 	"testing"
 )
@@ -32,7 +32,7 @@ func TestGetSubSomeInfoLogic_GetSubSomeInfo(t *testing.T) {
 				AppId:     "10000",
 				UserId:    "5e8eb60ae138234b4f91aacf",
 				UserType:  "mType",
-				NewUserId: 11111,
+				NewUserId: "11111",
 			},
 			},
 		},

+ 6 - 3
jyBXSubscribe/rpc/internal/logic/setreadlogic.go

@@ -2,7 +2,6 @@ package logic
 
 import (
 	"context"
-	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/model"
 
 	"jyBXSubscribe/rpc/internal/svc"
@@ -31,7 +30,7 @@ func (l *SetReadLogic) SetRead(in *bxsubscribe.SetReadReq) (*bxsubscribe.StatusR
 	resp := &bxsubscribe.StatusResp{}
 	//主体处理(fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户)
 	userType := in.UserType
-	infoCount := int64(0)
+	/*infoCount := int64(0)
 	if in.UserType == model.MemberFlag {
 		infoCount = IC.MainMysql.CountBySql("select  count(id) from  entniche_wait_empower where  ent_id=? and  end_time>NOW() and product_type like '%大会员%' ", in.EntId)
 	} else if in.UserType == model.SubVipFlag {
@@ -40,8 +39,12 @@ func (l *SetReadLogic) SetRead(in *bxsubscribe.SetReadReq) (*bxsubscribe.StatusR
 
 	if infoCount > 0 {
 		in.UserType = model.EntnicheFlag
+	}*/
+	if in.UserType == model.MemberFlag || in.UserType == model.SubVipFlag || in.UserType == model.SubFreeFlag {
+		if in.PositionType == 1 {
+			in.UserType = model.EntnicheFlag
+		}
 	}
-
 	model.NewSubscribePush(in.UserType).SetRead(in.NewUserId, in.Vsid, in.UserId, in.EntUserId, in.EntId, in.IsEnt, userType)
 	return resp, nil
 }

+ 11 - 61
jyBXSubscribe/rpc/internal/logic/updatesubscribeinfologic.go

@@ -2,11 +2,12 @@ package logic
 
 import (
 	"context"
+	"encoding/json"
 	"fmt"
+	. "jyBXSubscribe/entity"
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/internal/svc"
 	"jyBXSubscribe/rpc/model/service"
-
 	"jyBXSubscribe/rpc/type/bxsubscribe"
 
 	"github.com/zeromicro/go-zero/core/logx"
@@ -27,70 +28,19 @@ func NewUpdateSubScribeInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext
 }
 
 // 修改订阅信息接口
-func (l *UpdateSubScribeInfoLogic) UpdateSubScribeInfo(in *bxsubscribe.UpdateSubScribeInfoReq) (*bxsubscribe.StatusResp, error) {
+func (l *UpdateSubScribeInfoLogic) UpdateSubScribeInfo(inc *bxsubscribe.UpdateSubScribeInfoReq) (*bxsubscribe.StatusResp, error) {
 	// todo: add your logic here and delete this line
 	resp := &bxsubscribe.StatusResp{}
-	subService := &service.SubseribeService{
-		UserId: in.UserId,
-	}
-	if in.Area != nil {
-		//格式转换 地区
-		areaMap := map[string]interface{}{}
-		for k, v := range in.Area {
-			areaMap[k] = v.City
-		}
-		subService.Area = areaMap
-	}
-	//关键词转换
-	if in.Items != nil {
-		items := []map[string]interface{}{}
-		item := map[string]interface{}{}
-		for _, v := range in.Items {
-			item["s_item"] = v.SItem
-			item["updatetime"] = v.UpdateTime
-			akey := []map[string]interface{}{}
-			for _, vv := range v.AKey {
-				akey = append(akey, map[string]interface{}{
-					"key":       vv.Key,
-					"matchway":  vv.Matchway,
-					"appendkey": vv.AppendKey,
-					"notkey":    vv.Notkey,
-				})
-			}
-			item["a_key"] = akey
-			items = append(items)
-		}
-		subService.Items = items
-	}
-	//
-	if in.Apppush != "" {
-		subService.Apppush = in.Apppush
-	}
-	if in.Buyerclass != nil {
-		subService.Buyerclass = in.Buyerclass
-	}
-	if in.Infotype != nil {
-		subService.Infotype = in.Infotype
+	in := &SubscribeUpdate{}
+	err := json.Unmarshal(inc.SubSet, &in)
+	if err != nil {
+		return resp, nil
 	}
-	if in.Mail != "" {
-		subService.Mail = in.Mail
-	}
-	if in.Mailpush != "" {
-		subService.Mailpush = in.Mailpush
-	}
-	if in.Matchway != "" {
-		subService.Matchway = in.Matchway
-	}
-	if in.Ratemode != "" {
-		subService.Ratemode = in.Ratemode
-	}
-	if in.Projectmatch != "" {
-		subService.Projectmatch = in.Projectmatch
-	}
-	if in.Otherbuyerclass != "" {
-		subService.Otherbuyerclass = in.Otherbuyerclass
+	subService := &service.SubseribeService{
+		UserId:          inc.UserId,
+		Mgo:             IC.Mgo,
+		SubscribeUpdate: in,
 	}
-	subService.Mgo = IC.Mgo
 	status, err := subService.Update()
 	if err != nil || status == 0 {
 		l.Error(fmt.Sprintf("%+v", in), err.Error())

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

@@ -58,6 +58,12 @@ func (s *BxsubscribeServer) GetKey(ctx context.Context, in *bxsubscribe.GetKeyRe
 	return l.GetKey(in)
 }
 
+// 订阅设置获取
+func (s *BxsubscribeServer) GetSubScribeInfo(ctx context.Context, in *bxsubscribe.UserReq) (*bxsubscribe.UserResq, error) {
+	l := logic.NewGetSubScribeInfoLogic(ctx, s.svcCtx)
+	return l.GetSubScribeInfo(in)
+}
+
 // 信息分发
 func (s *BxsubscribeServer) MsgDistributor(ctx context.Context, in *bxsubscribe.MsgDistributorReq) (*bxsubscribe.StatusResp, error) {
 	l := logic.NewMsgDistributorLogic(ctx, s.svcCtx)

+ 6 - 38
jyBXSubscribe/rpc/model/distributor.go

@@ -87,54 +87,22 @@ func Distributor(region []string, entId, entUserId int) []*User {
 					}
 				}
 			}
-			if isEnt && v.Power == 1 { // 企业未分配规则 商机管理用户查询个人
-				data, ok := IC.Mgo.FindOne("entniche_rule", map[string]interface{}{
+			if (isEnt && v.Power == 1) || n1 != 0 || n2 != 0 { // 企业未分配规则 商机管理用户查询个人
+				data, _ := IC.Mgo.Find("entniche_rule", map[string]interface{}{
 					"i_userid": v.Id,
 					"i_entid":  entId,
-				})
-				if ok && data != nil && len(*data) > 0 {
-					o_entniche, _ := (*data)["o_entniche"].(map[string]interface{})
-					o_area, _ := o_entniche["o_area"].(map[string]interface{})
+				}, "", nil, false, -1, 1)
+				for _, value := range *data {
+					o_entniche := common.ObjToMap(value["o_entniche"])
+					o_area, _ := (*o_entniche)["o_area"].(map[string]interface{})
 					if regionCheck(o_area, regions) {
 						ss = append(ss, v)
 						continue //商机管理
 					}
 				}
 			}
-
-			// 企业未分配规则 非商机管理用户  判断是否分配大会员或超级订阅
-			//user表 判断区域是否符合
-			if (n1 != 0 || n2 != 0) && v.Phone != "" {
-				//查询user表订阅区域
-				data, ok := IC.Mgo.FindOne("user", map[string]interface{}{
-					"$or": []map[string]interface{}{{"s_phone": v.Phone}, {"s_m_phone": v.Phone}},
-				})
-				if ok && data != nil && len(*data) > 0 {
-					o_area := make(map[string]interface{})
-					i_member_status := common.IntAll((*data)["i_member_status"])
-					i_vip_status := common.IntAll((*data)["i_vip_status"])
-					o_member_jy, _ := (*data)["o_member_jy"].(map[string]interface{})
-					o_vipjy, _ := (*data)["o_vipjy"].(map[string]interface{})
-					if n2 != 0 && i_member_status > 0 { //有大会员权益 校验区域
-						o_area, _ = o_member_jy["o_area"].(map[string]interface{})
-						if regionCheck(o_area, regions) {
-							ss = append(ss, v)
-							continue
-						}
-					}
-					if n1 != 0 && i_vip_status > 0 { //有超级订阅权益 校验区域
-						o_area, _ = o_vipjy["o_area"].(map[string]interface{})
-						if regionCheck(o_area, regions) {
-							ss = append(ss, v)
-							continue
-						}
-					}
-				}
-			}
 		}
-
 	}
-
 	return ss
 }
 

+ 109 - 95
jyBXSubscribe/rpc/model/push.go

@@ -107,21 +107,23 @@ type SubPushQueryParam struct {
 	SelectInfoIds    []string
 	BuySubject       int64
 	UserType         string
+	PositionType     int64
 	IsPayUser        bool // 是否是付费用户
 }
 
 // 关键词参数
 type KeyParam struct {
-	UserId      string //用户id
-	EntUserId   string //商机管理用户id
-	DeptId      string //商机管理用户部门id
-	NewUserId   int64
-	IsEnt       bool
-	VipPower    int64
-	EntId       string //企业id
-	MemberPower int64
-	PowerSource int64
-	UserPower   int64
+	UserId       string //用户id
+	EntUserId    string //商机管理用户id
+	DeptId       string //商机管理用户部门id
+	NewUserId    int64
+	IsEnt        bool
+	VipPower     int64
+	EntId        string //企业id
+	MemberPower  int64
+	PowerSource  int64
+	UserPower    int64
+	PositionType int64
 }
 
 func (spqp *SubPushQueryParam) IsEmpty() bool {
@@ -177,6 +179,8 @@ func (s *subscribePush) allKey(userId, userType string) string {
 			return fmt.Sprintf("all_%s_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, "vip", userId)
 		case MemberFlag:
 			return fmt.Sprintf("all_%s_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, "member", userId)
+		case SubFreeFlag:
+			return fmt.Sprintf("all_%s_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, "free", userId)
 		}
 	}
 	return fmt.Sprintf("all_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId)
@@ -301,7 +305,7 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
 	start := (spqp.PageNum - 1) * spqp.PageSize
 	end := start + spqp.PageSize
 	//时间是今天,没有别的过滤条件--首先读取当前推送缓存数据 其次查询数据库
-	if nowFormat == date.FormatDateByInt64(&starttime, date.Date_Short_Layout) && spqp.Area == "" && spqp.City == "" && spqp.Buyerclass == "" && spqp.Subscopeclass == "" && spqp.Subtype == "" && spqp.Key == "" && spqp.Price == "" && spqp.FileExists == "" && len(spqp.Staffs) == 0 && spqp.Source == "" && spqp.IsRead == "" {
+	if nowFormat == date.FormatDateByInt64(&starttime, date.Date_Short_Layout) && spqp.Area == "" && spqp.City == "" && spqp.Buyerclass == "" && spqp.Subscopeclass == "" && spqp.Subtype == "" && spqp.Key == "" && spqp.Price == "" && spqp.FileExists == "" && len(spqp.Staffs) == 0 && spqp.Source == "" && spqp.IsRead == "" && len(spqp.SelectInfoIds) == 0 {
 		subPush := &SubPush{}
 		var err error
 		if spqp.IsEnt == false {
@@ -408,7 +412,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		} else if starttime == 0 && endtime > 0 {
 			userStr += fmt.Sprintf(" and a.date<=%d", endtime)
 		}
-
 		if spqp.Area != "" || spqp.City != "" {
 			var sqlAreaCity = ""
 			//城市
@@ -474,7 +477,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				if codeMap.Data.Subtype[v] != "" {
 					subtype = append(subtype, fmt.Sprint(codeMap.Data.Subtype[v]))
 				}
-
 			}
 			if len(subtype) == 1 {
 				subtype = append(subtype, "9999")
@@ -482,7 +484,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			if len(subtype) > 0 {
 				querys = append(querys, fmt.Sprintf("b.subtype_code in (%s)", strings.Join(subtype, ",")))
 			}
-
 		}
 		//信息行业
 		if spqp.Subscopeclass != "" {
@@ -491,7 +492,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				if codeMap.Data.Subscopeclass[v] != "" {
 					find_in_set = append(find_in_set, codeMap.Data.Subscopeclass[v])
 				}
-
 			}
 			if len(find_in_set) > 0 {
 				leftJoinStr = fmt.Sprintf(" STRAIGHT_JOIN %s t on t.infoid = b.infoid and t.labelcode=2 ", BidTags)
@@ -535,7 +535,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		if spqp.IsEnt {
 			var staffs []string
 			userStr += fmt.Sprintf(" and  a.entid='%s' ", spqp.EntId)
-
 			//判断是企业管理员还是部门管理员 部门管理员获取所有子部门
 			userEnt := EntInfo(common.IntAll(spqp.EntId), common.IntAll(spqp.EntUserId))
 			if !(userEnt.Role_admin_system || userEnt.Role_admin_department) {
@@ -564,7 +563,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			} else if len(spqp.Staffs) > 0 {
 				staffs = spqp.Staffs
 			}
-
 			//老板商机管理需要查询全部来源
 			isNew := true
 			//商机管理判断
@@ -572,7 +570,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			if newCount > 0 {
 				isNew = false
 			}
-
 			// 无查询分配人员、是否已读
 			if spqp.IsRead == "" && len(staffs) == 0 {
 				//查询数量(需要去重)
@@ -610,15 +607,16 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			if spqp.Source == "1" || spqp.Source == "2" || spqp.Source == "3" {
 				userStr += " and a.source=" + spqp.Source
 			}
-
-			if spqp.BuySubject == 1 {
+			if spqp.PositionType == 1 {
 				//企业主体是企业的个人查询
 				if spqp.UserType == SubVipFlag {
-					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=1 or a.source>1     ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=1 or a.product=3 or a.source>1     ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				} else if spqp.UserType == MemberFlag {
-					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=2  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=2 or a.product=3  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+				} else if spqp.UserType == EntnicheFlag {
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product is null or a.product=3  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				} else {
-					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product is null  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+					userStr += fmt.Sprintf(" and  a.userid='%s' ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				}
 			} else {
 				if s.ModuleFlag == EntnicheFlag {
@@ -629,13 +627,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 					userStr += fmt.Sprintf(" and  a.userid='%s'", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				}
 			}
-
 			//查询数量
-			//if len(querys) > 1 {
 			countSql = fmt.Sprintf("select count(1) as count from %s  a STRAIGHT_JOIN %s b ON a.infoid = b.infoid  %s where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, leftJoinStr, userStr, strings.Join(querys, " and "))
-			//} else {
-			//	countSql = fmt.Sprintf("select count(1) as count from %s  a where 1=1 %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr)
-			//}
 			//列表查询语句
 			findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
 			if s.ModuleFlag == EntnicheFlag {
@@ -969,16 +962,16 @@ func (s *subscribePush) SetRead(newUserId, id int64, userId, entUserId, entId st
 	return nil
 }
 
-// 获取用户信息
-func (s *subscribePush) UserInfo(userId string) (*map[string]interface{}, int64) {
-	user, ok := IC.Mgo.FindById("user", userId, `{"s_m_openid":1,"a_m_openid":1,"s_phone":1,"a_mergeorder":1,"o_jy":1,"l_firstpushtime":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1,"i_member_status":1,"o_member_jy":1}`)
+// UserInfo 获取用户信息
+func (s *subscribePush) UserInfo(baseUserId int64) (*map[string]interface{}, int64) {
+	user, ok := IC.Mgo.FindOneByField("user", map[string]interface{}{"base_user_id": baseUserId}, `{"i_ts_guide":1,"s_m_openid":1,"a_m_openid":1,"s_phone":1,"a_mergeorder":1,"o_jy":1,"l_firstpushtime":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1,"i_member_status":1,"o_member_jy":1}`)
 	if !ok || user == nil {
 		return nil, 0
 	}
 	return user, common.Int64All((*user)["l_firstpushtime"])
 }
 
-// 是否有订阅词
+// GetKeySet 是否有订阅词
 func GetKeySet(t string, u *map[string]interface{}, data []string) (bool, []string) {
 	var industry_ = []string{}
 	if u != nil {
@@ -1477,18 +1470,89 @@ func (s *subscribePush) IsInTsGuide(userid string) bool {
 }
 func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 	keyData := map[string][]interface{}{}
-	if !spqp.IsEnt {
+	if spqp.IsEnt {
+		//企业关键词查找
+		res_, _ := IC.Mgo.Find("entniche_rule", map[string]interface{}{
+			"i_userid": map[string]interface{}{
+				"$exists": false,
+			},
+			"i_entid": common.Int64All(spqp.EntId),
+		}, "", `{"o_entniche":1}`, false, -1, -1)
+		o_entniche := map[string]interface{}{}
+		if res_ == nil || len(*res_) == 0 {
+			return MapToarr(keyData)
+		}
+		for _, ruleV := range *res_ {
+			o_entniche = common.StructToMapMore(ruleV["o_entniche"])
+			if o_entniche["a_items"] != nil {
+				a_item := common.ObjArrToMapArr(o_entniche["a_items"].([]interface{}))
+				for _, v := range a_item {
+					if v["a_key"] != nil {
+						a_key_arr := v["a_key"].([]interface{})
+						s_item := common.InterfaceToStr(v["s_item"])
+						if keyData[s_item] != nil {
+							//第一次搜索存在
+							//去重
+							keyData[s_item] = MergeArray(a_key_arr, keyData[s_item])
+						} else {
+							//第一次搜索不存在
+							keyData[s_item] = a_key_arr
+						}
+					}
+				}
+			}
+		}
+
+	} else {
 		//个人关键词查找
 		//fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户
-		mData, ok := IC.Mgo.FindById("user", spqp.UserId, `{"o_jy":1,"o_vipjy":1,"o_member_jy":1,""i_member_sub_status":1,"s_member_mainid":1}`)
-		if s.ModuleFlag == SubVipFlag {
-			//从user表中取 o_vipjy.a_items
+		types := 2
+		typeKey := ""
+		switch s.ModuleFlag {
+		case SubVipFlag:
+			types = 1
+			typeKey = "o_vipjy"
+		case MemberFlag:
+			types = 1
+			typeKey = "o_member_jy"
+		case EntnicheFlag:
+			types = 0
+			typeKey = "o_entniche"
+		}
+		if spqp.PositionType == 1 {
+			typeKey = "o_entniche"
+		}
+		o_entniche := &map[string]interface{}{}
+		if spqp.PositionType == 0 {
+			mData, ok := IC.Mgo.FindById("user", spqp.UserId, `{"o_jy":1,"o_vipjy":1,"o_member_jy":1,""i_member_sub_status":1,"s_member_mainid":1}`)
 			if mData == nil || len(*mData) == 0 || !ok {
 				return nil
 			}
-			o_vipjy := common.ObjToMap((*mData)["o_vipjy"])
-			if (*o_vipjy)["a_items"] != nil {
-				a_items := common.ObjArrToMapArr((*o_vipjy)["a_items"].([]interface{}))
+			if s.ModuleFlag == MemberFlag {
+				sub_status := common.Int64All((*mData)["i_member_sub_status"])
+				if sub_status == 1 {
+					//大会员子账号处理
+					mData, ok = IC.Mgo.FindById("user", common.InterfaceToStr((*mData)["s_member_mainid"]), `{"o_jy":1,"o_vipjy":1,"o_member_jy":1,""i_member_sub_status":1,"s_member_mainid":1}`)
+					if mData == nil || len(*mData) == 0 || !ok {
+						return nil
+					}
+				}
+			}
+			o_entniche = common.ObjToMap((*mData)[typeKey])
+		} else {
+			res_, _ := IC.Mgo.FindOneByField("entniche_rule", map[string]interface{}{
+				"i_userid": common.Int64All(spqp.EntUserId),
+				"i_entid":  common.Int64All(spqp.EntId),
+				"i_type":   types,
+			}, `{"o_entniche":1}`)
+			if res_ != nil {
+				o_entniche = common.ObjToMap((*res_)["o_entniche"])
+			}
+		}
+		if s.ModuleFlag == SubVipFlag {
+			//从user表中取 o_vipjy.a_items
+			if (*o_entniche)["a_items"] != nil {
+				a_items := common.ObjArrToMapArr((*o_entniche)["a_items"].([]interface{}))
 				for _, v := range a_items {
 					if v["a_key"] != nil {
 						a_key_arr := v["a_key"].([]interface{})
@@ -1498,20 +1562,9 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 			}
 		} else if s.ModuleFlag == MemberFlag {
 			//从user表中取 o_member_jy.a_items
-			if mData == nil || len(*mData) == 0 || !ok {
-				return nil
-			}
-			sub_status := common.Int64All((*mData)["i_member_sub_status"])
-			if sub_status == 1 {
-				//大会员子账号处理
-				mData, ok = IC.Mgo.FindById("user", common.InterfaceToStr((*mData)["s_member_mainid"]), `{"o_jy":1,"o_vipjy":1,"o_member_jy":1,""i_member_sub_status":1,"s_member_mainid":1}`)
-				if mData == nil || len(*mData) == 0 || !ok {
-					return nil
-				}
-			}
-			o_memeberjy := common.ObjToMap((*mData)["o_member_jy"])
-			if (*o_memeberjy)["a_items"] != nil {
-				a_items := common.ObjArrToMapArr((*o_memeberjy)["a_items"].([]interface{}))
+			//o_memeberjy := common.ObjToMap((*mData)["o_member_jy"])
+			if (*o_entniche)["a_items"] != nil {
+				a_items := common.ObjArrToMapArr((*o_entniche)["a_items"].([]interface{}))
 				for _, v := range a_items {
 					if v["a_key"] != nil {
 						a_key_arr := v["a_key"].([]interface{})
@@ -1520,10 +1573,10 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 				}
 			}
 		} else if s.ModuleFlag == EntnicheFlag {
-			//entniche_rule表,查询条件:{i_entid:123,i_userid:456},取 o_entniche.a_items
 			res_, _ := IC.Mgo.FindOneByField("entniche_rule", map[string]interface{}{
 				"i_userid": common.Int64All(spqp.EntUserId),
 				"i_entid":  common.Int64All(spqp.EntId),
+				"i_type":   types,
 			}, `{"o_entniche":1}`)
 			o_entniche := &map[string]interface{}{}
 			if res_ != nil {
@@ -1539,12 +1592,8 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 				}
 			}
 		} else {
-			if mData == nil || len(*mData) == 0 || !ok {
-				return nil
-			}
-			o_jy, _ := (*mData)["o_jy"].(map[string]interface{})
 			//免费用户
-			a_key, _ := o_jy["a_key"].([]interface{})
+			a_key, _ := (*o_entniche)["a_key"].([]interface{})
 			if len(a_key) > 0 {
 				for _, v := range a_key {
 					if keyData["未分类"] != nil {
@@ -1555,7 +1604,7 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 				}
 			}
 		}
-		if (spqp.VipPower == 1 || spqp.MemberPower == 1) || (spqp.UserPower == 1 && spqp.PowerSource == 0) {
+		if spqp.PositionType == 1 && s.ModuleFlag != SubFreeFlag {
 			//1、mysql entniche_user_rule表中获取自己的分发规则id
 			data := IC.MainMysql.SelectBySql(`SELECT rule_id FROM entniche_user_rule a 
                                                                         INNER JOIN entniche_department b ON  a.dept_id = b.id AND a.user_id =?
@@ -1612,43 +1661,8 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 						keyData[v] = entnicheRule[v]
 					}
 				}
-
-			}
-		}
-	} else {
-		//企业关键词查找
-		res_, _ := IC.Mgo.Find("entniche_rule", map[string]interface{}{
-			"i_userid": map[string]interface{}{
-				"$exists": false,
-			},
-			"i_entid": common.Int64All(spqp.EntId),
-		}, "", `{"o_entniche":1}`, false, -1, -1)
-		o_entniche := map[string]interface{}{}
-		if res_ == nil || len(*res_) == 0 {
-
-			return MapToarr(keyData)
-		}
-		for _, ruleV := range *res_ {
-			o_entniche = common.StructToMapMore(ruleV["o_entniche"])
-			if o_entniche["a_items"] != nil {
-				a_item := common.ObjArrToMapArr(o_entniche["a_items"].([]interface{}))
-				for _, v := range a_item {
-					if v["a_key"] != nil {
-						a_key_arr := v["a_key"].([]interface{})
-						s_item := common.InterfaceToStr(v["s_item"])
-						if keyData[s_item] != nil {
-							//第一次搜索存在
-							//去重
-							keyData[s_item] = MergeArray(a_key_arr, keyData[s_item])
-						} else {
-							//第一次搜索不存在
-							keyData[s_item] = a_key_arr
-						}
-					}
-				}
 			}
 		}
-
 	}
 	return MapToarr(keyData)
 

+ 9 - 22
jyBXSubscribe/rpc/model/service/subscribe.go

@@ -4,6 +4,7 @@ package service
 import (
 	"errors"
 	"jyBXSubscribe/entity"
+	IC "jyBXSubscribe/rpc/init"
 	"strconv"
 
 	"app.yhyue.com/moapp/jybase/common"
@@ -13,20 +14,11 @@ import (
 
 //
 type SubseribeService struct {
-	Mgo             mongodb.MongodbSim
-	UserId          string                   //mongodb 的用户id
-	Types           string                   //订阅信息产品类型 超级订阅、大会员、商机管理、免费订阅...
-	Area            map[string]interface{}   //地区
-	Buyerclass      []string                 //采购单位类型
-	Items           []map[string]interface{} //关键词
-	Infotype        []string                 //信息类型
-	Matchway        string                   //匹配方式 1标题 2正文
-	Projectmatch    string                   //项目匹配 1开始 0关闭
-	Ratemode        string                   // 1:实时推送,2:每天9点推送,3:每周推送,4:每月推送 5:每日推送两次
-	Apppush         string                   //app推送 1开启 0关闭
-	Mailpush        string                   //邮箱推送 1开启 0关闭
-	Mail            string                   //邮箱
-	Otherbuyerclass string                   //匹配未分类类型 1匹配 0不匹配
+	Mgo          mongodb.MongodbSim
+	UserId       string //mongodb 的用户id
+	Types        string //订阅信息产品类型 超级订阅、大会员、商机管理、免费订阅...
+	PositionType int64
+	*entity.SubscribeUpdate
 }
 
 // @description  	订阅设置相关修改
@@ -39,15 +31,11 @@ func (this *SubseribeService) Update() (int64, error) {
 		return -1, errors.New(entity.UPDATE_ERROR_MSG)
 	}
 	//查询条件
-	query := map[string]interface{}{
-		"_id": mongodb.StringTOBsonId(this.UserId),
-	}
 	//查询字段
 	fields := `{"i_vip_status":1,"o_vipjy":1}`
-
 	//查询用户信息
-	r, ok := this.Mgo.FindOneByField(entity.User, query, fields)
-	if !ok || r == nil || len(*r) == 0 {
+	r := IC.Compatible.Select(this.UserId, fields)
+	if r == nil || len(*r) == 0 {
 		logx.Error("未找到用户")
 		return -1, errors.New(entity.UPDATE_ERROR_MSG)
 	}
@@ -97,9 +85,8 @@ func (this *SubseribeService) Update() (int64, error) {
 	if this.Otherbuyerclass != "" {
 		i_otherbuyerclass, _ := strconv.Atoi(this.Otherbuyerclass)
 		setMap["o_vipjy.i_matchbuyerclass_other"] = i_otherbuyerclass
-
 	}
-	if ok := this.Mgo.UpdateById(entity.User, this.UserId, map[string]interface{}{
+	if ok := IC.Compatible.Update(this.UserId, map[string]interface{}{
 		"$set": setMap,
 	}); ok {
 		return 1, nil

+ 1 - 2
jyBXSubscribe/rpc/model/service/subscribe_test.go

@@ -17,7 +17,6 @@ func init() {
 		ReplSet:     "",
 	}
 	MgoT.InitPool()
-
 }
 func TestSubseribeService_Update(t *testing.T) {
 	type fields struct {
@@ -89,7 +88,7 @@ func TestSubseribeService_Update(t *testing.T) {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 			this := &SubseribeService{
-				Mgo:          tt.fields.Mgo,
+				Mgo:          *MgoT,
 				UserId:       tt.fields.UserId,
 				Types:        tt.fields.Types,
 				Area:         tt.fields.Area,

Файловите разлики са ограничени, защото са твърде много
+ 632 - 369
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go


+ 47 - 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.2.0
-// - protoc             v3.19.4
+// - protoc             v3.20.0--rc2
 // source: bxsubscribe.proto
 
 package bxsubscribe
@@ -34,7 +34,13 @@ type BxsubscribeClient interface {
 	SetRead(ctx context.Context, in *SetReadReq, opts ...grpc.CallOption) (*StatusResp, error)
 	// 关键词获取
 	GetKey(ctx context.Context, in *GetKeyReq, opts ...grpc.CallOption) (*KeyResp, error)
+<<<<<<< HEAD
 	// 信息分发
+=======
+	//订阅设置获取
+	GetSubScribeInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserResq, error)
+	//信息分发
+>>>>>>> master
 	MsgDistributor(ctx context.Context, in *MsgDistributorReq, opts ...grpc.CallOption) (*StatusResp, error)
 	// 手动分发人员查询
 	GetDistributor(ctx context.Context, in *GetDistributorReq, opts ...grpc.CallOption) (*DistributorResp, error)
@@ -108,6 +114,15 @@ func (c *bxsubscribeClient) GetKey(ctx context.Context, in *GetKeyReq, opts ...g
 	return out, nil
 }
 
+func (c *bxsubscribeClient) GetSubScribeInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserResq, error) {
+	out := new(UserResq)
+	err := c.cc.Invoke(ctx, "/bxsubscribe.Bxsubscribe/GetSubScribeInfo", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *bxsubscribeClient) MsgDistributor(ctx context.Context, in *MsgDistributorReq, opts ...grpc.CallOption) (*StatusResp, error) {
 	out := new(StatusResp)
 	err := c.cc.Invoke(ctx, "/bxsubscribe.Bxsubscribe/MsgDistributor", in, out, opts...)
@@ -169,7 +184,13 @@ type BxsubscribeServer interface {
 	SetRead(context.Context, *SetReadReq) (*StatusResp, error)
 	// 关键词获取
 	GetKey(context.Context, *GetKeyReq) (*KeyResp, error)
+<<<<<<< HEAD
 	// 信息分发
+=======
+	//订阅设置获取
+	GetSubScribeInfo(context.Context, *UserReq) (*UserResq, error)
+	//信息分发
+>>>>>>> master
 	MsgDistributor(context.Context, *MsgDistributorReq) (*StatusResp, error)
 	// 手动分发人员查询
 	GetDistributor(context.Context, *GetDistributorReq) (*DistributorResp, error)
@@ -204,6 +225,9 @@ func (UnimplementedBxsubscribeServer) SetRead(context.Context, *SetReadReq) (*St
 func (UnimplementedBxsubscribeServer) GetKey(context.Context, *GetKeyReq) (*KeyResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetKey not implemented")
 }
+func (UnimplementedBxsubscribeServer) GetSubScribeInfo(context.Context, *UserReq) (*UserResq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetSubScribeInfo not implemented")
+}
 func (UnimplementedBxsubscribeServer) MsgDistributor(context.Context, *MsgDistributorReq) (*StatusResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method MsgDistributor not implemented")
 }
@@ -340,6 +364,24 @@ func _Bxsubscribe_GetKey_Handler(srv interface{}, ctx context.Context, dec func(
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Bxsubscribe_GetSubScribeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(UserReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BxsubscribeServer).GetSubScribeInfo(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/bxsubscribe.Bxsubscribe/GetSubScribeInfo",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BxsubscribeServer).GetSubScribeInfo(ctx, req.(*UserReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _Bxsubscribe_MsgDistributor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(MsgDistributorReq)
 	if err := dec(in); err != nil {
@@ -461,6 +503,10 @@ var Bxsubscribe_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GetKey",
 			Handler:    _Bxsubscribe_GetKey_Handler,
 		},
+		{
+			MethodName: "GetSubScribeInfo",
+			Handler:    _Bxsubscribe_GetSubScribeInfo_Handler,
+		},
 		{
 			MethodName: "MsgDistributor",
 			Handler:    _Bxsubscribe_MsgDistributor_Handler,

Някои файлове не бяха показани, защото твърде много файлове са промени