This commit is contained in:
Leufolium 2024-10-14 13:39:19 +08:00
parent 857679c1fc
commit 357ee2a3be
4 changed files with 29 additions and 8 deletions

View File

@ -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
)

View File

@ -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
}

View File

@ -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 {

View File

@ -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
}