zhangxinlei1996 2 лет назад
Родитель
Сommit
3e4c84f36d

+ 13 - 10
entity/power.go

@@ -16,16 +16,19 @@ const (
 
 //免费权益相关
 type Free struct {
-	IsFree        bool  //是否是免费用户
-	FreeHasKey    bool  //免费用户是否有关键词
-	FreeEntPort   int64 //免费用户可查看企业画像次数
-	FreeBuyerPort int64 //免费用户可查看采购单位画像次数
-	FreeFile      int64 //免费用户可以进行附件下载次数
-	IsUpgrade     bool  //是否是新免费用户
-	Registedate   int64 //注册时间
-	Mail          string
-	Phone         string
-	TsGuide       int64
+	IsFree                bool  //是否是免费用户
+	FreeHasKey            bool  //免费用户是否有关键词
+	FreeEntPort           int64 //免费用户可查看企业画像次数
+	FreeBuyerPort         int64 //免费用户可查看采购单位画像次数
+	FreeFile              int64 //免费用户可以进行附件下载次数
+	IsUpgrade             bool  //是否是新免费用户
+	Registedate           int64 //注册时间
+	Mail                  string
+	Phone                 string
+	TsGuide               int64
+	MemberApppushunread   int64 //已读未读
+	EntnicheApppushunread int64 //已读未读
+	Apppushunread         int64 //已读未读
 }
 
 //超级订阅相关

+ 31 - 0
rpc/internal/logic/delcheckredislogic.go

@@ -0,0 +1,31 @@
+package logic
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type DelCheckRedisLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDelCheckRedisLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelCheckRedisLogic {
+	return &DelCheckRedisLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 清除权限缓存
+func (l *DelCheckRedisLogic) DelCheckRedis(in *pb.CheckReq) (*pb.Resp, error) {
+	// todo: add your logic here and delete this line
+
+	return &pb.Resp{}, nil
+}

+ 6 - 0
rpc/internal/server/powercheckserver.go

@@ -27,3 +27,9 @@ func (s *PowerCheckServer) Check(ctx context.Context, in *pb.CheckReq) (*pb.Chec
 	l := logic.NewCheckLogic(ctx, s.svcCtx)
 	return l.Check(in)
 }
+
+// 清除权限缓存
+func (s *PowerCheckServer) DelCheckRedis(ctx context.Context, in *pb.CheckReq) (*pb.Resp, error) {
+	l := logic.NewDelCheckRedisLogic(ctx, s.svcCtx)
+	return l.DelCheckRedis(in)
+}

+ 56 - 19
rpc/pb/powerCheck.pb.go

@@ -808,16 +808,19 @@ type Free struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	IsFree        bool   `protobuf:"varint,1,opt,name=isFree,proto3" json:"isFree,omitempty"`               //是否是免费用户
-	FreeHasKey    bool   `protobuf:"varint,2,opt,name=freeHasKey,proto3" json:"freeHasKey,omitempty"`       //免费用户是否有关键词
-	FreeEntPort   int64  `protobuf:"varint,3,opt,name=freeEntPort,proto3" json:"freeEntPort,omitempty"`     //免费用户可查看企业画像次数
-	FreeBuyerPort int64  `protobuf:"varint,4,opt,name=freeBuyerPort,proto3" json:"freeBuyerPort,omitempty"` //免费用户可查看采购单位画像次数
-	FreeFile      int64  `protobuf:"varint,5,opt,name=freeFile,proto3" json:"freeFile,omitempty"`           //免费用户可以进行附件下载次数
-	Registedate   int64  `protobuf:"varint,6,opt,name=registedate,proto3" json:"registedate,omitempty"`     //注册时间
-	IsUpgrade     bool   `protobuf:"varint,7,opt,name=isUpgrade,proto3" json:"isUpgrade,omitempty"`         //是否是新免费用户
-	Mail          string `protobuf:"bytes,8,opt,name=mail,proto3" json:"mail,omitempty"`
-	Phone         string `protobuf:"bytes,9,opt,name=phone,proto3" json:"phone,omitempty"`       //手机号
-	TsGuide       int64  `protobuf:"varint,10,opt,name=tsGuide,proto3" json:"tsGuide,omitempty"` //pc订阅关键词,不再走向导页
+	IsFree                bool   `protobuf:"varint,1,opt,name=isFree,proto3" json:"isFree,omitempty"`               //是否是免费用户
+	FreeHasKey            bool   `protobuf:"varint,2,opt,name=freeHasKey,proto3" json:"freeHasKey,omitempty"`       //免费用户是否有关键词
+	FreeEntPort           int64  `protobuf:"varint,3,opt,name=freeEntPort,proto3" json:"freeEntPort,omitempty"`     //免费用户可查看企业画像次数
+	FreeBuyerPort         int64  `protobuf:"varint,4,opt,name=freeBuyerPort,proto3" json:"freeBuyerPort,omitempty"` //免费用户可查看采购单位画像次数
+	FreeFile              int64  `protobuf:"varint,5,opt,name=freeFile,proto3" json:"freeFile,omitempty"`           //免费用户可以进行附件下载次数
+	Registedate           int64  `protobuf:"varint,6,opt,name=registedate,proto3" json:"registedate,omitempty"`     //注册时间
+	IsUpgrade             bool   `protobuf:"varint,7,opt,name=isUpgrade,proto3" json:"isUpgrade,omitempty"`         //是否是新免费用户
+	Mail                  string `protobuf:"bytes,8,opt,name=mail,proto3" json:"mail,omitempty"`
+	Phone                 string `protobuf:"bytes,9,opt,name=phone,proto3" json:"phone,omitempty"`                                   //手机号
+	TsGuide               int64  `protobuf:"varint,10,opt,name=tsGuide,proto3" json:"tsGuide,omitempty"`                             //pc订阅关键词,不再走向导页
+	MemberApppushunread   int64  `protobuf:"varint,11,opt,name=memberApppushunread,proto3" json:"memberApppushunread,omitempty"`     //已读未读
+	EntnicheApppushunread int64  `protobuf:"varint,12,opt,name=entnicheApppushunread,proto3" json:"entnicheApppushunread,omitempty"` //已读未读
+	Apppushunread         int64  `protobuf:"varint,13,opt,name=apppushunread,proto3" json:"apppushunread,omitempty"`                 //已读未读
 }
 
 func (x *Free) Reset() {
@@ -922,6 +925,27 @@ func (x *Free) GetTsGuide() int64 {
 	return 0
 }
 
+func (x *Free) GetMemberApppushunread() int64 {
+	if x != nil {
+		return x.MemberApppushunread
+	}
+	return 0
+}
+
+func (x *Free) GetEntnicheApppushunread() int64 {
+	if x != nil {
+		return x.EntnicheApppushunread
+	}
+	return 0
+}
+
+func (x *Free) GetApppushunread() int64 {
+	if x != nil {
+		return x.Apppushunread
+	}
+	return 0
+}
+
 var File_powerCheck_proto protoreflect.FileDescriptor
 
 var file_powerCheck_proto_rawDesc = []byte{
@@ -1047,7 +1071,7 @@ var file_powerCheck_proto_rawDesc = []byte{
 	0x0a, 0x06, 0x62, 0x75, 0x79, 0x56, 0x69, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
 	0x62, 0x75, 0x79, 0x56, 0x69, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x75, 0x79, 0x4d, 0x65, 0x6d,
 	0x62, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x62, 0x75, 0x79, 0x4d, 0x65,
-	0x6d, 0x62, 0x65, 0x72, 0x22, 0xa6, 0x02, 0x0a, 0x04, 0x46, 0x72, 0x65, 0x65, 0x12, 0x16, 0x0a,
+	0x6d, 0x62, 0x65, 0x72, 0x22, 0xb4, 0x03, 0x0a, 0x04, 0x46, 0x72, 0x65, 0x65, 0x12, 0x16, 0x0a,
 	0x06, 0x69, 0x73, 0x46, 0x72, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69,
 	0x73, 0x46, 0x72, 0x65, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x72, 0x65, 0x65, 0x48, 0x61, 0x73,
 	0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x72, 0x65, 0x65, 0x48,
@@ -1065,11 +1089,22 @@ var file_powerCheck_proto_rawDesc = []byte{
 	0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a,
 	0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68,
 	0x6f, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x73, 0x47, 0x75, 0x69, 0x64, 0x65, 0x18, 0x0a,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74, 0x73, 0x47, 0x75, 0x69, 0x64, 0x65, 0x32, 0x2c, 0x0a,
-	0x0a, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1e, 0x0a, 0x05, 0x43,
-	0x68, 0x65, 0x63, 0x6b, 0x12, 0x09, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a,
-	0x0a, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e,
-	0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74, 0x73, 0x47, 0x75, 0x69, 0x64, 0x65, 0x12, 0x30, 0x0a,
+	0x13, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x41, 0x70, 0x70, 0x70, 0x75, 0x73, 0x68, 0x75, 0x6e,
+	0x72, 0x65, 0x61, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x6d, 0x65, 0x6d, 0x62,
+	0x65, 0x72, 0x41, 0x70, 0x70, 0x70, 0x75, 0x73, 0x68, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x12,
+	0x34, 0x0a, 0x15, 0x65, 0x6e, 0x74, 0x6e, 0x69, 0x63, 0x68, 0x65, 0x41, 0x70, 0x70, 0x70, 0x75,
+	0x73, 0x68, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15,
+	0x65, 0x6e, 0x74, 0x6e, 0x69, 0x63, 0x68, 0x65, 0x41, 0x70, 0x70, 0x70, 0x75, 0x73, 0x68, 0x75,
+	0x6e, 0x72, 0x65, 0x61, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x70, 0x70, 0x70, 0x75, 0x73, 0x68,
+	0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x61, 0x70,
+	0x70, 0x70, 0x75, 0x73, 0x68, 0x75, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x32, 0x4f, 0x0a, 0x0a, 0x70,
+	0x6f, 0x77, 0x65, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1e, 0x0a, 0x05, 0x43, 0x68, 0x65,
+	0x63, 0x6b, 0x12, 0x09, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e,
+	0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x0d, 0x44, 0x65, 0x6c,
+	0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x64, 0x69, 0x73, 0x12, 0x09, 0x2e, 0x43, 0x68, 0x65,
+	0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04,
+	0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1102,9 +1137,11 @@ var file_powerCheck_proto_depIdxs = []int32{
 	6, // 3: CheckResp.ent:type_name -> Ent
 	7, // 4: CheckResp.free:type_name -> Free
 	1, // 5: powerCheck.Check:input_type -> CheckReq
-	2, // 6: powerCheck.Check:output_type -> CheckResp
-	6, // [6:7] is the sub-list for method output_type
-	5, // [5:6] is the sub-list for method input_type
+	1, // 6: powerCheck.DelCheckRedis:input_type -> CheckReq
+	2, // 7: powerCheck.Check:output_type -> CheckResp
+	0, // 8: powerCheck.DelCheckRedis:output_type -> Resp
+	7, // [7:9] is the sub-list for method output_type
+	5, // [5:7] is the sub-list for method input_type
 	5, // [5:5] is the sub-list for extension type_name
 	5, // [5:5] is the sub-list for extension extendee
 	0, // [0:5] is the sub-list for field type_name

+ 38 - 0
rpc/pb/powerCheck_grpc.pb.go

@@ -24,6 +24,8 @@ const _ = grpc.SupportPackageIsVersion7
 type PowerCheckClient interface {
 	//用户权限判断
 	Check(ctx context.Context, in *CheckReq, opts ...grpc.CallOption) (*CheckResp, error)
+	//清除权限缓存
+	DelCheckRedis(ctx context.Context, in *CheckReq, opts ...grpc.CallOption) (*Resp, error)
 }
 
 type powerCheckClient struct {
@@ -43,12 +45,23 @@ func (c *powerCheckClient) Check(ctx context.Context, in *CheckReq, opts ...grpc
 	return out, nil
 }
 
+func (c *powerCheckClient) DelCheckRedis(ctx context.Context, in *CheckReq, opts ...grpc.CallOption) (*Resp, error) {
+	out := new(Resp)
+	err := c.cc.Invoke(ctx, "/powerCheck/DelCheckRedis", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // PowerCheckServer is the server API for PowerCheck service.
 // All implementations must embed UnimplementedPowerCheckServer
 // for forward compatibility
 type PowerCheckServer interface {
 	//用户权限判断
 	Check(context.Context, *CheckReq) (*CheckResp, error)
+	//清除权限缓存
+	DelCheckRedis(context.Context, *CheckReq) (*Resp, error)
 	mustEmbedUnimplementedPowerCheckServer()
 }
 
@@ -59,6 +72,9 @@ type UnimplementedPowerCheckServer struct {
 func (UnimplementedPowerCheckServer) Check(context.Context, *CheckReq) (*CheckResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method Check not implemented")
 }
+func (UnimplementedPowerCheckServer) DelCheckRedis(context.Context, *CheckReq) (*Resp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method DelCheckRedis not implemented")
+}
 func (UnimplementedPowerCheckServer) mustEmbedUnimplementedPowerCheckServer() {}
 
 // UnsafePowerCheckServer may be embedded to opt out of forward compatibility for this service.
@@ -90,6 +106,24 @@ func _PowerCheck_Check_Handler(srv interface{}, ctx context.Context, dec func(in
 	return interceptor(ctx, in, info, handler)
 }
 
+func _PowerCheck_DelCheckRedis_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(CheckReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(PowerCheckServer).DelCheckRedis(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/powerCheck/DelCheckRedis",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(PowerCheckServer).DelCheckRedis(ctx, req.(*CheckReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // PowerCheck_ServiceDesc is the grpc.ServiceDesc for PowerCheck service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -101,6 +135,10 @@ var PowerCheck_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "Check",
 			Handler:    _PowerCheck_Check_Handler,
 		},
+		{
+			MethodName: "DelCheckRedis",
+			Handler:    _PowerCheck_DelCheckRedis_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "powerCheck.proto",

+ 6 - 0
rpc/powerCheck.proto

@@ -104,9 +104,15 @@ message Free {
     string mail=8; 
     string phone=9; //手机号
     int64 tsGuide=10; //pc订阅关键词,不再走向导页
+    int64 memberApppushunread = 11; //已读未读
+	int64 entnicheApppushunread = 12; //已读未读
+	int64 apppushunread =13; //已读未读
+
 }
 
 service powerCheck {
     //用户权限判断
     rpc Check(CheckReq) returns(CheckResp);
+    //清除权限缓存
+    rpc DelCheckRedis(CheckReq)returns(Resp);
 }

+ 8 - 0
rpc/powercheck/powercheck.go

@@ -25,6 +25,8 @@ type (
 	PowerCheck interface {
 		// 用户权限判断
 		Check(ctx context.Context, in *CheckReq, opts ...grpc.CallOption) (*CheckResp, error)
+		// 清除权限缓存
+		DelCheckRedis(ctx context.Context, in *CheckReq, opts ...grpc.CallOption) (*Resp, error)
 	}
 
 	defaultPowerCheck struct {
@@ -43,3 +45,9 @@ func (m *defaultPowerCheck) Check(ctx context.Context, in *CheckReq, opts ...grp
 	client := pb.NewPowerCheckClient(m.cli.Conn())
 	return client.Check(ctx, in, opts...)
 }
+
+// 清除权限缓存
+func (m *defaultPowerCheck) DelCheckRedis(ctx context.Context, in *CheckReq, opts ...grpc.CallOption) (*Resp, error) {
+	client := pb.NewPowerCheckClient(m.cli.Conn())
+	return client.DelCheckRedis(ctx, in, opts...)
+}

+ 9 - 0
service/power.go

@@ -74,6 +74,9 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 		mgoUserFields["o_member_jy"] = 1
 		mgoUserFields["o_jy"] = 1
 		mgoUserFields["i_ts_guide"] = 1
+		mgoUserFields["i_member_apppushunread"] = 1
+		mgoUserFields["i_entniche_apppushunread"] = 1
+		mgoUserFields["i_apppushunread"] = 1
 	} else {
 		bigmemberServiceUserQuery["s_userid"] = positionId
 	}
@@ -84,10 +87,16 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
 		phone, _ := common.If((*data)["s_phone"] != nil, (*data)["s_phone"], (*data)["s_m_phone"]).(string) //
 		mail := common.ObjToString((*data)["s_myemail"])
 		i_ts_guide := common.Int64All((*data)["i_ts_guide"])
+		i_member_apppushunread := common.Int64All((*data)["i_member_apppushunread"])
+		i_entniche_apppushunread := common.Int64All((*data)["i_entniche_apppushunread"])
+		i_apppushunread := common.Int64All((*data)["i_apppushunread"])
 		free.Mail = mail
 		free.Registedate = registeDate
 		free.Phone = phone
 		free.TsGuide = i_ts_guide
+		free.Apppushunread = i_apppushunread
+		free.EntnicheApppushunread = i_entniche_apppushunread
+		free.MemberApppushunread = i_member_apppushunread
 		//个人权益
 		if positionType == 0 {
 			o_jy, _ := (*data)["o_jy"].(map[string]interface{})