by Robin at 20241112

This commit is contained in:
Leufolium 2024-11-12 16:34:26 +08:00
parent 8af6b0ae1f
commit 0870b550b8
11 changed files with 260 additions and 33 deletions

View File

@ -9,9 +9,9 @@ const (
)
const (
// 操作控制部分,这部分为控制操作,不作为模板使用
SysNotifTemp_CancelNotif = -1 // 取消推送通知
SysNotifTemp_SyncNotifBcstVersForUser = -2 // 同步用户广播版本号
SysNotifTemp_SyncNotifBcstVersForStreamer = -3 // 同步主播广播版本号
CtrlNotifTemp_CancelNotif = -1 // 取消推送通知
CtrlNotifTemp_SyncNotifBcstVersForUser = -2 // 同步用户广播版本号
CtrlNotifTemp_SyncNotifBcstVersForStreamer = -3 // 同步主播广播版本号
SysNotifTemp_FirstLogin = 1 // 首次登录
SysNotifTemp_StreamerPunished = 2 // 主播封禁
@ -27,18 +27,18 @@ const (
SysNotifTemp_PlatformInfoUpdated = 12 // 主播编辑平台并保存(todo)
AudNotifTemp_AvatarChangeApplied = 100 // 用户修改头像
AudNotifTemp_AvatarPassed = 101 // 用户修改头像成功
AudNotifTemp_AvatarRollbacked = 102 // 用户修改头像被驳回
AudNotifTemp_AvatarPassed = 101 // 用户修改头像成功(todo)
AudNotifTemp_AvatarRollbacked = 102 // 用户修改头像被驳回(todo)
AudNotifTemp_NameChangeApplied = 103 // 用户修改昵称
AudNotifTemp_NamePassed = 104 // 用户修改昵称成功
AudNotifTemp_NameRollbacked = 105 // 用户修改昵称被驳回
AudNotifTemp_NamePassed = 104 // 用户修改昵称成功(todo)
AudNotifTemp_NameRollbacked = 105 // 用户修改昵称被驳回(todo)
AudNotifTemp_StreamerBasicInfoApplied = 106 // 提交申请入驻材料
AudNotifTemp_StreamerBasicInfoPassed = 107 // 运营后台审核通过申请入驻
AudNotifTemp_StreamerBasicInfoRejected = 108 // 运营后台审核未通过申请入驻
AudNotifTemp_StreamerDetailsApplied = 109 // 提交完善资料材料
AudNotifTemp_StreamerDetailsPassed = 110 // 运营后台审核通过完善资料
AudNotifTemp_StreamerDetailsRejected = 111 // 运营后台审核写上备注并未通过完善资料
AudNotifTemp_WithdrawalInfoApplied = 112 // 主播提交了申请提现相关的资料
AudNotifTemp_WithdrawalInfoApplied = 112 // 主播提交了申请提现相关的资料(todo)
AudNotifTemp_WithdrawalInfoPassed = 113 // 运营后台操作了相关资料审核:通过
AudNotifTemp_WithdrawalInfoRejected = 114 // 运营后台操作了相关资料审核:拒绝
AudNotifTemp_StreamerDirectlyUpdated = 115 // 主播在编辑主页时,仅修改选项内容后提交
@ -103,7 +103,19 @@ var NotifDescMap = map[int64]string{
Notif_Vas: "付费消息",
}
var AudNotifTempKeyMap = map[string][2]int64{
"streamer|streamer|bio": {AudNotifTemp_BioPassed, AudNotifTemp_BioRejected},
"streamer|streamer|auto_response_message": {AudNotifTemp_AutoResponseMessagePassed, AudNotifTemp_AutoResponseMessageRejected},
"streamer|streamer|cover": {AudNotifTemp_CoverPassed, AudNotifTemp_CoverRejected},
"streamer|streamer|album": {AudNotifTemp_AlbumPassed, AudNotifTemp_AlbumRejected},
"streamer|streamer|shorts": {AudNotifTemp_ShortsPassed, AudNotifTemp_ShortsRejected},
"zone|zone|profile": {AudNotifTemp_ProfilePassed, AudNotifTemp_ProfileRejected},
"moment": {AudNotifTemp_MomentPassed, AudNotifTemp_MomentRejected},
"zone_moment": {AudNotifTemp_ZoneMomentPassed, AudNotifTemp_ZoneMomentRejected},
}
// 跳转页面id
const (
FrontendRouteId_Zone = 0
FrontendRouteId_Zone = 0 // 空间主页
FrontendRouteId_ZoneMomentEdit = 1 // 重新编辑空间帖子的页面
)

View File

@ -79,6 +79,11 @@ const (
MediaTypeVideo = 2 // 视频
)
var MTypeDescMap = map[int64]string{
MediaTypeImg: "图片",
MediaTypeVideo: "视频",
}
const (
ZoneMomentHead_Head = 1
ZoneMomentHead_UnHead = 0

View File

@ -213,6 +213,11 @@ const (
ZoneMomentCType_Paid = 1 //付费
)
var ZoneMomentCTypeDescMap = map[int64]string{
ZoneMomentCType_Free: "免费",
ZoneMomentCType_Paid: "付费",
}
// 私密动态人工复审
const (
ZoneMomentManuallyReview_Waiting = 0 //等待复审

View File

@ -417,7 +417,7 @@ func Init(r *gin.Engine) {
opMomentGroup.POST("list_by_mid", middleware.JSONParamValidator(momentproto.OpListByMidReq{}), middleware.JwtAuthenticator(), OpGetMomentListByMid)
opMomentGroup.POST("thumbs_up", middleware.JSONParamValidator(momentproto.OpThumbsUpReq{}), middleware.JwtAuthenticator(), OpThumbsUpMoment)
opMomentGroup.POST("list_by_ids", middleware.JSONParamValidator(momentproto.OpListByIdsReq{}), middleware.JwtAuthenticator(), OpGetMomentListByIds)
opMomentGroup.POST("review", middleware.JSONParamValidator(momentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewMoment)
opMomentGroup.POST("review", middleware.JSONParamValidator(momentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewMoment, middleware.NotifSender())
// 足迹
opFootPrintGroup := r.Group("/op/footprint", PrepareOp())
@ -449,7 +449,7 @@ func Init(r *gin.Engine) {
opStreamerAuthApprovalGroup.POST("list", middleware.JSONParamValidator(streamerauthapprovalproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetStreamerAuthApprovalList)
opStreamerAuthApprovalGroup.POST("approve", middleware.JSONParamValidator(streamerauthapprovalproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApproval)
opStreamerAuthApprovalGroup.POST("list_basic", middleware.JSONParamValidator(streamerauthapprovalbasicproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetStreamerAuthApprovalBasicList)
opStreamerAuthApprovalGroup.POST("approve_basic", middleware.JSONParamValidator(streamerauthapprovalbasicproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApprovalBasic)
opStreamerAuthApprovalGroup.POST("approve_basic", middleware.JSONParamValidator(streamerauthapprovalbasicproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApprovalBasic, middleware.NotifSender())
opStreamerAuthApprovalGroup.POST("list_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetStreamerAuthApprovalDetailsList)
opStreamerAuthApprovalGroup.POST("approve_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApprovalDetails, middleware.NotifSender())
@ -526,17 +526,17 @@ func Init(r *gin.Engine) {
// 图片审核任务
opImageAuditTaskGroup := r.Group("/op/image_audit_task", PrepareOp())
opImageAuditTaskGroup.POST("list", middleware.JSONParamValidator(imageaudittaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetImageAuditTaskList)
opImageAuditTaskGroup.POST("review", middleware.JSONParamValidator(imageaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewImageAuditTaskBatch)
opImageAuditTaskGroup.POST("review", middleware.JSONParamValidator(imageaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewImageAuditTaskBatch, middleware.NotifSender())
// 文字审核任务
opTextAuditTaskGroup := r.Group("/op/text_audit_task", PrepareOp())
opTextAuditTaskGroup.POST("list", middleware.JSONParamValidator(textaudittaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetTextAuditTaskList)
opTextAuditTaskGroup.POST("review", middleware.JSONParamValidator(textaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewTextAuditTaskBatch)
opTextAuditTaskGroup.POST("review", middleware.JSONParamValidator(textaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewTextAuditTaskBatch, middleware.NotifSender())
// 视频审核任务
opVideoModerationTaskGroup := r.Group("/op/video_moderation_task", PrepareOp())
opVideoModerationTaskGroup.POST("list", middleware.JSONParamValidator(videomoderationtaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetVideoModerationTaskList)
opVideoModerationTaskGroup.POST("review", middleware.JSONParamValidator(videomoderationtaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewVideoModerationTaskBatch)
opVideoModerationTaskGroup.POST("review", middleware.JSONParamValidator(videomoderationtaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewVideoModerationTaskBatch, middleware.NotifSender())
// 动态审核任务表
opMomentAuditTaskGroup := r.Group("/op/moment_audit_task", PrepareOp())
@ -605,7 +605,7 @@ func Init(r *gin.Engine) {
opZoneMomentGroup.POST("delete", middleware.JSONParamValidator(zonemomentproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteZoneMoment)
opZoneMomentGroup.POST("list", middleware.JSONParamValidator(zonemomentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetZoneMomentList)
opZoneMomentGroup.POST("list_by_user_id", middleware.JSONParamValidator(zonemomentproto.OpListByUserIdReq{}), middleware.JwtAuthenticator(), OpGetZoneMomentListByUserId)
opZoneMomentGroup.POST("review", middleware.JSONParamValidator(zonemomentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewZoneMoment)
opZoneMomentGroup.POST("review", middleware.JSONParamValidator(zonemomentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewZoneMoment, middleware.NotifSender())
opZoneMomentGroup.POST("head", middleware.JSONParamValidator(zonemomentproto.OpHeadReq{}), middleware.JwtAuthenticator(), OpHeadZoneMoment)
opZoneMomentGroup.POST("set_private", middleware.JSONParamValidator(zonemomentproto.OpSetPrivateReq{}), middleware.JwtAuthenticator(), OpSetPrivateZoneMoment)

View File

@ -169,7 +169,7 @@ func (s *Service) ApiLoginByVeriCode(ctx *gin.Context, req *loginproto.ApiLoginB
}
// 写入自动发送消息的标签
DefaultNotifBuilderHandler.Handle(ctx)(
consts.SysNotifTemp_FirstLogin, consts.SysNotifTemp_SyncNotifBcstVersForUser)(account)
consts.SysNotifTemp_FirstLogin, consts.CtrlNotifTemp_SyncNotifBcstVersForUser)(account)
} else if ec != errcode.ErrCodeLoginSrvOk {
return
}

View File

@ -4,10 +4,13 @@ import (
"service/api/consts"
"service/api/interfaces"
accountpunishmentproto "service/api/proto/accountpunishment/proto"
momentproto "service/api/proto/moment/proto"
zoneproto "service/api/proto/zone/proto"
zonemomentproto "service/api/proto/zonemoment/proto"
"service/bizcommon/util"
"service/dbstruct"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
goproto "google.golang.org/protobuf/proto"
@ -24,7 +27,10 @@ func (handler *NotifBuilderHandler) Handle(ctx *gin.Context) func(scenes ...int6
return func(scenes ...int64) func(args ...any) {
return func(args ...any) {
for _, scene := range scenes {
handler.handlerMap[scene](ctx, args...)
handlerFunc, ok := handler.handlerMap[scene]
if ok {
handlerFunc(ctx, args...)
}
}
}
}
@ -53,7 +59,7 @@ func (handler *NotifBuilderHandler) init() {
}
func (handler *NotifBuilderHandler) handleSysNotifCancelNotif() {
handler.handlerMap[consts.SysNotifTemp_CancelNotif] = func(ctx *gin.Context, args ...any) {
handler.handlerMap[consts.CtrlNotifTemp_CancelNotif] = func(ctx *gin.Context, args ...any) {
nidAccessor := args[0].(interfaces.NidAccessible)
DefaultService.utilWriteNotifCancel(ctx, nidAccessor)
}
@ -67,16 +73,16 @@ func (handler *NotifBuilderHandler) handleSysFirstLogin() {
}
func (handler *NotifBuilderHandler) handleSyncNotifBcstVersForUser() {
handler.handlerMap[consts.SysNotifTemp_SyncNotifBcstVersForUser] = func(ctx *gin.Context, args ...any) {
handler.handlerMap[consts.CtrlNotifTemp_SyncNotifBcstVersForUser] = func(ctx *gin.Context, args ...any) {
account := args[0].(*dbstruct.Account)
DefaultService.utilWriteNotifInfo(ctx, consts.SysNotifTemp_SyncNotifBcstVersForUser, account.GetMid())
DefaultService.utilWriteNotifInfo(ctx, consts.CtrlNotifTemp_SyncNotifBcstVersForUser, account.GetMid())
}
}
func (handler *NotifBuilderHandler) handleSyncNotifBcstVersForStreamer() {
handler.handlerMap[consts.SysNotifTemp_SyncNotifBcstVersForStreamer] = func(ctx *gin.Context, args ...any) {
handler.handlerMap[consts.CtrlNotifTemp_SyncNotifBcstVersForStreamer] = func(ctx *gin.Context, args ...any) {
account := args[0].(*dbstruct.Account)
DefaultService.utilWriteNotifInfo(ctx, consts.SysNotifTemp_SyncNotifBcstVersForStreamer, account.GetMid())
DefaultService.utilWriteNotifInfo(ctx, consts.CtrlNotifTemp_SyncNotifBcstVersForStreamer, account.GetMid())
}
}
@ -261,6 +267,21 @@ func (handler *NotifBuilderHandler) handleAudBioChangeApplied() {
}
}
func (handler *NotifBuilderHandler) handleAudBioPassed() {
handler.handlerMap[consts.AudNotifTemp_BioPassed] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.TextAuditTask)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_BioPassed, task.GetMid())
}
}
func (handler *NotifBuilderHandler) handleAudBioRejected() {
handler.handlerMap[consts.AudNotifTemp_BioRejected] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.TextAuditTask)
remarks := args[1].(string)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_BioRejected, task.GetMid(), remarks)
}
}
func (handler *NotifBuilderHandler) handleAudAutoResponseMessageChangeApplied() {
handler.handlerMap[consts.AudNotifTemp_AutoResponseMessageChangeApplied] = func(ctx *gin.Context, args ...any) {
streamer := args[0].(*dbstruct.Streamer)
@ -270,6 +291,21 @@ func (handler *NotifBuilderHandler) handleAudAutoResponseMessageChangeApplied()
}
}
func (handler *NotifBuilderHandler) handleAudAutoResponseMessagePassed() {
handler.handlerMap[consts.AudNotifTemp_AutoResponseMessagePassed] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.TextAuditTask)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AutoResponseMessagePassed, task.GetMid())
}
}
func (handler *NotifBuilderHandler) handleAudAutoResponseMessageRejected() {
handler.handlerMap[consts.AudNotifTemp_AutoResponseMessageRejected] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.TextAuditTask)
remarks := args[1].(string)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AutoResponseMessageRejected, task.GetMid(), remarks)
}
}
func (handler *NotifBuilderHandler) handleAudCoverChangeApplied() {
handler.handlerMap[consts.AudNotifTemp_CoverChangeApplied] = func(ctx *gin.Context, args ...any) {
streamer := args[0].(*dbstruct.Streamer)
@ -279,6 +315,21 @@ func (handler *NotifBuilderHandler) handleAudCoverChangeApplied() {
}
}
func (handler *NotifBuilderHandler) handleAudCoverPassed() {
handler.handlerMap[consts.AudNotifTemp_CoverPassed] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.ImageAuditTask)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_CoverPassed, task.GetMid())
}
}
func (handler *NotifBuilderHandler) handleAudCoverRejected() {
handler.handlerMap[consts.AudNotifTemp_CoverRejected] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.ImageAuditTask)
remarks := args[1].(string)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_CoverRejected, task.GetMid(), remarks)
}
}
func (handler *NotifBuilderHandler) handleAudAlbumChangeApplied() {
handler.handlerMap[consts.AudNotifTemp_AlbumChangeApplied] = func(ctx *gin.Context, args ...any) {
streamer := args[0].(*dbstruct.Streamer)
@ -288,6 +339,21 @@ func (handler *NotifBuilderHandler) handleAudAlbumChangeApplied() {
}
}
func (handler *NotifBuilderHandler) handleAudAlbumPassed() {
handler.handlerMap[consts.AudNotifTemp_AlbumPassed] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.ImageAuditTask)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AlbumPassed, task.GetMid())
}
}
func (handler *NotifBuilderHandler) handleAudAlbumRejected() {
handler.handlerMap[consts.AudNotifTemp_AlbumRejected] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.ImageAuditTask)
remarks := args[1].(string)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AlbumRejected, task.GetMid(), remarks)
}
}
func (handler *NotifBuilderHandler) handleAudShortsChangeApplied() {
handler.handlerMap[consts.AudNotifTemp_ShortsChangeApplied] = func(ctx *gin.Context, args ...any) {
streamer := args[0].(*dbstruct.Streamer)
@ -297,6 +363,21 @@ func (handler *NotifBuilderHandler) handleAudShortsChangeApplied() {
}
}
func (handler *NotifBuilderHandler) handleAudShortsPassed() {
handler.handlerMap[consts.AudNotifTemp_ShortsPassed] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.VideoModerationTask)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ShortsPassed, task.GetMid())
}
}
func (handler *NotifBuilderHandler) handleAudShortsRejected() {
handler.handlerMap[consts.AudNotifTemp_ShortsRejected] = func(ctx *gin.Context, args ...any) {
task := args[0].(*dbstruct.VideoModerationTask)
remarks := args[1].(string)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ShortsRejected, task.GetMid(), remarks)
}
}
func (handler *NotifBuilderHandler) handleAudStreamerDirectlyUpdated() {
handler.handlerMap[consts.AudNotifTemp_StreamerDirectlyUpdated] = func(ctx *gin.Context, args ...any) {
streamer := args[0].(*dbstruct.Streamer)
@ -313,16 +394,111 @@ func (handler *NotifBuilderHandler) handleAudMomentCreated() {
}
}
func (handler *NotifBuilderHandler) handleAudMomentPassed() {
handler.handlerMap[consts.AudNotifTemp_MomentPassed] = func(ctx *gin.Context, args ...any) {
req := args[0].(*momentproto.OpReviewReq)
moments, err := _DefaultMoment.GetByIds(ctx, req.MomentIds)
if err != nil {
logger.Error("_DefaultMoment GetByIds fail, req: %v, err: %v", util.ToJson(req), err)
return
}
for _, moment := range moments {
ctStr := util.FormatTsAsNotifT(moment.GetCt())
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_MomentPassed, moment.GetMid(), ctStr)
}
}
}
func (handler *NotifBuilderHandler) handleAudMomentRejected() {
handler.handlerMap[consts.AudNotifTemp_MomentRejected] = func(ctx *gin.Context, args ...any) {
req := args[0].(*momentproto.OpReviewReq)
moments, err := _DefaultMoment.GetByIds(ctx, req.MomentIds)
if err != nil {
logger.Error("_DefaultMoment GetByIds fail, req: %v, err: %v", util.ToJson(req), err)
return
}
for _, moment := range moments {
ctStr := util.FormatTsAsNotifT(moment.GetCt())
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_MomentRejected, moment.GetMid(), ctStr)
}
}
}
func (handler *NotifBuilderHandler) handleAudZoneMomentCreated() {
handler.handlerMap[consts.AudNotifTemp_ZoneMomentCreated] = func(ctx *gin.Context, args ...any) {
zoneMoment := args[0].(*dbstruct.ZoneMoment)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentCreated, zoneMoment.GetMid())
zonemoment := args[0].(*dbstruct.ZoneMoment)
cTypeDesc := consts.ZoneMomentCTypeDescMap[zonemoment.GetCType()]
mTypeDesc := consts.MTypeDescMap[zonemoment.GetMType()]
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentCreated, zonemoment.GetMid(), cTypeDesc, mTypeDesc)
}
}
func (handler *NotifBuilderHandler) handleAudZoneMomentPassed() {
handler.handlerMap[consts.AudNotifTemp_ZoneMomentPassed] = func(ctx *gin.Context, args ...any) {
req := args[0].(*zonemomentproto.OpReviewReq)
zonemoments, err := _DefaultZoneMoment.GetByIds(ctx, req.ZoneMomentIds)
if err != nil {
logger.Error("_DefaultZoneMoment GetByIds fail, req: %v, err: %v", util.ToJson(req), err)
return
}
for _, zonemoment := range zonemoments {
ctStr := util.FormatTsAsNotifT(zonemoment.GetCt())
cTypeDesc := consts.ZoneMomentCTypeDescMap[zonemoment.GetCType()]
mTypeDesc := consts.MTypeDescMap[zonemoment.GetMType()]
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentPassed, zonemoment.GetMid(), ctStr, cTypeDesc, mTypeDesc)
}
}
}
func (handler *NotifBuilderHandler) handleAudZoneMomentRejected() {
handler.handlerMap[consts.AudNotifTemp_ZoneMomentRejected] = func(ctx *gin.Context, args ...any) {
req := args[0].(*zonemomentproto.OpReviewReq)
// 获取跳转路径
frontendroute, err := _DefaultFrontendRoute.GetById(ctx, consts.FrontendRouteId_ZoneMomentEdit)
if err != nil {
logger.Error("_DefaultFrontendRoute GetById fail, err: %v", err)
}
zonemoments, err := _DefaultZoneMoment.GetByIds(ctx, req.ZoneMomentIds)
if err != nil {
logger.Error("_DefaultZoneMoment GetByIds fail, req: %v, err: %v", util.ToJson(req), err)
return
}
for _, zonemoment := range zonemoments {
// 获取缩略图
preview := &dbstruct.MediaComponent{}
if zonemoment.GetMType() == consts.MediaTypeImg { // 取首图
imageIds := zonemoment.MediaComp.GetImageIds()
preview.ImageIds = util.Int64Slice([]int64{imageIds[0]})
} else if zonemoment.GetMType() == consts.MediaTypeVideo { // 取封面
mediaFillables := make([]mediafiller.MediaFillable, 0)
mediaFillables = append(mediaFillables, zonemoment)
coverIds, err := mediafiller.GetCoverIds(ctx, mediaFillables)
if err != nil {
logger.Error("GetCoverIds fail, req: %v, err: %v", util.ToJson(req), err)
}
preview.ImageIds = util.Int64Slice(coverIds)
}
ctStr := util.FormatTsAsNotifT(zonemoment.GetCt())
cTypeDesc := consts.ZoneMomentCTypeDescMap[zonemoment.GetCType()]
mTypeDesc := consts.MTypeDescMap[zonemoment.GetMType()]
argsMap := make(map[string]any)
argsMap["template_params"] = []any{ctStr, cTypeDesc, mTypeDesc, req.ManuallyReviewOpinion}
argsMap["action"] = frontendroute.GetAction()
argsMap["params"] = frontendroute.GetRoutePath()
argsMap["thumbnail"] = preview
DefaultService.utilWriteNotifInfoByMap(ctx, consts.SysNotifTemp_ZoneCreated, zonemoment.GetMid(), argsMap)
}
}
}
func (handler *NotifBuilderHandler) handleAudZoneMomentReedited() {
handler.handlerMap[consts.AudNotifTemp_ZoneMomentReedited] = func(ctx *gin.Context, args ...any) {
zoneMoment := args[0].(*dbstruct.ZoneMoment)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentReedited, zoneMoment.GetMid())
zonemoment := args[0].(*dbstruct.ZoneMoment)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentReedited, zonemoment.GetMid())
}
}

View File

@ -1535,6 +1535,9 @@ func (s *Service) OpReviewMoment(ctx *gin.Context, req *momentproto.OpReviewReq)
momentIds = req.MomentIds
}
// 发送通知
DefaultNotifBuilderHandler.Handle(ctx)(util.GetNotifScene("moment", req.OpType))(req)
return
}
@ -3365,6 +3368,12 @@ func (s *Service) OpReviewImageAuditTaskBatch(ctx *gin.Context, req *imageauditt
return errcode.ErrCodeImageAuditSrvFail
}
// 发送通知
for _, task := range tasks {
key := fmt.Sprintf("%v|%v|%v", task.GetAssociativeDatabase(), task.GetAssociativeTableName(), task.GetAssociativeTableColumn())
DefaultNotifBuilderHandler.Handle(ctx)(util.GetNotifScene(key, req.OpType))(task, req.ManuallyReviewOpinion)
}
return
}
@ -3457,6 +3466,12 @@ func (s *Service) OpReviewTextAuditTaskBatch(ctx *gin.Context, req *textaudittas
return errcode.ErrCodeTextAuditSrvFail
}
// 发送通知
for _, task := range tasks {
key := fmt.Sprintf("%v|%v|%v", task.GetAssociativeDatabase(), task.GetAssociativeTableName(), task.GetAssociativeTableColumn())
DefaultNotifBuilderHandler.Handle(ctx)(util.GetNotifScene(key, req.OpType))(task, req.ManuallyReviewOpinion)
}
return
}
@ -3547,6 +3562,12 @@ func (s *Service) OpReviewVideoModerationTaskBatch(ctx *gin.Context, req *videom
return errcode.ErrCodeVideoModerationSrvFail
}
// 发送通知
for _, task := range tasks {
key := fmt.Sprintf("%v|%v|%v", task.GetAssociativeDatabase(), task.GetAssociativeTableName(), task.GetAssociativeTableColumn())
DefaultNotifBuilderHandler.Handle(ctx)(util.GetNotifScene(key, req.OpType))(task, req.ManuallyReviewOpinion)
}
return
}
@ -3871,7 +3892,7 @@ func (s *Service) OpUnblockAccountPunishment(ctx *gin.Context, req *accountpunis
ec = errcode.ErrCodeAccountPunishmentSrvFail
return
}
DefaultNotifBuilderHandler.Handle(ctx)(consts.SysNotifTemp_CancelNotif)(acctpunishment)
DefaultNotifBuilderHandler.Handle(ctx)(consts.CtrlNotifTemp_CancelNotif)(acctpunishment)
return
}
@ -4505,6 +4526,9 @@ func (s *Service) OpReviewZoneMoment(ctx *gin.Context, req *zonemomentproto.OpRe
}
}
// 发送通知
DefaultNotifBuilderHandler.Handle(ctx)(util.GetNotifScene("zone_moment", req.OpType))(req)
return
}

View File

@ -1734,7 +1734,7 @@ func (s *Service) utilGetZonePreviews(ctx *gin.Context, zid int64) (previews *db
return
}
objectMediaNum := 1 // 单个空间服务总共5个媒体类
objectMediaNum := 1 // 单个空间服务总共1个媒体类
mediaFillableList := make([]mediafiller.MediaFillable, len(vzmlist)*objectMediaNum)
for i, vo := range vzmlist {
mediaFillableList[objectMediaNum*i+0] = vo.MediaComp
@ -2184,7 +2184,7 @@ func (s *Service) utilWriteNotifCancel(ctx *gin.Context, nidAccessor interfaces.
}
notifBuilders = append(notifBuilders, &dbstruct.NotifBuilder{
TemplateId: consts.SysNotifTemp_CancelNotif,
TemplateId: consts.CtrlNotifTemp_CancelNotif,
GetNid: nidAccessor.GetNid,
})
ctx.Set("notif_builders", notifBuilders)

View File

@ -8,6 +8,7 @@ import (
"math"
"math/rand"
"reflect"
"service/api/consts"
"service/api/message"
"service/library/logger"
"sort"
@ -438,3 +439,7 @@ func FormatTs(timestamp int64, format string) string {
func FormatTsAsNotifT(timestamp int64) string {
return FormatTs(timestamp, "2006年1月2日 15时04分")
}
func GetNotifScene(key string, option int64) int64 {
return consts.AudNotifTempKeyMap[key][option]
}

View File

@ -90,7 +90,7 @@ func NotifSender() gin.HandlerFunc {
}
func CancelNotif(ctx *gin.Context, notifBuilder *dbstruct.NotifBuilder, notifService *logic.Notification) bool {
if notifBuilder.TemplateId == consts.SysNotifTemp_CancelNotif {
if notifBuilder.TemplateId == consts.CtrlNotifTemp_CancelNotif {
err := notifService.OpUpdate(ctx, &notificationproto.OpUpdateReq{
Notification: &dbstruct.Notification{
Id: goproto.Int64(notifBuilder.GetNid()),
@ -108,10 +108,10 @@ func CancelNotif(ctx *gin.Context, notifBuilder *dbstruct.NotifBuilder, notifSer
func SyncNotifBcstVers(ctx *gin.Context, notifBuilder *dbstruct.NotifBuilder, notifBcstVersService *logic.NotifBcstVers) bool {
objType := int64(-1)
if notifBuilder.TemplateId == consts.SysNotifTemp_SyncNotifBcstVersForUser {
if notifBuilder.TemplateId == consts.CtrlNotifTemp_SyncNotifBcstVersForUser {
objType = consts.Notification_ObjType_AllUser
} else if notifBuilder.TemplateId == consts.SysNotifTemp_SyncNotifBcstVersForStreamer {
} else if notifBuilder.TemplateId == consts.CtrlNotifTemp_SyncNotifBcstVersForStreamer {
objType = consts.Notification_ObjType_AllStreamer
}

View File

@ -32,7 +32,7 @@ func Test(t *testing.T) {
// fmt.Println(string(phone))
// hash := mycrypto.CryptoServiceInstance().SHA256.Encrypt(phone)
// fmt.Println(string(hash))
mobilePhone := "15051772749"
mobilePhone := "18080917370"
rsaBytes, _ := mycrypto.CryptoServiceInstance().AES.Encrypt([]byte(mobilePhone))
base64EncryptedBytes := make([]byte, base64.StdEncoding.EncodedLen(len(rsaBytes)))
base64.StdEncoding.Encode(base64EncryptedBytes, rsaBytes)