Explorar el Código

279功能提交

WH01243 hace 2 años
padre
commit
277ceecd3e
Se han modificado 28 ficheros con 2517 adiciones y 100 borrados
  1. 36 0
      jyBXSubscribe/api/bxsubscribe.api
  2. 28 0
      jyBXSubscribe/api/internal/handler/getPushSetHandler.go
  3. 20 0
      jyBXSubscribe/api/internal/handler/routes.go
  4. 28 0
      jyBXSubscribe/api/internal/handler/setPushSetHandler.go
  5. 28 0
      jyBXSubscribe/api/internal/handler/setUserHandler.go
  6. 28 0
      jyBXSubscribe/api/internal/handler/userInfoHandler.go
  7. 40 0
      jyBXSubscribe/api/internal/logic/getPushSetLogic.go
  8. 30 0
      jyBXSubscribe/api/internal/logic/setPushSetLogic.go
  9. 30 0
      jyBXSubscribe/api/internal/logic/setUserLogic.go
  10. 30 0
      jyBXSubscribe/api/internal/logic/userInfoLogic.go
  11. 31 0
      jyBXSubscribe/api/internal/types/types.go
  12. 69 5
      jyBXSubscribe/rpc/bxsubscribe.proto
  13. 41 1
      jyBXSubscribe/rpc/bxsubscribe/bxsubscribe.go
  14. 4 0
      jyBXSubscribe/rpc/init/db.go
  15. 0 2
      jyBXSubscribe/rpc/init/init.go
  16. 39 0
      jyBXSubscribe/rpc/internal/logic/getpushsetlogic.go
  17. 47 0
      jyBXSubscribe/rpc/internal/logic/setpushsetlogic.go
  18. 0 10
      jyBXSubscribe/rpc/internal/logic/setreadlogic.go
  19. 51 0
      jyBXSubscribe/rpc/internal/logic/setuserlogic.go
  20. 677 0
      jyBXSubscribe/rpc/internal/logic/updatesubscribeinfologic_test.go
  21. 47 0
      jyBXSubscribe/rpc/internal/logic/userinfologic.go
  22. 25 1
      jyBXSubscribe/rpc/internal/server/bxsubscribeserver.go
  23. 4 1
      jyBXSubscribe/rpc/model/push.go
  24. 106 0
      jyBXSubscribe/rpc/model/service/pushSet.go
  25. 2 0
      jyBXSubscribe/rpc/model/service/subscribe.go
  26. 918 79
      jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go
  27. 153 1
      jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe_grpc.pb.go
  28. 5 0
      jyBXSubscribe/rpc/util/util.go

+ 36 - 0
jyBXSubscribe/api/bxsubscribe.api

@@ -120,6 +120,34 @@ type (
 		MessageId string `json:"messageId"`
 		Staffs    string `json:"staffs"`
 	}
+	GetUserReq {
+		AppId        string `header:"appId"`
+		EntId        string `header:"entId,optional"`
+		EntUserId    string `header:"entUserId,optional"`
+		PositionType int64  `header:"positionType,optional"`
+		UserId       string `header:"userId,optional"`
+	}
+	SetUserReq {
+		AppId        string `header:"appId"`
+		EntId        string `header:"entId,optional"`
+		EntUserId    string `header:"entUserId,optional"`
+		PositionType int64  `header:"positionType,optional"`
+		UserId       string `header:"userId,optional"`
+		Mail         string `json:"mail,optional"`
+	}
+	PushSetReq {
+		AppId        string   `header:"appId"`
+		EntId        string   `header:"entId,optional"`
+		EntUserId    string   `header:"entUserId,optional"`
+		PositionType int64    `header:"positionType,optional"`
+		UserId       string   `header:"userId,optional"`
+		Item         string   `json:"item"`
+		SetType      string   `json:"setType"`
+		Ratemode     int64    `json:"ratemode,optional"`
+		Times        []string `json:"times,optional"`
+		PushType     string   `json:"pushType,optional"`
+		PushValue    int64    `json:"pushValue,optiona"`
+	}
 )
 service bxsubscribe-api {
 	@handler subscribeList
@@ -140,4 +168,12 @@ service bxsubscribe-api {
 	post /jybx/subscribe/:userType/viewStatus(viewStatusReq) returns (commonResp)
 	@handler msgDistributor
 	post /jybx/subscribe/msgDistributor(msgDistributor) returns (commonResp)
+	@handler userInfo //查询用户信息
+	post /jybx/subscribe/userInfo (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 (GetUserReq) 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)
+		}
+	}
+}

+ 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/userInfo",
+				Handler: userInfoHandler(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.GetUserReq
+		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)
+		}
+	}
+}

+ 28 - 0
jyBXSubscribe/api/internal/handler/userInfoHandler.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 userInfoHandler(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.NewUserInfoLogic(r.Context(), svcCtx)
+		resp, err := l.UserInfo(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

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

@@ -0,0 +1,40 @@
+package logic
+
+import (
+	"context"
+	"jyBXSubscribe/rpc/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, _ := l.svcCtx.Suscribe.GetKey(l.ctx, &bxsubscribe.GetKeyReq{
+		UserId:       req.UserId,
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
+		PositionType: req.PositionType,
+	})
+	return &types.CommonResp{
+		Err_code: res.ErrCode,
+		Err_msg:  res.ErrMsg,
+		Data:     res,
+	}, nil
+}

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

@@ -0,0 +1,30 @@
+package logic
+
+import (
+	"context"
+
+	"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.GetUserReq) (resp *types.CommonResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

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

@@ -0,0 +1,30 @@
+package logic
+
+import (
+	"context"
+
+	"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) (resp *types.CommonResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
jyBXSubscribe/api/internal/logic/userInfoLogic.go

@@ -0,0 +1,30 @@
+package logic
+
+import (
+	"context"
+
+	"jyBXSubscribe/api/internal/svc"
+	"jyBXSubscribe/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type UserInfoLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserInfoLogic {
+	return &UserInfoLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *UserInfoLogic) UserInfo(req *types.GetUserReq) (resp *types.CommonResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

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

@@ -117,3 +117,34 @@ type MsgDistributor struct {
 	MessageId string `json:"messageId"`
 	Staffs    string `json:"staffs"`
 }
+
+type GetUserReq struct {
+	AppId        string `header:"appId"`
+	EntId        string `header:"entId,optional"`
+	EntUserId    string `header:"entUserId,optional"`
+	PositionType int64  `header:"positionType,optional"`
+	UserId       string `header:"userId,optional"`
+}
+
+type SetUserReq struct {
+	AppId        string `header:"appId"`
+	EntId        string `header:"entId,optional"`
+	EntUserId    string `header:"entUserId,optional"`
+	PositionType int64  `header:"positionType,optional"`
+	UserId       string `header:"userId,optional"`
+	Mail         string `json:"mail,optional"`
+}
+
+type PushSetReq struct {
+	AppId        string   `header:"appId"`
+	EntId        string   `header:"entId,optional"`
+	EntUserId    string   `header:"entUserId,optional"`
+	PositionType int64    `header:"positionType,optional"`
+	UserId       string   `header:"userId,optional"`
+	Item         string   `json:"item"`
+	SetType      string   `json:"setType"`
+	Ratemode     int64    `json:"ratemode,optional"`
+	PushType     string   `json:"pushType,optional"`
+	Times        []string `json:"times,optional"`
+	PushValue    int64    `json:"pushValue,optiona"`
+}

+ 69 - 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,62 @@ 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;
+}
+message GetUserInfoResq{
+  GetUserInfo data = 1;
+  string error_msg = 2;
+  int64 error_code = 3;
+}
+message GetUserInfo{
+  string  mail = 1;
+  bool  showWx = 2;
+}
+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;
+}
+
+message GetPushSetResp{
+  map<string, PushSet> data = 1;
+  string error_msg = 2;
+  int64 error_code = 3;
+}
+message PushSet{
+  repeated  string a_times = 1;
+  int64 i_wxpush = 2;
+  int64 i_apppush = 3;
+  int64 i_mailpush = 4;
+}
+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;
+}
 
 
 service Bxsubscribe {
@@ -297,4 +353,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);
 }

+ 41 - 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
@@ -65,6 +73,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 +153,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...)
+}

+ 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

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

@@ -0,0 +1,39 @@
+package logic
+
+import (
+	"context"
+	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/model/service"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+)
+
+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,
+	}
+	pushSet := subService.Find()
+	return &bxsubscribe.GetPushSetResp{
+		Data: pushSet,
+	}, nil
+
+}

+ 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.Times)
+	if fool {
+		return &bxsubscribe.StatusResp{
+			Status: 1,
+		}, nil
+	} else {
+		return &bxsubscribe.StatusResp{
+			Status: 0,
+		}, 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

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

@@ -0,0 +1,51 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/message/db"
+	"context"
+
+	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"jyBXSubscribe/rpc/util"
+)
+
+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
+	set := map[string]interface{}{
+		"o_pushset.s_email": in.Mail,
+	}
+	update := false
+	if in.PositionType == 0 {
+		update = db.Mgo.Update(util.USER, map[string]interface{}{"userid": in.UserId}, map[string]interface{}{
+			"$set": set,
+		}, true, false)
+	} else {
+		update = db.Mgo.Update(util.USER, map[string]interface{}{"entId": in.EntId, "user_id": in.EntUserId}, map[string]interface{}{
+			"$set": set,
+		}, true, false)
+	}
+	if update {
+		return &bxsubscribe.StatusResp{Status: 0}, nil
+
+	} else {
+		return &bxsubscribe.StatusResp{
+			Status: 1}, 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)
+			}
+		})
+	}
+}

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

@@ -0,0 +1,47 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"context"
+	"github.com/zeromicro/go-zero/core/logx"
+	IC "jyBXSubscribe/rpc/init"
+	"jyBXSubscribe/rpc/internal/svc"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"jyBXSubscribe/rpc/util"
+)
+
+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
+	userInfoList := &[]map[string]interface{}{}
+	if in.PositionType == 0 {
+		userInfoList, _ = IC.Mgo.Find(util.USER, map[string]interface{}{"userid": in.UserId}, nil, `{"o_pushset.s_email":1","s_unionid":1}`, false, -1, -1)
+	} else {
+		userInfoList, _ = IC.Mgo.Find(util.ENTUSER, map[string]interface{}{"entId": in.EntId, "user_id": in.EntUserId}, nil, `{"o_pushset.s_email":1","s_unionid":1}`, false, -1, -1)
+	}
+	if userInfoList != nil && len(*userInfoList) > 0 {
+		return &bxsubscribe.GetUserInfoResq{
+			Data: &bxsubscribe.GetUserInfo{
+				Mail:   common.InterfaceToStr((*userInfoList)[0]["s_email"]),
+				ShowWx: common.InterfaceToStr((*userInfoList)[0]["s_unionid"]) != "",
+			},
+		}, nil
+	} else {
+		return &bxsubscribe.GetUserInfoResq{}, nil
+	}
+
+}

+ 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)
+}

+ 4 - 1
jyBXSubscribe/rpc/model/push.go

@@ -919,7 +919,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)
 
@@ -1484,6 +1483,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{}))
@@ -1519,6 +1519,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"

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

@@ -0,0 +1,106 @@
+package service
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/message/db"
+	"fmt"
+	IC "jyBXSubscribe/rpc/init"
+	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"jyBXSubscribe/rpc/util"
+)
+
+type PushSetService struct {
+	UserId       string //mongodb 的用户id
+	PositionType int64
+	EntId        int64
+	EntUserId    int64
+}
+
+func (this *PushSetService) Update(item, setType, pushType string, ratemode, pushValue int64, times []string) bool {
+	set := map[string]interface{}{}
+	switch setType {
+	case "pushRoute":
+		set = map[string]interface{}{
+			fmt.Sprintf("o_pushset.%s.%s", item, pushType): pushValue,
+		}
+		break
+	default:
+		switch pushType {
+		case "a_times":
+			set = map[string]interface{}{
+				fmt.Sprintf("o_pushset.%s.a_times", item): times,
+			}
+			break
+		case "ratemode":
+			set = map[string]interface{}{
+				fmt.Sprintf("o_pushset.%s.ratemode", item): ratemode,
+			}
+			break
+		}
+	}
+	update := false
+	if this.PositionType == 0 {
+		update = db.Mgo.Update(util.USER, map[string]interface{}{"userid": this.UserId}, map[string]interface{}{
+			"$set": set,
+		}, true, false)
+	} else {
+		update = db.Mgo.Update(util.USER, map[string]interface{}{"entId": this.EntId, "user_id": this.EntUserId}, map[string]interface{}{
+			"$set": set,
+		}, true, false)
+	}
+	return update
+}
+func (this *PushSetService) Find() map[string]*bxsubscribe.PushSet {
+	pushSetList := &[]map[string]interface{}{}
+	if this.PositionType == 0 {
+		pushSetList, _ = IC.Mgo.Find(util.USER, map[string]interface{}{"userid": this.UserId}, nil, `{"o_pushset":":1}`, false, -1, -1)
+	} else {
+		pushSetList, _ = IC.Mgo.Find(util.ENTUSER, map[string]interface{}{"entId": this.EntId, "user_id": this.EntUserId}, nil, `{"o_pushset.s_email":1}`, false, -1, -1)
+	}
+	pushSet := map[string]*bxsubscribe.PushSet{}
+	if pushSetList != nil && len(*pushSetList) > 0 {
+		o_pushset, _ := (*pushSetList)[0]["o_pushset"].(map[string]interface{})
+		fool, o_subset := pushSetMontage(o_pushset["o_subset"])
+		if fool {
+			pushSet["o_subset"] = o_subset
+		}
+		fool, o_week_report := pushSetMontage(o_pushset["o_week_report"])
+		if fool {
+			pushSet["o_week_report"] = o_week_report
+		}
+		fool, o_month_report := pushSetMontage(o_pushset["o_month_report"])
+		if fool {
+			pushSet["o_month_report"] = o_month_report
+		}
+		fool, o_newproject_forecast := pushSetMontage(o_pushset["o_newproject_forecast"])
+		if fool {
+			pushSet["o_newproject_forecast"] = o_newproject_forecast
+		}
+		fool, o_entinfo := pushSetMontage(o_pushset["o_entinfo"])
+		if fool {
+			pushSet["o_entinfo"] = o_entinfo
+		}
+		fool, o_follow_project := pushSetMontage(o_pushset["o_follow_project"])
+		if fool {
+			pushSet["o_follow_project"] = o_follow_project
+		}
+		fool, o_follow_ent := pushSetMontage(o_pushset["o_follow_ent"])
+		if fool {
+			pushSet["o_entinfo"] = o_follow_ent
+		}
+	}
+	return pushSet
+}
+func pushSetMontage(in interface{}) (bool, *bxsubscribe.PushSet) {
+	data := common.ObjToMap(in)
+	if data == nil || len(*data) == 0 {
+		return true, nil
+	}
+	return true, &bxsubscribe.PushSet{
+		ATimes:    (*data)["a_times"].([]string),
+		IApppush:  common.Int64All((*data)["a_times"]),
+		IWxpush:   common.Int64All((*data)["i_wxpush"]),
+		IMailpush: common.Int64All((*data)["i_mailpush"]),
+	}
+
+}

+ 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("未找到用户")

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 918 - 79
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",

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

@@ -7,6 +7,11 @@ import (
 	"app.yhyue.com/moapp/jybase/mysql"
 )
 
+const (
+	USER    = "user"
+	ENTUSER = "ent_user"
+)
+
 // 加密
 func EncodeId(sid string) string {
 	if sid == "" {

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio