瀏覽代碼

Merge branch 'master' into feature/v1.1.17

lianbingjie 2 年之前
父節點
當前提交
ea1436a3b4
共有 31 個文件被更改,包括 2980 次插入237 次删除
  1. 42 0
      jyBXSubscribe/api/bxsubscribe.api
  2. 28 0
      jyBXSubscribe/api/internal/handler/getPushSetHandler.go
  3. 28 0
      jyBXSubscribe/api/internal/handler/getUserHandler.go
  4. 20 0
      jyBXSubscribe/api/internal/handler/routes.go
  5. 28 0
      jyBXSubscribe/api/internal/handler/setPushSetHandler.go
  6. 28 0
      jyBXSubscribe/api/internal/handler/setUserHandler.go
  7. 51 0
      jyBXSubscribe/api/internal/logic/getPushSetLogic.go
  8. 49 0
      jyBXSubscribe/api/internal/logic/getUserLogic.go
  9. 54 0
      jyBXSubscribe/api/internal/logic/setPushSetLogic.go
  10. 49 0
      jyBXSubscribe/api/internal/logic/setUserLogic.go
  11. 37 0
      jyBXSubscribe/api/internal/types/types.go
  12. 86 5
      jyBXSubscribe/rpc/bxsubscribe.proto
  13. 42 1
      jyBXSubscribe/rpc/bxsubscribe/bxsubscribe.go
  14. 2 1
      jyBXSubscribe/rpc/etc/bxsubscribe.yaml
  15. 4 0
      jyBXSubscribe/rpc/init/db.go
  16. 0 2
      jyBXSubscribe/rpc/init/init.go
  17. 1 0
      jyBXSubscribe/rpc/internal/config/config.go
  18. 48 0
      jyBXSubscribe/rpc/internal/logic/getpushsetlogic.go
  19. 0 167
      jyBXSubscribe/rpc/internal/logic/getsublistlogic_test.go
  20. 47 0
      jyBXSubscribe/rpc/internal/logic/setpushsetlogic.go
  21. 0 10
      jyBXSubscribe/rpc/internal/logic/setreadlogic.go
  22. 46 0
      jyBXSubscribe/rpc/internal/logic/setuserlogic.go
  23. 677 0
      jyBXSubscribe/rpc/internal/logic/updatesubscribeinfologic_test.go
  24. 146 0
      jyBXSubscribe/rpc/internal/logic/userinfologic.go
  25. 25 1
      jyBXSubscribe/rpc/internal/server/bxsubscribeserver.go
  26. 9 2
      jyBXSubscribe/rpc/model/push.go
  27. 295 0
      jyBXSubscribe/rpc/model/service/pushSet.go
  28. 2 0
      jyBXSubscribe/rpc/model/service/subscribe.go
  29. 965 47
      jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go
  30. 153 1
      jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe_grpc.pb.go
  31. 18 0
      jyBXSubscribe/rpc/util/util.go

+ 42 - 0
jyBXSubscribe/api/bxsubscribe.api

@@ -51,6 +51,7 @@ type (
 		Err_code int64       `json:"error_code"`
 		Err_msg  string      `json:"error_msg"`
 		Data     interface{} `json:"data"`
+		TimeData interface{} `json:"timeData"`
 	}
 	//
 	subscribeUpdateReq {
@@ -120,6 +121,39 @@ type (
 		MessageId string `json:"messageId"`
 		Staffs    string `json:"staffs"`
 	}
+	GetUserReq {
+		AppId        string `header:"appId"`
+		EntId        int64  `header:"entId,optional"`
+		EntUserId    int64  `header:"entUserId,optional"`
+		PositionType int64  `header:"positionType,optional"`
+		UserId       string `header:"mgoUserId,optional"`
+		BaseUserId   int64  `header:"newUserId,optional"`
+		ServiceType  string `json:"serviceType,optional"`
+		PositionId   int64  `header:"positionId,optiona"`
+		AccountId    int64  `header:"accountId,optiona"`
+	}
+	SetUserReq {
+		AppId        string `header:"appId"`
+		EntId        int64  `header:"entId,optional"`
+		EntUserId    int64  `header:"entUserId,optional"`
+		PositionType int64  `header:"positionType,optional"`
+		UserId       string `header:"userId,optional"`
+		Mail         string `json:"mail,optional"`
+	}
+	SetPushSetReq {
+		AppId        string   `header:"appId"`
+		EntId        int64    `header:"entId,optional"`
+		EntUserId    int64    `header:"entUserId,optional"`
+		PositionType int64    `header:"positionType,optional"`
+		UserId       string   `header:"mgoUserId,optional"`
+		Item         string   `json:"item,optional"`
+		SetType      string   `json:"setType"`
+		Ratemode     int64    `json:"ratemode,optional"`
+		Times        []string `json:"times,optional"`
+		PushType     string   `json:"pushType,optional"`
+		PushValue    int64    `json:"pushValue,optional"`
+		Interested   int64    `json:"interested,optional"`
+	}
 )
 service bxsubscribe-api {
 	@handler subscribeList
@@ -140,4 +174,12 @@ service bxsubscribe-api {
 	post /jybx/subscribe/:userType/viewStatus(viewStatusReq) returns (commonResp)
 	@handler msgDistributor
 	post /jybx/subscribe/msgDistributor(msgDistributor) returns (commonResp)
+	@handler getUser //查询用户信息
+	post /jybx/subscribe/getUser (GetUserReq) returns (commonResp)
+	@handler setUser  //设置用户信息
+	post /jybx/subscribe/setUser (SetUserReq) returns (commonResp)
+	@handler getPushSet  //推送设置查询
+	post /jybx/subscribe/getPushSet (GetUserReq) returns (commonResp)
+	@handler setPushSet  //推送设置修改
+	post /jybx/subscribe/setPushSet (SetPushSetReq) returns (commonResp)
 }

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

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

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

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

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

@@ -57,6 +57,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/jybx/subscribe/msgDistributor",
 				Handler: msgDistributorHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/getUser",
+				Handler: getUserHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/setUser",
+				Handler: setUserHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/getPushSet",
+				Handler: getPushSetHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/subscribe/setPushSet",
+				Handler: setPushSetHandler(serverCtx),
+			},
 		},
 	)
 }

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

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

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

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

+ 51 - 0
jyBXSubscribe/api/internal/logic/getPushSetLogic.go

@@ -0,0 +1,51 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+
+	"jyBXSubscribe/api/internal/svc"
+	"jyBXSubscribe/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetPushSetLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetPushSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPushSetLogic {
+	return &GetPushSetLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *GetPushSetLogic) GetPushSet(req *types.GetUserReq) (*types.CommonResp, error) {
+	// todo: add your logic here and delete this line
+	res, err := l.svcCtx.Suscribe.GetPushSet(l.ctx, &bxsubscribe.GetPushSetReq{
+		UserId:       req.UserId,
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionType: req.PositionType,
+		PositionId:   req.PositionId,
+		AccountId:    req.AccountId,
+		BaseUserId:   req.BaseUserId,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: res.ErrorCode,
+			Err_msg:  res.ErrorMsg,
+			Data:     nil,
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrorCode,
+		Err_msg:  res.ErrorMsg,
+		Data:     res.Data,
+		TimeData: res.TimeData,
+	}, nil
+}

+ 49 - 0
jyBXSubscribe/api/internal/logic/getUserLogic.go

@@ -0,0 +1,49 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+
+	"jyBXSubscribe/api/internal/svc"
+	"jyBXSubscribe/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetUserLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLogic {
+	return &GetUserLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *GetUserLogic) GetUser(req *types.GetUserReq) (*types.CommonResp, error) {
+	// todo: add your logic here and delete this line
+	res, err := l.svcCtx.Suscribe.UserInfo(l.ctx, &bxsubscribe.GetUserInfoReq{
+		UserId:       req.UserId,
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionType: req.PositionType,
+		BaseUserId:   req.BaseUserId,
+		ServiceType:  req.ServiceType,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: res.ErrorCode,
+			Err_msg:  res.ErrorMsg,
+			Data:     nil,
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrorCode,
+		Err_msg:  res.ErrorMsg,
+		Data:     res.Data,
+	}, nil
+}

+ 54 - 0
jyBXSubscribe/api/internal/logic/setPushSetLogic.go

@@ -0,0 +1,54 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/bxsubscribe"
+
+	"jyBXSubscribe/api/internal/svc"
+	"jyBXSubscribe/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type SetPushSetLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewSetPushSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetPushSetLogic {
+	return &SetPushSetLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *SetPushSetLogic) SetPushSet(req *types.SetPushSetReq) (*types.CommonResp, error) {
+	// todo: add your logic here and delete this line
+	res, err := l.svcCtx.Suscribe.SetPushSet(l.ctx, &bxsubscribe.SetPushSetReq{
+		UserId:       req.UserId,
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionType: req.PositionType,
+		Item:         req.Item,
+		PushType:     req.PushType,
+		PushValue:    req.PushValue,
+		Ratemode:     req.Ratemode,
+		Times:        req.Times,
+		SetType:      req.SetType,
+		Interested:   req.Interested,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: res.ErrorCode,
+			Err_msg:  res.ErrorMsg,
+			Data:     nil,
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrorCode,
+		Err_msg:  res.ErrorMsg,
+		Data:     nil,
+	}, nil
+}

+ 49 - 0
jyBXSubscribe/api/internal/logic/setUserLogic.go

@@ -0,0 +1,49 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+
+	"jyBXSubscribe/api/internal/svc"
+	"jyBXSubscribe/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type SetUserLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewSetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetUserLogic {
+	return &SetUserLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *SetUserLogic) SetUser(req *types.SetUserReq) (*types.CommonResp, error) {
+	// todo: add your logic here and delete this line
+
+	res, err := l.svcCtx.Suscribe.SetUser(l.ctx, &bxsubscribe.SetUserInfoReq{
+		UserId:       req.UserId,
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionType: req.PositionType,
+		Mail:         req.Mail,
+	})
+	if err != nil {
+		return &types.CommonResp{
+			Err_code: res.ErrorCode,
+			Err_msg:  res.ErrorMsg,
+			Data:     nil,
+		}, nil
+	}
+	return &types.CommonResp{
+		Err_code: res.ErrorCode,
+		Err_msg:  res.ErrorMsg,
+		Data:     nil,
+	}, nil
+}

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

@@ -43,6 +43,7 @@ type CommonResp struct {
 	Err_code int64       `json:"error_code"`
 	Err_msg  string      `json:"error_msg"`
 	Data     interface{} `json:"data"`
+	TimeData interface{} `json:"timeData"`
 }
 
 type SubscribeUpdateReq struct {
@@ -117,3 +118,39 @@ type MsgDistributor struct {
 	MessageId string `json:"messageId"`
 	Staffs    string `json:"staffs"`
 }
+
+type GetUserReq struct {
+	AppId        string `header:"appId"`
+	EntId        int64  `header:"entId,optional"`
+	EntUserId    int64  `header:"entUserId,optional"`
+	PositionType int64  `header:"positionType,optional"`
+	UserId       string `header:"mgoUserId,optional"`
+	BaseUserId   int64  `header:"newUserId,optional"`
+	ServiceType  string `json:"serviceType,optional"`
+	PositionId   int64  `header:"positionId,optiona"`
+	AccountId    int64  `header:"accountId,optiona"`
+}
+
+type SetUserReq struct {
+	AppId        string `header:"appId"`
+	EntId        int64  `header:"entId,optional"`
+	EntUserId    int64  `header:"entUserId,optional"`
+	PositionType int64  `header:"positionType,optional"`
+	UserId       string `header:"userId,optional"`
+	Mail         string `json:"mail,optional"`
+}
+
+type SetPushSetReq struct {
+	AppId        string   `header:"appId"`
+	EntId        int64    `header:"entId,optional"`
+	EntUserId    int64    `header:"entUserId,optional"`
+	PositionType int64    `header:"positionType,optional"`
+	UserId       string   `header:"mgoUserId,optional"`
+	Item         string   `json:"item,optional"`
+	SetType      string   `json:"setType"`
+	Ratemode     int64    `json:"ratemode,optional"`
+	Times        []string `json:"times,optional"`
+	PushType     string   `json:"pushType,optional"`
+	PushValue    int64    `json:"pushValue,optional"`
+	Interested   int64    `json:"interested,optional"`
+}

+ 86 - 5
jyBXSubscribe/rpc/bxsubscribe.proto

@@ -68,11 +68,11 @@ message subscribeInfo {
   string  site = 23; // 网站名称
   string buyerTel = 24; // 采购单位联系方式
   string buyerPerson = 25; // 采购单位联系人
-  string agency =26;//代理机构
-  string agencyPerson=27;//代理机构联系人
-  string agencyTel=28;//代理机构联系电话
-  int64 signendTime=29 ;// 报名截止日期
-  int64 bidendTime=30;// 投标截止日期
+  string agency = 26;//代理机构
+  string agencyPerson = 27;//代理机构联系人
+  string agencyTel = 28;//代理机构联系电话
+  int64 signendTime = 29 ;// 报名截止日期
+  int64 bidendTime = 30;// 投标截止日期
   repeated WinnerInfo winnerInfo = 31;// 中标企业信息
   string spiderCode = 33;//网站代码
 
@@ -274,6 +274,79 @@ message UserStatus {
   string visittime = 4;
   string date = 5;
 }
+message GetUserInfoReq{
+  string  appId = 1;
+  int64  entId = 2;
+  int64  entUserId = 3;
+  string  userId = 4;
+  int64   positionType = 5;
+  int64  baseUserId = 6;
+  string serviceType = 7;
+}
+message GetUserInfoResq{
+  GetUserInfo data = 1;
+  string error_msg = 2;
+  int64 error_code = 3;
+}
+message GetUserInfo{
+  string mail = 1;
+  int64  state = 2;
+  string imgUrl = 3;
+  string appUrl=4;
+  bool   showWx=5;
+}
+message SetUserInfoReq{
+  string  appId = 1;
+  int64  entId = 2;
+  int64  entUserId = 3;
+  string  userId = 4;
+  int64   positionType = 5;
+  string  mail = 6;
+}
+message GetPushSetReq{
+  string  appId = 1;
+  int64  entId = 2;
+  int64  entUserId = 3;
+  string  userId = 4;
+  int64   positionType = 5;
+  int64   positionId = 6;
+  int64   accountId = 7;
+  int64   baseUserId = 8;
+}
+
+message GetPushSetResp{
+  map<string, PushSet> data = 1;
+  map<int64,TimeJson> timeData=3;
+  string error_msg = 4;
+  int64 error_code = 5;
+}
+message  TimeJson{
+  repeated  string a_times = 1;
+}
+message PushSet{
+  repeated  string a_times = 1;
+  int64 i_wxpush = 2;
+  int64 i_apppush = 3;
+  int64 i_mailpush = 4;
+  int64 i_ratemode = 5;
+  int64 isWxShow = 6;
+  int64 interested=7;
+  int64 isMailShow=8;
+}
+message SetPushSetReq{
+  string  appId = 1;
+  int64  entId = 2;
+  int64  entUserId = 3;
+  string  userId = 4;
+  int64   positionType = 5;
+  string  item = 6;
+  string  setType = 7;
+  int64  ratemode = 8;
+  string  pushType = 9;
+  repeated  string  times = 10;
+  int64  pushValue = 11;
+  int64 interested = 12;
+}
 
 
 service Bxsubscribe {
@@ -297,4 +370,12 @@ service Bxsubscribe {
   rpc GetDistributor(GetDistributorReq)returns(DistributorResp);
   //查看状态
   rpc GetViewStatus(GetViewStatusReq)returns(ViewStatusResp);
+  //用户推送信息查看
+  rpc userInfo(GetUserInfoReq)returns(GetUserInfoResq);
+  //用户邮箱保存
+  rpc setUser(SetUserInfoReq)returns(StatusResp);
+  //用户推送设置查看
+  rpc getPushSet(GetPushSetReq)returns(GetPushSetResp);
+  //用户推送设置修改
+  rpc setPushSet(SetPushSetReq)returns(StatusResp);
 }

+ 42 - 1
jyBXSubscribe/rpc/bxsubscribe/bxsubscribe.go

@@ -1,4 +1,4 @@
-// Code generated by goctl. DO NOT EDIT!
+// Code generated by goctl. DO NOT EDIT.
 // Source: bxsubscribe.proto
 
 package bxsubscribe
@@ -18,6 +18,11 @@ type (
 	DistributorResp        = bxsubscribe.DistributorResp
 	GetDistributorReq      = bxsubscribe.GetDistributorReq
 	GetKeyReq              = bxsubscribe.GetKeyReq
+	GetPushSetReq          = bxsubscribe.GetPushSetReq
+	GetPushSetResp         = bxsubscribe.GetPushSetResp
+	GetUserInfo            = bxsubscribe.GetUserInfo
+	GetUserInfoReq         = bxsubscribe.GetUserInfoReq
+	GetUserInfoResq        = bxsubscribe.GetUserInfoResq
 	GetViewStatusReq       = bxsubscribe.GetViewStatusReq
 	Items                  = bxsubscribe.Items
 	Key                    = bxsubscribe.Key
@@ -26,7 +31,10 @@ type (
 	Keys                   = bxsubscribe.Keys
 	List                   = bxsubscribe.List
 	MsgDistributorReq      = bxsubscribe.MsgDistributorReq
+	PushSet                = bxsubscribe.PushSet
+	SetPushSetReq          = bxsubscribe.SetPushSetReq
 	SetReadReq             = bxsubscribe.SetReadReq
+	SetUserInfoReq         = bxsubscribe.SetUserInfoReq
 	SomeInfo               = bxsubscribe.SomeInfo
 	SomeInfoReq            = bxsubscribe.SomeInfoReq
 	SomeInfoResp           = bxsubscribe.SomeInfoResp
@@ -36,6 +44,7 @@ type (
 	SubscribeInfo          = bxsubscribe.SubscribeInfo
 	SubscribeInfosReq      = bxsubscribe.SubscribeInfosReq
 	SubscribeInfosResp     = bxsubscribe.SubscribeInfosResp
+	TimeJson               = bxsubscribe.TimeJson
 	UpdateSubScribeInfoReq = bxsubscribe.UpdateSubScribeInfoReq
 	UserReq                = bxsubscribe.UserReq
 	UserResp               = bxsubscribe.UserResp
@@ -65,6 +74,14 @@ type (
 		GetDistributor(ctx context.Context, in *GetDistributorReq, opts ...grpc.CallOption) (*DistributorResp, error)
 		// 查看状态
 		GetViewStatus(ctx context.Context, in *GetViewStatusReq, opts ...grpc.CallOption) (*ViewStatusResp, error)
+		// 用户推送信息查看
+		UserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResq, error)
+		// 用户邮箱保存
+		SetUser(ctx context.Context, in *SetUserInfoReq, opts ...grpc.CallOption) (*StatusResp, error)
+		// 用户推送设置查看
+		GetPushSet(ctx context.Context, in *GetPushSetReq, opts ...grpc.CallOption) (*GetPushSetResp, error)
+		// 用户推送设置修改
+		SetPushSet(ctx context.Context, in *SetPushSetReq, opts ...grpc.CallOption) (*StatusResp, error)
 	}
 
 	defaultBxsubscribe struct {
@@ -137,3 +154,27 @@ func (m *defaultBxsubscribe) GetViewStatus(ctx context.Context, in *GetViewStatu
 	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
 	return client.GetViewStatus(ctx, in, opts...)
 }
+
+// 用户推送信息查看
+func (m *defaultBxsubscribe) UserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResq, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.UserInfo(ctx, in, opts...)
+}
+
+// 用户邮箱保存
+func (m *defaultBxsubscribe) SetUser(ctx context.Context, in *SetUserInfoReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.SetUser(ctx, in, opts...)
+}
+
+// 用户推送设置查看
+func (m *defaultBxsubscribe) GetPushSet(ctx context.Context, in *GetPushSetReq, opts ...grpc.CallOption) (*GetPushSetResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.GetPushSet(ctx, in, opts...)
+}
+
+// 用户推送设置修改
+func (m *defaultBxsubscribe) SetPushSet(ctx context.Context, in *SetPushSetReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	client := bxsubscribe.NewBxsubscribeClient(m.cli.Conn())
+	return client.SetPushSet(ctx, in, opts...)
+}

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

@@ -17,4 +17,5 @@ CodeServiceConf:
     Key: codeservice.rpc
 UserCenterKey: "usercenter.rpc" #用户中台rpc
 PowerCheckCenterKey: "powercheck.rpc" #权益校验中台
-EntManageApplication: "entmanageapplication.rpc" #企业管理中台
+EntManageApplication: "entmanageapplication.rpc" #企业管理中台
+AppUrl: "/front/downloadJyApp/qr?page=%&source=%s"

+ 4 - 0
jyBXSubscribe/rpc/init/db.go

@@ -5,6 +5,8 @@ package init
 
 import (
 	elastic "app.yhyue.com/moapp/jybase/esv1"
+	"app.yhyue.com/moapp/jypkg/compatible"
+	"app.yhyue.com/moapp/jypkg/middleground"
 	"github.com/zeromicro/go-zero/core/logx"
 	"strings"
 
@@ -22,6 +24,8 @@ var (
 	MgoBidding       mongodb.MongodbSim
 	GlobalCommonData *mysql.Mysql
 )
+var Middleground *middleground.Middleground
+var Compatible *compatible.Compatible
 
 //
 func MongoDBInit(em *entity.Mongo) {

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

@@ -22,8 +22,6 @@ var DB config.Db
 
 //var codLib
 var Logc entity.Logc
-var Middleground *middleground.Middleground
-var Compatible *compatible.Compatible
 
 func InitC() {
 	//初始mongodb

+ 1 - 0
jyBXSubscribe/rpc/internal/config/config.go

@@ -18,6 +18,7 @@ type Config struct {
 	UserCenterKey        string
 	PowerCheckCenterKey  string
 	EntManageApplication string
+	AppUrl               string
 }
 
 type Db struct {

+ 48 - 0
jyBXSubscribe/rpc/internal/logic/getpushsetlogic.go

@@ -0,0 +1,48 @@
+package logic
+
+import (
+	"context"
+	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/model/service"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"jyBXSubscribe/rpc/util"
+)
+
+type GetPushSetLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetPushSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPushSetLogic {
+	return &GetPushSetLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 用户推送设置查看
+func (l *GetPushSetLogic) GetPushSet(in *bxsubscribe.GetPushSetReq) (*bxsubscribe.GetPushSetResp, error) {
+	// todo: add your logic here and delete this line
+	subService := &service.PushSetService{
+		UserId:       in.UserId,
+		PositionType: in.PositionType,
+		EntUserId:    in.EntUserId,
+		EntId:        in.EntId,
+		AccountId:    in.AccountId,
+		BaseUserId:   in.BaseUserId,
+		PositionId:   in.PositionId,
+	}
+	TimeData := map[int64]*bxsubscribe.TimeJson{}
+	for k, v := range util.TimeMap {
+		TimeData[int64(k)] = &bxsubscribe.TimeJson{ATimes: v}
+	}
+	pushSet := subService.Find()
+	return &bxsubscribe.GetPushSetResp{
+		Data:     pushSet,
+		TimeData: TimeData,
+	}, nil
+
+}

+ 0 - 167
jyBXSubscribe/rpc/internal/logic/getsublistlogic_test.go

@@ -1,167 +0,0 @@
-package logic
-
-import (
-	elastic "app.yhyue.com/moapp/jybase/esv1"
-	"app.yhyue.com/moapp/jybase/mongodb"
-	"app.yhyue.com/moapp/jybase/mysql"
-	"app.yhyue.com/moapp/jybase/redis"
-	codePb "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
-	"context"
-	"github.com/zeromicro/go-zero/core/discov"
-	"github.com/zeromicro/go-zero/core/logx"
-	"github.com/zeromicro/go-zero/zrpc"
-	"jyBXSubscribe/entity"
-	IC "jyBXSubscribe/rpc/init"
-	"jyBXSubscribe/rpc/internal/config"
-	"jyBXSubscribe/rpc/internal/svc"
-	"jyBXSubscribe/rpc/type/bxsubscribe"
-	"log"
-	"reflect"
-	"strings"
-	"testing"
-)
-
-func init() {
-	logx.Info("--初始化 mongodb--")
-	IC.Mgo = mongodb.MongodbSim{
-		MongodbAddr: "192.168.3.206:27080",
-		Size:        5,
-		DbName:      "qfw",
-	}
-	IC.Mgo.InitPool()
-	IC.DB = config.Db{Mongo: entity.Mongo{
-		Bidding: &entity.MongoStruct{
-			Collection:     "bidding",
-			CollectionBack: "bidding_back",
-		},
-	}}
-	IC.DB.Mongo.Bidding.Collection = "bidding_back"
-	//
-	logx.Info("--初始化 mongodb bidding--")
-	IC.MgoBidding = mongodb.MongodbSim{
-		MongodbAddr: "192.168.3.206:27001",
-		Size:        5,
-		DbName:      "qfw_data",
-		UserName:    "jyDevGroup",
-		Password:    "jy@DevGroup",
-	}
-	IC.MgoBidding.InitPool()
-
-	logx.Info("--初始化 mysql--")
-	IC.MainMysql = &mysql.Mysql{
-		Address:      "192.168.3.11:3366",
-		UserName:     "root",
-		PassWord:     "Topnet123",
-		DBName:       "jianyu",
-		MaxOpenConns: 5,
-		MaxIdleConns: 5,
-	}
-	IC.MainMysql.Init()
-
-	//初始化 mysql-EntnichePush
-	logx.Info("--初始化 商机管理推送 mysql--")
-	IC.BaseServiceMysql = &mysql.Mysql{
-		Address:      "192.168.3.217:4000",
-		UserName:     "root",
-		PassWord:     "=PDT49#80Z!RVv52_z",
-		DBName:       "base_service",
-		MaxOpenConns: 5,
-		MaxIdleConns: 5,
-	}
-	IC.BaseServiceMysql.Init()
-
-	//初始化 mysql-GlobalCommonData
-
-	logx.Info("--初始化 推送 mysql--")
-	IC.GlobalCommonData = &mysql.Mysql{
-		Address:      "192.168.3.217:4000",
-		UserName:     "root",
-		PassWord:     "=PDT49#80Z!RVv52_z",
-		DBName:       "global_common_data",
-		MaxOpenConns: 5,
-		MaxIdleConns: 5,
-	}
-	IC.GlobalCommonData.Init()
-
-	logx.Info("--初始化 redis--")
-	redis.InitRedisBySize(strings.Join([]string{"other=192.168.3.206:1712", "push=192.168.3.206:1712", "pushcache_1=192.168.3.206:5000", "pushcache_2_a=192.168.3.206:5001", "pushcache_2_b=192.168.3.206:5002"}, ","), 100, 30, 300)
-	//初始化 elasticsearch
-	logx.Info("--初始化 elasticsearch--")
-	elastic.InitElasticSize("http://192.168.3.206:9800", 5)
-	//代码表服务加载
-	codeClient := zrpc.MustNewClient(zrpc.RpcClientConf{
-		Etcd: discov.EtcdConf{
-			Hosts: []string{"127.0.0.1:2379"},
-			Key:   "codeservice.rpc",
-		},
-	})
-	logx.Info("CodeService初始化")
-	IC.CodeLib = codePb.NewCodeService(codeClient)
-}
-
-func TestGetSubListLogic_GetSubList(t *testing.T) {
-	type fields struct {
-		ctx    context.Context
-		svcCtx *svc.ServiceContext
-		Logger logx.Logger
-	}
-	type args struct {
-		in *bxsubscribe.SubscribeInfosReq
-	}
-	tests := []struct {
-		name    string
-		fields  fields
-		args    args
-		want    *bxsubscribe.SubscribeInfosResp
-		wantErr bool
-	}{
-		// TODO: Add test cases.
-		{
-			name:   "推送记录查看",
-			fields: fields{},
-			args: args{
-				in: &bxsubscribe.SubscribeInfosReq{
-					PageNum:    1,
-					PageSize:   50,
-					SelectTime: "all",
-					Area:       "",
-					City:       "",
-					BuyerClass: "",
-					Subtype:    "合同",
-					KeyWords:   "",
-					Industry:   "",
-					UserType:   "vType",
-					UserId:     "638af5cbb5b8a4e7edf5c8dc",
-					EntId:      "15186",
-					AppId:      "10000",
-					Price:      "",
-					FileExists: "",
-					EntUserId:  "4852",
-					DeptId:     "",
-					NewUserId:  335887,
-					IsEnt:      false,
-				},
-			},
-			want:    nil,
-			wantErr: true,
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			l := &GetSubListLogic{
-				ctx:    tt.fields.ctx,
-				svcCtx: tt.fields.svcCtx,
-				Logger: tt.fields.Logger,
-			}
-			got, err := l.GetSubList(tt.args.in)
-			log.Println(got)
-			if (err != nil) != tt.wantErr {
-				t.Errorf("GetSubList() error = %v, wantErr %v", err, tt.wantErr)
-				return
-			}
-			if !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("GetSubList() got = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}

+ 47 - 0
jyBXSubscribe/rpc/internal/logic/setpushsetlogic.go

@@ -0,0 +1,47 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/model/service"
+
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type SetPushSetLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewSetPushSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetPushSetLogic {
+	return &SetPushSetLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 用户推送设置修改
+func (l *SetPushSetLogic) SetPushSet(in *bxsubscribe.SetPushSetReq) (*bxsubscribe.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	subService := &service.PushSetService{
+		UserId:       in.UserId,
+		PositionType: in.PositionType,
+		EntUserId:    in.EntUserId,
+		EntId:        in.EntId,
+	}
+	fool := subService.Update(in.Item, in.SetType, in.PushType, in.Ratemode, in.PushValue, in.Interested, in.Times)
+	if fool {
+		return &bxsubscribe.StatusResp{
+			ErrorCode: 0,
+		}, nil
+	} else {
+		return &bxsubscribe.StatusResp{
+			ErrorCode: -1,
+		}, nil
+	}
+
+}

+ 0 - 10
jyBXSubscribe/rpc/internal/logic/setreadlogic.go

@@ -30,16 +30,6 @@ func (l *SetReadLogic) SetRead(in *bxsubscribe.SetReadReq) (*bxsubscribe.StatusR
 	resp := &bxsubscribe.StatusResp{}
 	//主体处理(fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户)
 	userType := in.UserType
-	/*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
-	}*/
 	if in.UserType == model.MemberFlag || in.UserType == model.SubVipFlag || in.UserType == model.SubFreeFlag {
 		if in.PositionType == 1 {
 			in.UserType = model.EntnicheFlag

+ 46 - 0
jyBXSubscribe/rpc/internal/logic/setuserlogic.go

@@ -0,0 +1,46 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/model/service"
+
+	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+)
+
+type SetUserLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewSetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetUserLogic {
+	return &SetUserLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 用户邮箱保存
+func (l *SetUserLogic) SetUser(in *bxsubscribe.SetUserInfoReq) (*bxsubscribe.StatusResp, error) {
+	// todo: add your logic here and delete this line
+	subService := &service.PushSetService{
+		UserId:       in.UserId,
+		PositionType: in.PositionType,
+		EntUserId:    in.EntUserId,
+		EntId:        in.EntId,
+	}
+	fool, msg := subService.SetUser(in.Mail)
+	if fool {
+		return &bxsubscribe.StatusResp{
+			ErrorCode: 0,
+		}, nil
+	} else {
+		return &bxsubscribe.StatusResp{
+			ErrorCode: -1,
+			ErrorMsg:  msg,
+		}, nil
+	}
+}

+ 677 - 0
jyBXSubscribe/rpc/internal/logic/updatesubscribeinfologic_test.go

@@ -0,0 +1,677 @@
+package logic
+
+import (
+	"context"
+	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXSubscribe/rpc/bxsubscribe"
+	"jyBXSubscribe/rpc/internal/svc"
+	"reflect"
+	"testing"
+)
+
+func TestByPushHistoryLogic_ByPushHistory(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.SubscribeInfosReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.ByPushHistoryResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+		{
+			name: "111",
+			args: args{in: &bxsubscribe.SubscribeInfosReq{
+				UserId:   "60054",
+				AppId:    "10000",
+				UserType: "vType",
+			},
+			},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &ByPushHistoryLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.ByPushHistory(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("ByPushHistory() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("ByPushHistory() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetDistributorLogic_GetDistributor(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.GetDistributorReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.DistributorResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetDistributorLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.GetDistributor(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("GetDistributor() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("GetDistributor() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetKeyLogic_GetKey(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.GetKeyReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.KeyResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetKeyLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.GetKey(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("GetKey() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("GetKey() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetSubListLogic_GetSubList(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.SubscribeInfosReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.SubscribeInfosResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetSubListLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.GetSubList(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("GetSubList() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("GetSubList() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetSubScribeInfoLogic_GetSubScribeInfo(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.UserReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.UserResq
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetSubScribeInfoLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.GetSubScribeInfo(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("GetSubScribeInfo() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("GetSubScribeInfo() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetSubScribeInfoLogic_formatItems(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		m []map[string]interface{}
+	}
+	tests := []struct {
+		name   string
+		fields fields
+		args   args
+		want   []*bxsubscribe.Items
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetSubScribeInfoLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			if got := l.formatItems(tt.args.m); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("formatItems() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetSubScribeInfoLogic_formatM(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		m *map[string]interface{}
+	}
+	tests := []struct {
+		name   string
+		fields fields
+		args   args
+		want   map[string]*bxsubscribe.List
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetSubScribeInfoLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			if got := l.formatM(tt.args.m); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("formatM() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetSubSomeInfoLogic_GetSubSomeInfo(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.SomeInfoReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.SomeInfoResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetSubSomeInfoLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.GetSubSomeInfo(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("GetSubSomeInfo() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("GetSubSomeInfo() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestGetViewStatusLogic_GetViewStatus(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.GetViewStatusReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.ViewStatusResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &GetViewStatusLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.GetViewStatus(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("GetViewStatus() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("GetViewStatus() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestMsgDistributorLogic_MsgDistributor(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.MsgDistributorReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.StatusResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &MsgDistributorLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.MsgDistributor(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("MsgDistributor() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("MsgDistributor() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewByPushHistoryLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *ByPushHistoryLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewByPushHistoryLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewByPushHistoryLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewGetDistributorLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *GetDistributorLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewGetDistributorLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewGetDistributorLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewGetKeyLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *GetKeyLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewGetKeyLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewGetKeyLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewGetSubListLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *GetSubListLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewGetSubListLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewGetSubListLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewGetSubScribeInfoLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *GetSubScribeInfoLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewGetSubScribeInfoLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewGetSubScribeInfoLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewGetSubSomeInfoLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *GetSubSomeInfoLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewGetSubSomeInfoLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewGetSubSomeInfoLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewGetViewStatusLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *GetViewStatusLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewGetViewStatusLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewGetViewStatusLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewMsgDistributorLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *MsgDistributorLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewMsgDistributorLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewMsgDistributorLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewSetReadLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *SetReadLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewSetReadLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewSetReadLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestNewUpdateSubScribeInfoLogic(t *testing.T) {
+	type args struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+	}
+	tests := []struct {
+		name string
+		args args
+		want *UpdateSubScribeInfoLogic
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := NewUpdateSubScribeInfoLogic(tt.args.ctx, tt.args.svcCtx); !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("NewUpdateSubScribeInfoLogic() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestReverse(t *testing.T) {
+	type args struct {
+		arr *[]*bxsubscribe.UserStatus
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+		})
+	}
+}
+
+func TestSetReadLogic_SetRead(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.SetReadReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.StatusResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &SetReadLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.SetRead(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("SetRead() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("SetRead() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
+
+func TestUpdateSubScribeInfoLogic_UpdateSubScribeInfo(t *testing.T) {
+	type fields struct {
+		ctx    context.Context
+		svcCtx *svc.ServiceContext
+		Logger logx.Logger
+	}
+	type args struct {
+		in *bxsubscribe.UpdateSubScribeInfoReq
+	}
+	tests := []struct {
+		name    string
+		fields  fields
+		args    args
+		want    *bxsubscribe.StatusResp
+		wantErr bool
+	}{
+		// TODO: Add test cases.
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			l := &UpdateSubScribeInfoLogic{
+				ctx:    tt.fields.ctx,
+				svcCtx: tt.fields.svcCtx,
+				Logger: tt.fields.Logger,
+			}
+			got, err := l.UpdateSubScribeInfo(tt.args.in)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("UpdateSubScribeInfo() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("UpdateSubScribeInfo() got = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}

+ 146 - 0
jyBXSubscribe/rpc/internal/logic/userinfologic.go

@@ -0,0 +1,146 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	. "app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/redis"
+	"context"
+	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
+	"go.mongodb.org/mongo-driver/bson"
+	IC "jyBXSubscribe/rpc/init"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"jyBXSubscribe/rpc/util"
+	"log"
+)
+
+type UserInfoLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserInfoLogic {
+	return &UserInfoLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 用户推送信息查看
+func (l *UserInfoLogic) UserInfo(in *bxsubscribe.GetUserInfoReq) (*bxsubscribe.GetUserInfoResq, error) {
+	// todo: add your logic here and delete this line
+	userInfo := &map[string]interface{}{}
+	s_email := ""
+	s_m_openid := ""
+	s_unionid := ""
+	userInfo, _ = IC.Mgo.FindById(util.USER, in.UserId, `{"o_pushset":1,"s_m_openid":1,"s_unionid":1}`)
+	if userInfo != nil && len(*userInfo) > 0 {
+		pushSet := common.ObjToMap((*userInfo)["o_pushset"])
+		s_email = common.InterfaceToStr((*pushSet)["s_email"])
+		s_m_openid = common.InterfaceToStr((*userInfo)["s_m_openid"])
+		s_unionid = common.InterfaceToStr((*userInfo)["s_unionid"])
+	}
+	if in.PositionType == 1 {
+		userInfo, _ = IC.Mgo.FindOne(util.ENTUSER, map[string]interface{}{"i_entid": in.EntId, "i_userid": in.EntUserId})
+		if userInfo != nil && len(*userInfo) > 0 {
+			pushSet := common.ObjToMap((*userInfo)["o_pushset"])
+			s_email = common.InterfaceToStr((*pushSet)["s_email"])
+		}
+	}
+	isSubscribe := false
+	isBind := false
+	isMerge := false
+	if s_m_openid != "" {
+		//微信是否关注处理
+		subscribeList := &[]map[string]interface{}{}
+		subscribeList, _ = IC.Mgo.Find(util.SUBSCRIBE, map[string]interface{}{"s_m_openid": s_m_openid}, `{"l_date":-1}`, `{"s_event":1"}`, true, -1, -1)
+		if subscribeList != nil && len(*subscribeList) > 0 {
+			s_event := common.InterfaceToStr((*subscribeList)[0]["s_event"])
+			if s_event == "subscribe" {
+				isSubscribe = true
+			}
+		}
+	}
+	//
+	//查询用户是否绑定
+	if s_unionid != "" {
+		isBind = true
+	}
+	//查询用户是否需要合并
+	isMerge = MergeQuery(in.UserId)
+	//用户二维码生成处理
+	data := map[string]string{
+		"userId": in.UserId,
+		"source": util.ServiceMap[in.ServiceType],
+	}
+	bindKey := "Bind_" + in.ServiceType + common.InterfaceToStr(in.BaseUserId)
+	redis.Put("other", bindKey, data, -1)
+	state := 1
+	if isBind {
+		if isMerge {
+			state = 2
+		} else {
+			if isSubscribe {
+				state = 3
+			} else {
+				state = 4
+			}
+		}
+	}
+	return &bxsubscribe.GetUserInfoResq{
+		Data: &bxsubscribe.GetUserInfo{
+			Mail:   s_email,
+			State:  common.Int64All(state),
+			ImgUrl: fmt.Sprintf("/publicapply/getERCode/%s", bindKey), //二维码地址
+			AppUrl: fmt.Sprintf(IC.C.AppUrl, "push_set", "pc-pushsettings"),
+			ShowWx: isSubscribe,
+		},
+	}, nil
+}
+
+func MergeQuery(userId string) bool {
+	var wId, pId string
+	tud, _ := IC.Mgo.FindById("user", userId, `{"s_m_phone":1,"s_phone":1,"s_unionid":1,"s_m_openid":1,"s_nickname":1}`)
+	s_m_phone, s_phone := common.ObjToString((*tud)["s_m_phone"]), common.ObjToString((*tud)["s_phone"])
+	if tud == nil || len(*tud) == 0 {
+		log.Println("查询用户身份异常:", userId)
+		return false
+	}
+	//查询是否有对应微信需要合并
+	if unionid := common.ObjToString((*tud)["s_unionid"]); unionid != "" && len(unionid) > 11 {
+		mud, _ := IC.Mgo.FindOneByField("user", bson.M{"i_appid": 2, "s_unionid": unionid, "_id": bson.M{"$ne": StringTOBsonId(userId)}}, `{"_id":1,"s_nickname":1,"s_phone":1}`)
+		if mud != nil && len(*mud) > 0 {
+			if common.ObjToString((*tud)["s_phone"]) == "" {
+				wId = userId
+				pId = BsonIdToSId((*mud)["_id"])
+			} else {
+				pId = userId
+				wId = BsonIdToSId((*mud)["_id"])
+			}
+			return pId != wId
+		}
+	}
+	//查询是否有对应手机号需要合并
+	if s_phone == s_m_phone { //已合并
+		return false
+	}
+	if s_m_phone != "" { //当前用户为微信用户;查询对应的手机号用户
+		mud, _ := IC.Mgo.FindOneByField("user", bson.M{"i_appid": 2, "s_phone": s_m_phone, "_id": bson.M{"$ne": StringTOBsonId(userId)}}, `{"_id":1}`)
+		if mud != nil && len(*mud) > 0 {
+			wId = BsonIdToSId((*tud)["_id"])
+			pId = BsonIdToSId((*mud)["_id"])
+			return pId != wId
+		}
+	} else if s_phone != "" { //当前用户为手机号用户;查询对应的微信用户
+		mud, _ := IC.Mgo.FindOneByField("user", bson.M{"i_appid": 2, "s_m_phone": s_phone, "_id": bson.M{"$ne": StringTOBsonId(userId)}}, `{"_id":1,"s_nickname":1}`)
+		if mud != nil && len(*mud) > 0 {
+			wId = BsonIdToSId((*mud)["_id"])
+			pId = BsonIdToSId((*tud)["_id"])
+			return pId != wId
+		}
+	}
+	return false
+}

+ 25 - 1
jyBXSubscribe/rpc/internal/server/bxsubscribeserver.go

@@ -1,4 +1,4 @@
-// Code generated by goctl. DO NOT EDIT!
+// Code generated by goctl. DO NOT EDIT.
 // Source: bxsubscribe.proto
 
 package server
@@ -81,3 +81,27 @@ func (s *BxsubscribeServer) GetViewStatus(ctx context.Context, in *bxsubscribe.G
 	l := logic.NewGetViewStatusLogic(ctx, s.svcCtx)
 	return l.GetViewStatus(in)
 }
+
+// 用户推送信息查看
+func (s *BxsubscribeServer) UserInfo(ctx context.Context, in *bxsubscribe.GetUserInfoReq) (*bxsubscribe.GetUserInfoResq, error) {
+	l := logic.NewUserInfoLogic(ctx, s.svcCtx)
+	return l.UserInfo(in)
+}
+
+// 用户邮箱保存
+func (s *BxsubscribeServer) SetUser(ctx context.Context, in *bxsubscribe.SetUserInfoReq) (*bxsubscribe.StatusResp, error) {
+	l := logic.NewSetUserLogic(ctx, s.svcCtx)
+	return l.SetUser(in)
+}
+
+// 用户推送设置查看
+func (s *BxsubscribeServer) GetPushSet(ctx context.Context, in *bxsubscribe.GetPushSetReq) (*bxsubscribe.GetPushSetResp, error) {
+	l := logic.NewGetPushSetLogic(ctx, s.svcCtx)
+	return l.GetPushSet(in)
+}
+
+// 用户推送设置修改
+func (s *BxsubscribeServer) SetPushSet(ctx context.Context, in *bxsubscribe.SetPushSetReq) (*bxsubscribe.StatusResp, error) {
+	l := logic.NewSetPushSetLogic(ctx, s.svcCtx)
+	return l.SetPushSet(in)
+}

+ 9 - 2
jyBXSubscribe/rpc/model/push.go

@@ -165,12 +165,14 @@ func (s *subscribePush) PutTodayCache(userId, userType string, pc_a *SubPush) {
 
 // 获取redis key
 func (s *subscribePush) todayKey(userId, userType string) string {
-	if userType == EntnicheFlag {
+	if s.ModuleFlag == EntnicheFlag {
 		switch userType {
 		case SubVipFlag:
 			return fmt.Sprintf("%s_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, "vip", userId)
 		case MemberFlag:
 			return fmt.Sprintf("%s_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, "member", userId)
+		case SubFreeFlag:
+			return fmt.Sprintf("%s_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, "free", userId)
 		}
 	}
 	return fmt.Sprintf("%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId)
@@ -182,6 +184,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)
@@ -919,7 +923,6 @@ func (s *subscribePush) SetRead(newUserId, id int64, userId, entUserId, entId st
 	if isEnt {
 		if s.ModuleFlag == EntnicheFlag {
 			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 ,visittime=now() where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
-
 		} else {
 			IC.BaseServiceMysql.UpdateOrDeleteBySql(fmt.Sprintf("update %s set isvisit=1 where entid=? and id=?", aboutDbMsg[s.ModuleFlag].MysqlTable), entId, id)
 
@@ -1482,6 +1485,7 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 			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{}))
@@ -1517,6 +1521,9 @@ func (s *subscribePush) Keys(spqp *KeyParam) (result []*bxsubscribe.KeyItems) {
 		case EntnicheFlag:
 			types = 0
 			typeKey = "o_entniche"
+		case SubFreeFlag:
+			types = 2
+			typeKey = "o_jy"
 		}
 		if spqp.PositionType == 1 {
 			typeKey = "o_entniche"

+ 295 - 0
jyBXSubscribe/rpc/model/service/pushSet.go

@@ -0,0 +1,295 @@
+package service
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
+	"fmt"
+	IC "jyBXSubscribe/rpc/init"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"jyBXSubscribe/rpc/util"
+	"regexp"
+)
+
+type PushSetService struct {
+	UserId       string //mongodb 的用户id
+	PositionType int64
+	EntId        int64
+	EntUserId    int64
+	BaseUserId   int64
+	AccountId    int64
+	PositionId   int64
+}
+
+func (this *PushSetService) Update(item, setType, pushType string, ratemode, pushValue, interested int64, times []string) bool {
+	set := map[string]interface{}{}
+	switch setType {
+	case "pushRoute":
+		set = map[string]interface{}{
+			fmt.Sprintf("o_pushset.%s.%s", item, pushType): common.IntAll(pushValue),
+		}
+		break
+	case "a_times":
+		if ratemode == 2 {
+			if len(times) == 0 {
+				return false
+			}
+		}
+		set = map[string]interface{}{
+			fmt.Sprintf("o_pushset.%s.a_times", item):    times,
+			fmt.Sprintf("o_pushset.%s.i_ratemode", item): common.IntAll(ratemode),
+		}
+	default:
+		set = map[string]interface{}{
+			"o_pushset.i_interested": common.IntAll(interested),
+		}
+	}
+	update := false
+	if this.PositionType == 0 {
+		update = IC.Mgo.UpdateById(util.USER, this.UserId, map[string]interface{}{
+			"$set": set,
+		})
+	} else {
+		update = IC.Mgo.Update(util.ENTUSER, map[string]interface{}{"i_entid": this.EntId, "i_userid": this.EntUserId}, map[string]interface{}{
+			"$set": set,
+		}, true, false)
+	}
+	return update
+}
+func (this *PushSetService) Find() map[string]*bxsubscribe.PushSet {
+	pushSetMap := &map[string]interface{}{}
+	//
+	ShowWx := false
+	s_m_openid := ""
+	pushSetMap, _ = IC.Mgo.FindById(util.USER, this.UserId, `{"o_pushset":":1,"s_m_openid":1}`)
+	if pushSetMap != nil && len(*pushSetMap) > 0 {
+		s_m_openid = common.InterfaceToStr((*pushSetMap)["s_m_openid"])
+	}
+	if s_m_openid != "" {
+		//微信是否关注处理
+		subscribeList := &[]map[string]interface{}{}
+		subscribeList, _ = IC.Mgo.Find(util.SUBSCRIBE, map[string]interface{}{"s_m_openid": s_m_openid}, `{"l_date":-1}`, `{"s_event":1"}`, true, -1, -1)
+		if subscribeList != nil && len(*subscribeList) > 0 {
+			s_event := common.InterfaceToStr((*subscribeList)[0]["s_event"])
+			if s_event == "subscribe" {
+				ShowWx = true
+			}
+		}
+	}
+
+	if this.PositionType == 1 {
+		pushSetMap, _ = IC.Mgo.FindOne(util.ENTUSER, map[string]interface{}{"i_entid": this.EntId, "i_userid": this.EntUserId})
+	}
+	pushSet := map[string]*bxsubscribe.PushSet{}
+	//用户权益获取
+	powerData := IC.Middleground.PowerCheckCenter.Check("10000", this.UserId, this.BaseUserId, this.AccountId, this.EntId, this.PositionType, this.PositionId)
+	o_pushset := map[string]interface{}{}
+	if pushSetMap != nil && len(*pushSetMap) > 0 {
+		o_pushset, _ = (*pushSetMap)["o_pushset"].(map[string]interface{})
+	}
+	if o_pushset != nil {
+		pushSet["interested"] = &bxsubscribe.PushSet{
+			Interested: common.Int64All(common.If(o_pushset["i_interested"] == nil, 1, common.Int64All(o_pushset["i_interested"]))),
+		}
+	} else {
+		pushSet["interested"] = &bxsubscribe.PushSet{
+			Interested: 1,
+		}
+	}
+	fool, o_subset := pushSetMontage(o_pushset["o_subset"], "o_subset", powerData, ShowWx)
+	if fool {
+		pushSet["o_subset"] = o_subset
+	}
+	fool, o_week_report := pushSetMontage(o_pushset["o_week_report"], "o_week_report", powerData, ShowWx)
+	if fool {
+		pushSet["o_week_report"] = o_week_report
+	}
+	fool, o_month_report := pushSetMontage(o_pushset["o_month_report"], "o_month_report", powerData, ShowWx)
+	if fool {
+		pushSet["o_month_report"] = o_month_report
+	}
+	fool, o_newproject_forecast := pushSetMontage(o_pushset["o_newproject_forecast"], "o_newproject_forecast", powerData, ShowWx)
+	if fool {
+		pushSet["o_newproject_forecast"] = o_newproject_forecast
+	}
+	fool, o_entinfo := pushSetMontage(o_pushset["o_entinfo"], "o_entinfo", powerData, ShowWx)
+	if fool {
+		pushSet["o_entinfo"] = o_entinfo
+	}
+	fool, o_follow_project := pushSetMontage(o_pushset["o_follow_project"], "o_follow_project", powerData, ShowWx)
+	if fool {
+		pushSet["o_follow_project"] = o_follow_project
+	}
+	fool, o_follow_ent := pushSetMontage(o_pushset["o_follow_ent"], "o_follow_ent", powerData, ShowWx)
+	if fool {
+		pushSet["o_follow_ent"] = o_follow_ent
+	}
+	return pushSet
+}
+func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp, ShowWx bool) (bool, *bxsubscribe.PushSet) {
+	data := common.ObjToMap(in)
+	a_times := []string{}
+	isMailShow := int64(1)
+	if !(data == nil || len(*data) == 0) {
+		if (*data)["a_times"] != nil {
+			a_times = common.ObjArrToStringArr((*data)["a_times"].([]interface{}))
+		}
+	}
+	power := make(map[int]bool)
+	for _, v := range powerData.Member.MemberPowerList {
+		power[common.IntAll(v)] = true
+	}
+	returnData := &bxsubscribe.PushSet{}
+	switch name {
+	case "o_subset":
+		if data == nil || len(*data) == 0 {
+			returnData = &bxsubscribe.PushSet{
+				ATimes:    util.TimeMap[2],
+				IApppush:  1,
+				IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
+				IMailpush: 0,
+				IRatemode: 2,
+				IsWxShow:  1,
+			}
+		} else {
+			returnData = &bxsubscribe.PushSet{
+				ATimes:    common.If((*data)["i_ratemode"] == nil, util.TimeMap[2], a_times).([]string),
+				IApppush:  common.Int64All(common.If((*data)["i_apppush"] == nil, 1, (*data)["i_apppush"])),
+				IWxpush:   common.Int64All(common.If((*data)["i_wxpush"] == nil, common.If(ShowWx, 1, 0), common.If(ShowWx, (*data)["i_wxpush"], 0))),
+				IMailpush: common.Int64All(common.If((*data)["i_mailpush"] == nil, 0, (*data)["i_mailpush"])),
+				IRatemode: common.Int64All(common.If((*data)["i_ratemode"] == nil, 2, (*data)["i_ratemode"])),
+				IsWxShow:  1,
+			}
+		}
+	case "o_follow_project", "o_follow_ent":
+		a_times = append(a_times, "实时推送")
+		if data == nil || len(*data) == 0 {
+			returnData = &bxsubscribe.PushSet{
+				ATimes:    a_times,
+				IApppush:  1,
+				IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
+				IMailpush: 0,
+				IRatemode: 1,
+				IsWxShow:  1,
+			}
+		} else {
+			returnData = &bxsubscribe.PushSet{
+				ATimes:    a_times,
+				IApppush:  common.Int64All(common.If((*data)["i_apppush"] == nil, 1, (*data)["i_apppush"])),
+				IWxpush:   common.Int64All(common.If((*data)["i_wxpush"] == nil, common.If(ShowWx, 1, 0), common.If(ShowWx, (*data)["i_wxpush"], 0))),
+				IMailpush: common.Int64All(common.If((*data)["i_mailpush"] == nil, 0, (*data)["i_mailpush"])),
+				IRatemode: 1,
+				IsWxShow:  1,
+			}
+		}
+	case "o_newproject_forecast":
+		a_times = append(a_times, "实时推送")
+		if powerData.Member.Status > 0 && power[9] {
+			if data == nil || len(*data) == 0 {
+				returnData = &bxsubscribe.PushSet{
+					ATimes:    a_times,
+					IApppush:  1,
+					IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
+					IMailpush: 0,
+					IRatemode: 1,
+					IsWxShow:  0,
+				}
+			} else {
+				returnData = &bxsubscribe.PushSet{
+					ATimes:    a_times,
+					IApppush:  common.Int64All(common.If((*data)["i_apppush"] == nil, 1, (*data)["i_apppush"])),
+					IWxpush:   common.Int64All(common.If((*data)["i_wxpush"] == nil, common.If(ShowWx, 1, 0), common.If(ShowWx, (*data)["i_wxpush"], 0))),
+					IMailpush: common.Int64All(common.If((*data)["i_mailpush"] == nil, 0, (*data)["i_mailpush"])),
+					IRatemode: 1,
+					IsWxShow:  0,
+				}
+			}
+		} else {
+			return false, nil
+		}
+	case "o_entinfo":
+		a_times = append(a_times, "实时推送")
+		if powerData.Member.Status > 0 && power[12] {
+			if data == nil || len(*data) == 0 {
+				returnData = &bxsubscribe.PushSet{
+					ATimes:    a_times,
+					IApppush:  1,
+					IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
+					IMailpush: 0,
+					IRatemode: 1,
+					IsWxShow:  0,
+				}
+			} else {
+				returnData = &bxsubscribe.PushSet{
+					ATimes:    a_times,
+					IApppush:  common.Int64All(common.If((*data)["i_apppush"] == nil, 1, (*data)["i_apppush"])),
+					IWxpush:   common.Int64All(common.If((*data)["i_wxpush"] == nil, common.If(ShowWx, 1, 0), common.If(ShowWx, (*data)["i_wxpush"], 0))),
+					IMailpush: common.Int64All(common.If((*data)["i_mailpush"] == nil, 0, (*data)["i_mailpush"])),
+					IRatemode: 1,
+					IsWxShow:  0,
+				}
+			}
+		} else {
+			return false, nil
+		}
+	case "o_week_report", "o_month_report":
+		if powerData.Vip.Status > 0 || power[10] {
+			if name == "o_week_report" {
+				a_times = append(a_times, "每周推送 (周五 09:00)")
+			} else {
+				a_times = append(a_times, "每月推送 (28日 09:00)")
+			}
+			IsWxShow := int64(0)
+			if powerData.Vip.Status > 0 {
+				IsWxShow = int64(1)
+			}
+			if !power[10] {
+				isMailShow = int64(0)
+			}
+			if data == nil || len(*data) == 0 {
+				returnData = &bxsubscribe.PushSet{
+					ATimes:    a_times,
+					IApppush:  1,
+					IWxpush:   common.Int64All(common.If(ShowWx, 1, 0)),
+					IMailpush: 0,
+					IRatemode: 3,
+					IsWxShow:  IsWxShow,
+				}
+			} else {
+				returnData = &bxsubscribe.PushSet{
+					ATimes:    a_times,
+					IApppush:  common.Int64All(common.If((*data)["i_apppush"] == nil, 1, (*data)["i_apppush"])),
+					IWxpush:   common.Int64All(common.If((*data)["i_wxpush"] == nil, common.If(ShowWx, 1, 0), common.If(ShowWx, (*data)["i_wxpush"], 0))),
+					IMailpush: common.Int64All(common.If((*data)["i_mailpush"] == nil, 0, (*data)["i_mailpush"])),
+					IRatemode: 3,
+					IsWxShow:  IsWxShow,
+				}
+			}
+		} else {
+			return false, nil
+		}
+	}
+	returnData.IsMailShow = isMailShow
+	return true, returnData
+
+}
+func (this *PushSetService) SetUser(mail string) (bool, string) {
+	var emailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
+	if !emailPattern.MatchString(mail) {
+		return false, "邮箱格式不正确"
+	}
+	set := map[string]interface{}{
+		"o_pushset.s_email": mail,
+	}
+	update := false
+	if this.PositionType == 0 {
+		update = IC.Mgo.UpdateById(util.USER, this.UserId, map[string]interface{}{
+			"$set": set,
+		})
+	} else {
+		update = IC.Mgo.Update(util.ENTUSER, map[string]interface{}{"i_entid": this.EntId, "i_userid": this.EntUserId}, map[string]interface{}{
+			"$set": set,
+		}, true, false)
+		IC.MainMysql.UpdateOrDeleteBySql(`update entniche_user set mail=? where id=? and ent_id=?`, mail, this.EntUserId, this.EntId)
+	}
+	return update, ""
+}

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

@@ -3,6 +3,7 @@ package service
 
 import (
 	"errors"
+	"fmt"
 	"jyBXSubscribe/entity"
 	IC "jyBXSubscribe/rpc/init"
 	"strconv"
@@ -34,6 +35,7 @@ func (this *SubseribeService) Update() (int64, error) {
 	//查询字段
 	fields := `{"i_vip_status":1,"o_vipjy":1}`
 	//查询用户信息
+	fmt.Println("111111", IC.Compatible)
 	r := IC.Compatible.Select(this.UserId, fields)
 	if r == nil || len(*r) == 0 {
 		logx.Error("未找到用户")

文件差異過大導致無法顯示
+ 965 - 47
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go


+ 153 - 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.20.0--rc2
+// - protoc             v3.15.1
 // source: bxsubscribe.proto
 
 package bxsubscribe
@@ -42,6 +42,14 @@ type BxsubscribeClient interface {
 	GetDistributor(ctx context.Context, in *GetDistributorReq, opts ...grpc.CallOption) (*DistributorResp, error)
 	//查看状态
 	GetViewStatus(ctx context.Context, in *GetViewStatusReq, opts ...grpc.CallOption) (*ViewStatusResp, error)
+	//用户推送信息查看
+	UserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResq, error)
+	//用户邮箱保存
+	SetUser(ctx context.Context, in *SetUserInfoReq, opts ...grpc.CallOption) (*StatusResp, error)
+	//用户推送设置查看
+	GetPushSet(ctx context.Context, in *GetPushSetReq, opts ...grpc.CallOption) (*GetPushSetResp, error)
+	//用户推送设置修改
+	SetPushSet(ctx context.Context, in *SetPushSetReq, opts ...grpc.CallOption) (*StatusResp, error)
 }
 
 type bxsubscribeClient struct {
@@ -142,6 +150,42 @@ func (c *bxsubscribeClient) GetViewStatus(ctx context.Context, in *GetViewStatus
 	return out, nil
 }
 
+func (c *bxsubscribeClient) UserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResq, error) {
+	out := new(GetUserInfoResq)
+	err := c.cc.Invoke(ctx, "/bxsubscribe.Bxsubscribe/userInfo", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *bxsubscribeClient) SetUser(ctx context.Context, in *SetUserInfoReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/bxsubscribe.Bxsubscribe/setUser", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *bxsubscribeClient) GetPushSet(ctx context.Context, in *GetPushSetReq, opts ...grpc.CallOption) (*GetPushSetResp, error) {
+	out := new(GetPushSetResp)
+	err := c.cc.Invoke(ctx, "/bxsubscribe.Bxsubscribe/getPushSet", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *bxsubscribeClient) SetPushSet(ctx context.Context, in *SetPushSetReq, opts ...grpc.CallOption) (*StatusResp, error) {
+	out := new(StatusResp)
+	err := c.cc.Invoke(ctx, "/bxsubscribe.Bxsubscribe/setPushSet", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // BxsubscribeServer is the server API for Bxsubscribe service.
 // All implementations must embed UnimplementedBxsubscribeServer
 // for forward compatibility
@@ -166,6 +210,14 @@ type BxsubscribeServer interface {
 	GetDistributor(context.Context, *GetDistributorReq) (*DistributorResp, error)
 	//查看状态
 	GetViewStatus(context.Context, *GetViewStatusReq) (*ViewStatusResp, error)
+	//用户推送信息查看
+	UserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResq, error)
+	//用户邮箱保存
+	SetUser(context.Context, *SetUserInfoReq) (*StatusResp, error)
+	//用户推送设置查看
+	GetPushSet(context.Context, *GetPushSetReq) (*GetPushSetResp, error)
+	//用户推送设置修改
+	SetPushSet(context.Context, *SetPushSetReq) (*StatusResp, error)
 	mustEmbedUnimplementedBxsubscribeServer()
 }
 
@@ -203,6 +255,18 @@ func (UnimplementedBxsubscribeServer) GetDistributor(context.Context, *GetDistri
 func (UnimplementedBxsubscribeServer) GetViewStatus(context.Context, *GetViewStatusReq) (*ViewStatusResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetViewStatus not implemented")
 }
+func (UnimplementedBxsubscribeServer) UserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method UserInfo not implemented")
+}
+func (UnimplementedBxsubscribeServer) SetUser(context.Context, *SetUserInfoReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method SetUser not implemented")
+}
+func (UnimplementedBxsubscribeServer) GetPushSet(context.Context, *GetPushSetReq) (*GetPushSetResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetPushSet not implemented")
+}
+func (UnimplementedBxsubscribeServer) SetPushSet(context.Context, *SetPushSetReq) (*StatusResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method SetPushSet not implemented")
+}
 func (UnimplementedBxsubscribeServer) mustEmbedUnimplementedBxsubscribeServer() {}
 
 // UnsafeBxsubscribeServer may be embedded to opt out of forward compatibility for this service.
@@ -396,6 +460,78 @@ func _Bxsubscribe_GetViewStatus_Handler(srv interface{}, ctx context.Context, de
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Bxsubscribe_UserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetUserInfoReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BxsubscribeServer).UserInfo(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/bxsubscribe.Bxsubscribe/userInfo",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BxsubscribeServer).UserInfo(ctx, req.(*GetUserInfoReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _Bxsubscribe_SetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(SetUserInfoReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BxsubscribeServer).SetUser(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/bxsubscribe.Bxsubscribe/setUser",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BxsubscribeServer).SetUser(ctx, req.(*SetUserInfoReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _Bxsubscribe_GetPushSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetPushSetReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BxsubscribeServer).GetPushSet(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/bxsubscribe.Bxsubscribe/getPushSet",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BxsubscribeServer).GetPushSet(ctx, req.(*GetPushSetReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _Bxsubscribe_SetPushSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(SetPushSetReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BxsubscribeServer).SetPushSet(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/bxsubscribe.Bxsubscribe/setPushSet",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BxsubscribeServer).SetPushSet(ctx, req.(*SetPushSetReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Bxsubscribe_ServiceDesc is the grpc.ServiceDesc for Bxsubscribe service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -443,6 +579,22 @@ var Bxsubscribe_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GetViewStatus",
 			Handler:    _Bxsubscribe_GetViewStatus_Handler,
 		},
+		{
+			MethodName: "userInfo",
+			Handler:    _Bxsubscribe_UserInfo_Handler,
+		},
+		{
+			MethodName: "setUser",
+			Handler:    _Bxsubscribe_SetUser_Handler,
+		},
+		{
+			MethodName: "getPushSet",
+			Handler:    _Bxsubscribe_GetPushSet_Handler,
+		},
+		{
+			MethodName: "setPushSet",
+			Handler:    _Bxsubscribe_SetPushSet_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "bxsubscribe.proto",

+ 18 - 0
jyBXSubscribe/rpc/util/util.go

@@ -7,6 +7,24 @@ import (
 	"app.yhyue.com/moapp/jybase/mysql"
 )
 
+const (
+	USER      = "user"
+	ENTUSER   = "ent_user"
+	SUBSCRIBE = "jy_subscribe"
+)
+
+var ServiceMap = map[string]string{
+	"app": "85",
+	"pc":  "84",
+	"wx":  "86",
+}
+var TimeMap = map[int][]string{
+	1: []string{},
+	2: []string{"09:00", "14:00"},
+	3: []string{"09:00"},
+	4: []string{"09:00"},
+}
+
 // 加密
 func EncodeId(sid string) string {
 	if sid == "" {

部分文件因文件數量過多而無法顯示