Merge pull request 'feat-IRONFANS-212-Robin' (#793) from feat-IRONFANS-212-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/793
This commit is contained in:
chenhao 2024-11-12 17:38:29 +08:00
commit f74a126912
13 changed files with 405 additions and 43 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,20 @@ 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},
"zone_moment_reedition": {AudNotifTemp_ZoneMomentReeditionPassed, AudNotifTemp_ZoneMomentReeditionRejected},
}
// 跳转页面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 //等待复审
@ -220,6 +225,12 @@ const (
ZoneMomentManuallyReview_Rejected = 2 //已复审拒绝
)
// 私密动态是否被重新编辑
const (
IsReedited_No = 0 //否
IsReedited_Yes = 1 //是
)
// 七日内空间是否活跃
const (
ZoneIsActiveWithinAWeek_No = 0 //否

View File

@ -422,7 +422,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())
@ -454,7 +454,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())
@ -531,17 +531,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())
@ -610,7 +610,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

@ -172,7 +172,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
}
@ -2372,6 +2372,9 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe
return
}
// 发送通知
DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_MomentCreated)(req.Moment)
return
}
@ -3272,6 +3275,9 @@ func (s *Service) ApiCreateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
}
}
// 发送通知
DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_ZoneMomentCreated)(req.ZoneMoment)
return
}
@ -3325,6 +3331,7 @@ func (s *Service) ApiUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
req.ZoneMoment.ManuallyReviewStatus = goproto.Int64(consts.ZoneMomentManuallyReview_Waiting) // 等待复审
req.ZoneMoment.ManuallyReviewOpinion = goproto.String("") // 信息抹除
req.ZoneMoment.ManuallyReviewOperator = goproto.Int64(0) // 信息抹除
req.ZoneMoment.IsReedited = goproto.Int64(consts.IsReedited_Yes) // 已重新编辑
}
err = _DefaultZoneMoment.OpUpdate(ctx, &zonemomentproto.OpUpdateReq{
@ -3376,6 +3383,9 @@ func (s *Service) ApiUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
}
}
// 发送通知
DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_ZoneMomentReedited)(req.ZoneMoment)
return
}

View File

@ -8,6 +8,7 @@ import (
"service/bizcommon/util"
"service/dbstruct"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
goproto "google.golang.org/protobuf/proto"
@ -24,7 +25,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...)
}
}
}
}
@ -38,6 +42,7 @@ func NewNotifBuilderHandler() *NotifBuilderHandler {
func (handler *NotifBuilderHandler) init() {
handler.handlerMap = make(map[int64]func(ctx *gin.Context, args ...any))
// 注册系统通知处理
handler.handleSysNotifCancelNotif()
handler.handleSyncNotifBcstVersForUser()
handler.handleSyncNotifBcstVersForStreamer()
@ -50,10 +55,44 @@ func (handler *NotifBuilderHandler) init() {
handler.handleSysZoneCreated()
handler.handleSysZoneVasUpdated()
handler.handleSysZoneThirdPartnerCreated()
// 注册审核通知处理
handler.handleAudAvatarChangeApplied()
handler.handleAudNameChangeApplied()
handler.handleAudStreamerBasicInfoApplied()
handler.handleAudStreamerBasicInfoPassed()
handler.handleAudStreamerBasicInfoRejected()
handler.handleAudStreamerDetailsApplied()
handler.handleAudStreamerDetailsPassed()
handler.handleAudStreamerDetailsRejected()
handler.handleAudBioChangeApplied()
handler.handleAudBioPassed()
handler.handleAudBioRejected()
handler.handleAudAutoResponseMessageChangeApplied()
handler.handleAudAutoResponseMessagePassed()
handler.handleAudAutoResponseMessageRejected()
handler.handleAudCoverChangeApplied()
handler.handleAudCoverPassed()
handler.handleAudCoverRejected()
handler.handleAudAlbumChangeApplied()
handler.handleAudAlbumPassed()
handler.handleAudAlbumRejected()
handler.handleAudShortsChangeApplied()
handler.handleAudShortsPassed()
handler.handleAudShortsRejected()
handler.handleAudStreamerDirectlyUpdated()
handler.handleAudMomentCreated()
handler.handleAudMomentPassed()
handler.handleAudMomentRejected()
handler.handleAudZoneMomentCreated()
handler.handleAudZoneMomentPassed()
handler.handleAudZoneMomentRejected()
handler.handleAudZoneMomentReedited()
handler.handleAudZoneMomentReeditionPassed()
handler.handleAudZoneMomentReeditionRejected()
}
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 +106,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 +300,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 +324,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 +348,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 +372,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 +396,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)
@ -305,3 +419,150 @@ func (handler *NotifBuilderHandler) handleAudStreamerDirectlyUpdated() {
}
}
}
func (handler *NotifBuilderHandler) handleAudMomentCreated() {
handler.handlerMap[consts.AudNotifTemp_MomentCreated] = func(ctx *gin.Context, args ...any) {
moment := args[0].(*dbstruct.Moment)
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_MomentCreated, moment.GetMid())
}
}
func (handler *NotifBuilderHandler) handleAudMomentPassed() {
handler.handlerMap[consts.AudNotifTemp_MomentPassed] = func(ctx *gin.Context, args ...any) {
moment := args[0].(*dbstruct.Moment)
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) {
moment := args[0].(*dbstruct.Moment)
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)
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) {
zonemoment := args[0].(*dbstruct.ZoneMoment)
if zonemoment.GetIsReedited() != consts.IsReedited_No {
return
}
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) {
zonemoment := args[0].(*dbstruct.ZoneMoment)
remarks := args[1].(string)
if zonemoment.GetIsReedited() != consts.IsReedited_No {
return
}
// 获取跳转路径
frontendroute, err := _DefaultFrontendRoute.GetById(ctx, consts.FrontendRouteId_ZoneMomentEdit)
if err != nil {
logger.Error("_DefaultFrontendRoute GetById fail, err: %v", err)
}
// 获取缩略图
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.MediaComp)
coverIds, _ := mediafiller.GetCoverIds(ctx, mediaFillables)
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, remarks}
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())
}
}
func (handler *NotifBuilderHandler) handleAudZoneMomentReeditionPassed() {
handler.handlerMap[consts.AudNotifTemp_ZoneMomentReeditionPassed] = func(ctx *gin.Context, args ...any) {
zonemoment := args[0].(*dbstruct.ZoneMoment)
if zonemoment.GetIsReedited() != consts.IsReedited_Yes {
return
}
ctStr := util.FormatTsAsNotifT(zonemoment.GetCt())
cTypeDesc := consts.ZoneMomentCTypeDescMap[zonemoment.GetCType()]
mTypeDesc := consts.MTypeDescMap[zonemoment.GetMType()]
DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentReeditionPassed, zonemoment.GetMid(), ctStr, cTypeDesc, mTypeDesc)
}
}
func (handler *NotifBuilderHandler) handleAudZoneMomentReeditionRejected() {
handler.handlerMap[consts.AudNotifTemp_ZoneMomentReeditionRejected] = func(ctx *gin.Context, args ...any) {
zonemoment := args[0].(*dbstruct.ZoneMoment)
remarks := args[1].(string)
if zonemoment.GetIsReedited() != consts.IsReedited_Yes {
return
}
// 获取跳转路径
frontendroute, err := _DefaultFrontendRoute.GetById(ctx, consts.FrontendRouteId_ZoneMomentEdit)
if err != nil {
logger.Error("_DefaultFrontendRoute GetById fail, err: %v", err)
}
// 获取缩略图
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.MediaComp)
coverIds, _ := mediafiller.GetCoverIds(ctx, mediaFillables)
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, remarks}
argsMap["action"] = frontendroute.GetAction()
argsMap["params"] = frontendroute.GetRoutePath()
argsMap["thumbnail"] = preview
DefaultService.utilWriteNotifInfoByMap(ctx, consts.SysNotifTemp_ZoneCreated, zonemoment.GetMid(), argsMap)
}
}

View File

@ -1501,6 +1501,14 @@ func (s *Service) OpReviewMoment(ctx *gin.Context, req *momentproto.OpReviewReq)
return
}
// 查询得到动态
moments, err := _DefaultMoment.GetByIds(ctx, req.MomentIds)
if err != nil {
logger.Error("_DefaultMoment GetByIds fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneMomentSrvFail
return
}
// 更新请求,如果是通过,则恢复删除标志
updateReq := &momentproto.OpUpdateReq{
Moment: &dbstruct.Moment{
@ -1512,7 +1520,7 @@ func (s *Service) OpReviewMoment(ctx *gin.Context, req *momentproto.OpReviewReq)
}
// 更新动态的状态
err := _DefaultMoment.OpUpdateByIdsAndStatus(ctx, updateReq, req.MomentIds, consts.Moment_ManuallyReviewing)
err = _DefaultMoment.OpUpdateByIdsAndStatus(ctx, updateReq, req.MomentIds, consts.Moment_ManuallyReviewing)
if err != nil {
logger.Error("_DefaultMoment OpUpdateByIds fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeMomentSrvFail
@ -1538,6 +1546,11 @@ func (s *Service) OpReviewMoment(ctx *gin.Context, req *momentproto.OpReviewReq)
momentIds = req.MomentIds
}
// 发送通知
for _, moment := range moments {
DefaultNotifBuilderHandler.Handle(ctx)(util.GetNotifScene("moment", req.OpType))(moment)
}
return
}
@ -3368,6 +3381,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
}
@ -3460,6 +3479,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
}
@ -3550,6 +3575,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
}
@ -3886,7 +3917,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
}
@ -4464,8 +4495,16 @@ func (s *Service) OpReviewZoneMoment(ctx *gin.Context, req *zonemomentproto.OpRe
return
}
// 查询得到空间动态
zonemoments, err := _DefaultZoneMoment.GetByIds(ctx, req.ZoneMomentIds)
if err != nil {
logger.Error("_DefaultZoneMoment GetByIds fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneMomentSrvFail
return
}
// 更新动态的状态
err := _DefaultZoneMoment.OpUpdateByIdsAndStatus(ctx, &zonemomentproto.OpUpdateReq{
err = _DefaultZoneMoment.OpUpdateByIdsAndStatus(ctx, &zonemomentproto.OpUpdateReq{
ZoneMoment: &dbstruct.ZoneMoment{
Status: goproto.Int64(finalZoneMomentStatus),
ManuallyReviewStatus: goproto.Int64(finalManuallyReviewStatus),
@ -4497,20 +4536,10 @@ func (s *Service) OpReviewZoneMoment(ctx *gin.Context, req *zonemomentproto.OpRe
return
}
// 增加空间内统计总数
for _, id := range req.ZoneMomentIds {
zonemoment, err := _DefaultZoneMoment.GetById(ctx, id)
if err != nil {
logger.Error("_DefaultZoneMoment GetById fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneMomentSrvFail
return
}
if zonemoment == nil {
ec = errcode.ErrCodeZoneMomentNotExist
return
}
for _, zonemoment := range zonemoments {
mediaCountInc := len(zonemoment.MediaComp.GetImageIds())
videoCountInc := len(zonemoment.MediaComp.GetVideoIds())
err = _DefaultZone.RecordStatisticsById(ctx, util.DerefInt64(zonemoment.Zid), 1, int64(mediaCountInc), int64(videoCountInc))
err = _DefaultZone.RecordStatisticsById(ctx, zonemoment.GetZid(), 1, int64(mediaCountInc), int64(videoCountInc))
if err != nil {
logger.Error("RecordStatisticsById fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneSrvFail
@ -4519,6 +4548,12 @@ func (s *Service) OpReviewZoneMoment(ctx *gin.Context, req *zonemomentproto.OpRe
}
}
// 发送通知
for _, zonemoment := range zonemoments {
DefaultNotifBuilderHandler.Handle(ctx)(util.GetNotifScene("zone_moment", req.OpType),
util.GetNotifScene("zone_moment_reedition", req.OpType))(zonemoment, req.ManuallyReviewOpinion)
}
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

@ -39,6 +39,13 @@ func (p *Moment) GetId() int64 {
return 0
}
func (p *Moment) GetCt() int64 {
if p != nil && p.Ct != nil {
return *p.Ct
}
return 0
}
type MomentStatInfo struct {
Mid *int64 `json:"id" bson:"_id"` // mid
Count *int64 `json:"count" bson:"count"` // count

View File

@ -30,6 +30,7 @@ type ZoneMoment struct {
ManuallyReviewOpinion *string `json:"manually_review_opinion" bson:"manually_review_opinion"` // 人工复审意见
ManuallyReviewOperator *int64 `json:"manually_review_operator" bson:"manually_review_operator"` // 人工复审操作人
IsHeaded *int64 `json:"is_headed" bson:"is_headed"` // 是否已置顶
IsReedited *int64 `json:"is_reedited" bson:"is_reedited"` // 是否已重新编辑
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
@ -131,6 +132,20 @@ func (p *ZoneMoment) GetCoinPrice() int64 {
return util.RoundUp(float64(p.GetPrice()) / 10.0)
}
func (p *ZoneMoment) GetCt() int64 {
if p != nil && p.Ct != nil {
return *p.Ct
}
return 0
}
func (p *ZoneMoment) GetIsReedited() int64 {
if p != nil && p.IsReedited != nil {
return *p.IsReedited
}
return 0
}
type ZoneMomentStatInfo struct {
Mid *int64 `json:"id" bson:"_id"` // mid
Count *int64 `json:"count" bson:"count"` // count

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)