conflict-test-feat-20240117-001 #88

Merged
chenhao merged 12 commits from conflict-test-feat-20240117-001 into test 2024-02-02 07:44:18 +08:00
5 changed files with 89 additions and 0 deletions
Showing only changes of commit 110043116d - Show all commits

View File

@ -74,3 +74,10 @@ const (
Feedback_Invalid = 3 //无效
Feedback_RelatedToIteration = 4 //迭代相关
)
// 动态表status状态
const (
Moment_Private = 0 //仅自己可见
Moment_OpenToCircles = 1 //仅朋友圈可见
Moment_Public = 2 //公开
)

View File

@ -56,3 +56,20 @@ func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer *
return
}
func (s *Service) CreateMomentImageAudit(ctx *gin.Context, newMoment *dbstruct.Moment) (tasks []*dbstruct.ImageAuditTask) {
if newMoment.MediaComp != nil {
tasks = append(tasks, &dbstruct.ImageAuditTask{
RouteUrl: goproto.String(ctx.Request.URL.Path),
AssociativeDatabase: goproto.String("moment"),
AssociativeTableName: goproto.String("moment"),
AssociativeTableId: newMoment.Id,
AssociativeTableColumn: goproto.String("media_component"),
AuditedMedia: newMoment.MediaComp,
OldMedia: nil,
})
}
return
}

View File

@ -4,11 +4,13 @@ import (
"fmt"
"service/api/consts"
accountproto "service/api/proto/account/proto"
momentproto "service/api/proto/moment/proto"
streamerproto "service/api/proto/streamer/proto"
"service/bizcommon/util"
"service/dbstruct"
"github.com/gin-gonic/gin"
goproto "google.golang.org/protobuf/proto"
)
var DefaultImageAuditTaskResultHandler *ImageAuditTaskResultHandler
@ -34,6 +36,7 @@ func (handler *ImageAuditTaskResultHandler) initImageAuditTaskUpdateFuncGenerato
handler.generateAccountAvatarUpdateFunc()
handler.generateStreamerCoverUpdateFunc()
handler.generateStreamerAlbumUpdateFunc()
handler.generateMomentMediaComponentUpdateFunc()
}
func (handler *ImageAuditTaskResultHandler) getImageAuditTaskUpdateFunc(ctx *gin.Context, task *dbstruct.ImageAuditTask, option int) func() error {
@ -112,3 +115,24 @@ func (handler *ImageAuditTaskResultHandler) generateStreamerAlbumUpdateFunc() {
}
}
}
// 动态表->图像内容,若不通过,则将状态设置为仅自己可见
func (handler *ImageAuditTaskResultHandler) generateMomentMediaComponentUpdateFunc() {
handler.imageAuditTaskUpdateFuncGeneratorMap["moment|moment|media_component"] = func(ctx *gin.Context, task *dbstruct.ImageAuditTask, option int) func() error {
return func() error {
momentId := task.AssociativeTableId
var status int64
if option == consts.ImageAuditTaskUpdate_Pass {
status = consts.Moment_Public
} else {
status = consts.Moment_Private
}
return _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{
Moment: &dbstruct.Moment{
Id: momentId,
Status: goproto.Int64(status),
},
})
}
}
}

View File

@ -58,3 +58,20 @@ func (s *Service) CreateUpdateStreamerTextAudit(ctx *gin.Context, oldStreamer *d
return
}
func (s *Service) CreateMomentTextAudit(ctx *gin.Context, newMoment *dbstruct.Moment) (tasks []*dbstruct.TextAuditTask) {
if newMoment.Text != nil {
tasks = append(tasks, &dbstruct.TextAuditTask{
RouteUrl: goproto.String(ctx.Request.URL.Path),
AssociativeDatabase: goproto.String("moment"),
AssociativeTableName: goproto.String("moment"),
AssociativeTableId: newMoment.Id,
AssociativeTableColumn: goproto.String("text"),
AuditedText: newMoment.Text,
OldText: nil,
})
}
return
}

View File

@ -4,11 +4,13 @@ import (
"fmt"
"service/api/consts"
accountproto "service/api/proto/account/proto"
momentproto "service/api/proto/moment/proto"
streamerproto "service/api/proto/streamer/proto"
"service/bizcommon/util"
"service/dbstruct"
"github.com/gin-gonic/gin"
goproto "google.golang.org/protobuf/proto"
)
var DefaultTextAuditTaskResultHandler *TextAuditTaskResultHandler
@ -34,6 +36,7 @@ func (handler *TextAuditTaskResultHandler) initTextAuditTaskUpdateFuncGeneratorM
handler.generateAccountNameUpdateFunc()
handler.generateStreamerBioUpdateFunc()
handler.generateStreamerAutoResponseMessageUpdateFunc()
handler.generateMomentTextUpdateFunc()
}
func (handler *TextAuditTaskResultHandler) getTextAuditTaskUpdateFunc(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
@ -112,3 +115,24 @@ func (handler *TextAuditTaskResultHandler) generateStreamerAutoResponseMessageUp
}
}
}
// 动态表->文字内容,若不通过,则将状态设置为仅自己可见
func (handler *TextAuditTaskResultHandler) generateMomentTextUpdateFunc() {
handler.textAuditTaskUpdateFuncGeneratorMap["moment|moment|text"] = func(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
return func() error {
momentId := task.AssociativeTableId
var status int64
if option == consts.ImageAuditTaskUpdate_Pass {
status = consts.Moment_Public
} else {
status = consts.Moment_Private
}
return _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{
Moment: &dbstruct.Moment{
Id: momentId,
Status: goproto.Int64(status),
},
})
}
}
}