diff --git a/api/consts/option.go b/api/consts/option.go index c70abb54..c2d8a88f 100644 --- a/api/consts/option.go +++ b/api/consts/option.go @@ -98,3 +98,10 @@ const ( StreamerAuthApproval_OneOffVersion = 0 StreamerAuthApproval_SeparateVersion = 1 ) + +const ( + Notification_ObjType_AllStreamer = 0 + Notification_ObjType_AllUser = 1 + Notification_ObjType_AllStreamerAndUser = 2 + Notification_ObjType_Customized = 3 +) diff --git a/api/proto/notification/proto/not_null_def_op.go b/api/proto/notification/proto/not_null_def_op.go new file mode 100644 index 00000000..1ff5930a --- /dev/null +++ b/api/proto/notification/proto/not_null_def_op.go @@ -0,0 +1,20 @@ +package proto + +import ( + "service/api/consts" + "service/bizcommon/util" + "service/library/validator" +) + +func (p *OpCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + + params = append(params, validator.NewInt64PtrParam("请确认通知接收人类型!", p.ObjType)) + if util.DerefInt64(p.ObjType) == consts.Notification_ObjType_Customized { + params = append(params, validator.NewInt64SliceParam("请确认通知接收人mids!", p.ObjMids)) + } + params = append(params, validator.NewInt64PtrParam("请确认消息类型!", p.NType)) + params = append(params, validator.NewStringPtrParam("请确认消息内容!", p.Message)) + + return +} diff --git a/api/proto/notification/proto/notification_op.go b/api/proto/notification/proto/notification_op.go index 4bcca8d0..01d3a98b 100644 --- a/api/proto/notification/proto/notification_op.go +++ b/api/proto/notification/proto/notification_op.go @@ -9,6 +9,8 @@ import ( type OpCreateReq struct { base.BaseRequest *dbstruct.Notification + ObjType *int64 `json:"obj_type"` // 通知接收人类型 + ObjMids []int64 `json:"obj_mids"` // 通知接收人mids } type OpCreateData struct { diff --git a/app/mix/service/service.go b/app/mix/service/service.go index deaac834..f28f5b2b 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -5021,14 +5021,6 @@ func (s *Service) OpCreateNotification(ctx *gin.Context, req *notificationproto. return } - // 加载进redis - _, err = redis.GetRedisClient().Incr(logic.GetNotificationCountIdForRedis(req.Notification.GetObjMid())) - if err != nil { - logger.Error("Redis Incr fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeNotificationCountRedisCacheInvalid - return - } - return }