by Robin at 20240717
This commit is contained in:
parent
7d22149037
commit
02e9883ffe
|
@ -2319,7 +2319,7 @@ func (m *Mongo) CreateStreamer(ctx *gin.Context, streamer *dbstruct.Streamer) er
|
|||
|
||||
func (m *Mongo) UpdateStreamer(ctx *gin.Context, streamer *dbstruct.Streamer) error {
|
||||
col := m.getColStreamer()
|
||||
set := util.DeepEntityToM(streamer)
|
||||
set := util.EntityToM(streamer)
|
||||
set["ut"] = time.Now().Unix()
|
||||
filter := qmgo.M{
|
||||
"mid": util.DerefInt64(streamer.Mid),
|
||||
|
|
|
@ -1086,37 +1086,44 @@ func (s *Service) ApiUpdateStreamer(ctx *gin.Context, req *streamerproto.ApiUpda
|
|||
|
||||
// 初始化审核内容
|
||||
initAuditComp := &dbstruct.AuditComponent{
|
||||
AuditStatus: goproto.Int64(consts.ImageAudit_Created),
|
||||
AuditOpinion: goproto.String("该字段有更新,正在等待机审"),
|
||||
ReviewStatus: goproto.Int64(consts.ImageManuallyReview_Waiting),
|
||||
ReviewOpinion: goproto.String("该字段有更新,正在等待人工复审"),
|
||||
AuditStatus: goproto.Int64(consts.ImageAudit_Created),
|
||||
AuditOpinion: goproto.String("该字段有更新,正在等待机审"),
|
||||
}
|
||||
initReviewComp := &dbstruct.AuditComponent{
|
||||
AuditStatus: goproto.Int64(consts.ImageManuallyReview_Waiting),
|
||||
AuditOpinion: goproto.String("该字段有更新,正在等待人工复审"),
|
||||
}
|
||||
if len(imageaudittasks) > 0 {
|
||||
for _, task := range imageaudittasks {
|
||||
if task.GetAssociativeTableColumn() == "cover" {
|
||||
updateReq.Streamer.CoverAudit = initAuditComp
|
||||
updateReq.Streamer.CoverReview = initReviewComp
|
||||
} else if task.GetAssociativeTableColumn() == "album" {
|
||||
updateReq.Streamer.AlbumAudit = initAuditComp
|
||||
updateReq.Streamer.AlbumReview = initReviewComp
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(textaudittasks) > 0 {
|
||||
initAuditComp.AuditStatus = goproto.Int64(consts.TextAudit_Created)
|
||||
initAuditComp.ReviewStatus = goproto.Int64(consts.TextManuallyReview_Waiting)
|
||||
initReviewComp.AuditStatus = goproto.Int64(consts.TextManuallyReview_Waiting)
|
||||
for _, task := range textaudittasks {
|
||||
if task.GetAssociativeTableColumn() == "bio" {
|
||||
updateReq.Streamer.BioAudit = initAuditComp
|
||||
updateReq.Streamer.BioReview = initReviewComp
|
||||
} else if task.GetAssociativeTableColumn() == "auto_response_message" {
|
||||
updateReq.Streamer.AutoResponseMessageAudit = initAuditComp
|
||||
updateReq.Streamer.AutoResponseMessageReview = initReviewComp
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(videomoderationtasks) > 0 {
|
||||
initAuditComp.AuditStatus = goproto.Int64(consts.VideoModeration_Created)
|
||||
initAuditComp.ReviewStatus = goproto.Int64(consts.VideoManuallyReview_Waiting)
|
||||
initReviewComp.AuditStatus = goproto.Int64(consts.VideoManuallyReview_Waiting)
|
||||
for _, task := range videomoderationtasks {
|
||||
if task.GetAssociativeTableColumn() == "shorts" {
|
||||
updateReq.Streamer.ShortsAudit = initAuditComp
|
||||
updateReq.Streamer.ShortsReview = initReviewComp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,12 +87,13 @@ func (handler *ImageAuditTaskResultHandler) generateStreamerCoverUpdateFunc() {
|
|||
handler.imageAuditTaskUpdateFuncGeneratorMap["streamer|streamer|cover"] = func(ctx *gin.Context, task *dbstruct.ImageAuditTask, option int) func() error {
|
||||
return func() error {
|
||||
mid := task.AssociativeTableId
|
||||
auditcomp, finalMedia := getImageUpdateInfo(task, option)
|
||||
auditcomp, reviewcomp, finalMedia := getImageUpdateInfo(task, option)
|
||||
return _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{
|
||||
Streamer: &dbstruct.Streamer{
|
||||
Mid: mid,
|
||||
Cover: finalMedia,
|
||||
CoverAudit: auditcomp,
|
||||
Mid: mid,
|
||||
Cover: finalMedia,
|
||||
CoverAudit: auditcomp,
|
||||
CoverReview: reviewcomp,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -104,12 +105,13 @@ func (handler *ImageAuditTaskResultHandler) generateStreamerAlbumUpdateFunc() {
|
|||
handler.imageAuditTaskUpdateFuncGeneratorMap["streamer|streamer|album"] = func(ctx *gin.Context, task *dbstruct.ImageAuditTask, option int) func() error {
|
||||
return func() error {
|
||||
mid := task.AssociativeTableId
|
||||
auditcomp, finalMedia := getImageUpdateInfo(task, option)
|
||||
auditcomp, reviewcomp, finalMedia := getImageUpdateInfo(task, option)
|
||||
return _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{
|
||||
Streamer: &dbstruct.Streamer{
|
||||
Mid: mid,
|
||||
Album: finalMedia,
|
||||
AlbumAudit: auditcomp,
|
||||
Mid: mid,
|
||||
Album: finalMedia,
|
||||
AlbumAudit: auditcomp,
|
||||
CoverReview: reviewcomp,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -266,17 +268,17 @@ func tryToFinishImageAuditTaskOfMoment(ctx *gin.Context, task *dbstruct.ImageAud
|
|||
return nil
|
||||
}
|
||||
|
||||
func getImageUpdateInfo(task *dbstruct.ImageAuditTask, option int) (auditcomp *dbstruct.AuditComponent, finalMedia *dbstruct.MediaComponent) {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
|
||||
func getImageUpdateInfo(task *dbstruct.ImageAuditTask, option int) (auditcomp *dbstruct.AuditComponent, reviewcomp *dbstruct.AuditComponent, finalMedia *dbstruct.MediaComponent) {
|
||||
// 机审成功后切面
|
||||
if option == consts.ImageAuditTaskUpdate_Success {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
auditcomp.AuditStatus = goproto.Int64(consts.ImageAudit_Passed)
|
||||
auditcomp.AuditOpinion = goproto.String("机审通过")
|
||||
}
|
||||
|
||||
// 机审失败后切面,将机审信息写入streamer表
|
||||
if option == consts.ImageAuditTaskUpdate_Rollback {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
imageAuditOpinion := &strings.Builder{}
|
||||
if task.GetStatus() == consts.ImageAudit_ServiceFailed {
|
||||
imageAuditOpinion.WriteString("机审失败")
|
||||
|
@ -296,15 +298,17 @@ func getImageUpdateInfo(task *dbstruct.ImageAuditTask, option int) (auditcomp *d
|
|||
|
||||
// 人审通过后切面,执行更新
|
||||
if option == consts.ImageAuditTaskUpdate_Pass {
|
||||
auditcomp.ReviewStatus = goproto.Int64(consts.ImageManuallyReview_Passed)
|
||||
auditcomp.ReviewOpinion = task.Remarks
|
||||
reviewcomp = &dbstruct.AuditComponent{}
|
||||
reviewcomp.AuditStatus = goproto.Int64(consts.ImageManuallyReview_Passed)
|
||||
reviewcomp.AuditOpinion = task.Remarks
|
||||
finalMedia = task.AuditedMedia
|
||||
}
|
||||
|
||||
// 人审拒绝后切面
|
||||
if option == consts.ImageAuditTaskUpdate_Reject {
|
||||
auditcomp.ReviewStatus = goproto.Int64(consts.ImageManuallyReview_Rejected)
|
||||
auditcomp.ReviewOpinion = task.Remarks
|
||||
reviewcomp = &dbstruct.AuditComponent{}
|
||||
reviewcomp.AuditStatus = goproto.Int64(consts.ImageManuallyReview_Rejected)
|
||||
reviewcomp.AuditOpinion = task.Remarks
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -110,12 +110,13 @@ func (handler *TextAuditTaskResultHandler) generateStreamerBioUpdateFunc() {
|
|||
handler.textAuditTaskUpdateFuncGeneratorMap["streamer|streamer|bio"] = func(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
|
||||
return func() error {
|
||||
mid := task.AssociativeTableId
|
||||
auditcomp, finalText := getTextUpdateInfo(task, option)
|
||||
auditcomp, reviewcomp, finalText := getTextUpdateInfo(task, option)
|
||||
return _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{
|
||||
Streamer: &dbstruct.Streamer{
|
||||
Mid: mid,
|
||||
Bio: finalText,
|
||||
BioAudit: auditcomp,
|
||||
Mid: mid,
|
||||
Bio: finalText,
|
||||
BioAudit: auditcomp,
|
||||
BioReview: reviewcomp,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -127,12 +128,13 @@ func (handler *TextAuditTaskResultHandler) generateStreamerAutoResponseMessageUp
|
|||
handler.textAuditTaskUpdateFuncGeneratorMap["streamer|streamer|auto_response_message"] = func(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
|
||||
return func() error {
|
||||
mid := task.AssociativeTableId
|
||||
auditcomp, finalText := getTextUpdateInfo(task, option)
|
||||
auditcomp, reviewcomp, finalText := getTextUpdateInfo(task, option)
|
||||
return _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{
|
||||
Streamer: &dbstruct.Streamer{
|
||||
Mid: mid,
|
||||
AutoResponseMessage: finalText,
|
||||
AutoResponseMessageAudit: auditcomp,
|
||||
Mid: mid,
|
||||
AutoResponseMessage: finalText,
|
||||
AutoResponseMessageAudit: auditcomp,
|
||||
AutoResponseMessageReview: reviewcomp,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -239,17 +241,17 @@ func tryToFinishTextAuditTaskOfMoment(ctx *gin.Context, task *dbstruct.TextAudit
|
|||
return nil
|
||||
}
|
||||
|
||||
func getTextUpdateInfo(task *dbstruct.TextAuditTask, option int) (auditcomp *dbstruct.AuditComponent, finalText *string) {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
|
||||
func getTextUpdateInfo(task *dbstruct.TextAuditTask, option int) (auditcomp *dbstruct.AuditComponent, reviewcomp *dbstruct.AuditComponent, finalText *string) {
|
||||
// 机审成功后切面
|
||||
if option == consts.TextAuditTaskUpdate_Success {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
auditcomp.AuditStatus = goproto.Int64(consts.TextAudit_Passed)
|
||||
auditcomp.AuditOpinion = goproto.String("机审通过")
|
||||
}
|
||||
|
||||
// 机审失败后切面,将机审信息写入streamer表
|
||||
if option == consts.TextAuditTaskUpdate_Rollback {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
var textAuditOpinion string
|
||||
if task.GetStatus() == consts.TextAudit_ServiceFailed {
|
||||
textAuditOpinion = "机审失败"
|
||||
|
@ -263,15 +265,17 @@ func getTextUpdateInfo(task *dbstruct.TextAuditTask, option int) (auditcomp *dbs
|
|||
|
||||
// 人审通过后切面,执行更新
|
||||
if option == consts.TextAuditTaskUpdate_Pass {
|
||||
auditcomp.ReviewStatus = goproto.Int64(consts.TextManuallyReview_Passed)
|
||||
auditcomp.ReviewOpinion = task.Remarks
|
||||
reviewcomp = &dbstruct.AuditComponent{}
|
||||
reviewcomp.AuditStatus = goproto.Int64(consts.TextManuallyReview_Passed)
|
||||
reviewcomp.AuditOpinion = task.Remarks
|
||||
finalText = task.AuditedText
|
||||
}
|
||||
|
||||
// 人审拒绝后切面
|
||||
if option == consts.TextAuditTaskUpdate_Reject {
|
||||
auditcomp.ReviewStatus = goproto.Int64(consts.TextManuallyReview_Rejected)
|
||||
auditcomp.ReviewOpinion = task.Remarks
|
||||
reviewcomp = &dbstruct.AuditComponent{}
|
||||
reviewcomp.AuditStatus = goproto.Int64(consts.TextManuallyReview_Rejected)
|
||||
reviewcomp.AuditOpinion = task.Remarks
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -58,12 +58,13 @@ func (handler *VideoModerationTaskResultHandler) generateStreamerShortsUpdateFun
|
|||
handler.videoModerationTaskUpdateFuncGeneratorMap["streamer|streamer|cover"] = func(ctx *gin.Context, task *dbstruct.VideoModerationTask, option int) func() error {
|
||||
return func() error {
|
||||
mid := task.AssociativeTableId
|
||||
auditcomp, finalMedia := getVideoUpdateInfo(task, option)
|
||||
auditcomp, reviewcomp, finalMedia := getVideoUpdateInfo(task, option)
|
||||
return _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{
|
||||
Streamer: &dbstruct.Streamer{
|
||||
Mid: mid,
|
||||
Shorts: finalMedia,
|
||||
ShortsAudit: auditcomp,
|
||||
Mid: mid,
|
||||
Shorts: finalMedia,
|
||||
ShortsAudit: auditcomp,
|
||||
ShortsReview: reviewcomp,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -169,17 +170,17 @@ func tryToFinishVideoModerationTaskOfMoment(ctx *gin.Context, task *dbstruct.Vid
|
|||
return nil
|
||||
}
|
||||
|
||||
func getVideoUpdateInfo(task *dbstruct.VideoModerationTask, option int) (auditcomp *dbstruct.AuditComponent, finalMedia *dbstruct.MediaComponent) {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
|
||||
func getVideoUpdateInfo(task *dbstruct.VideoModerationTask, option int) (auditcomp *dbstruct.AuditComponent, reviewcomp *dbstruct.AuditComponent, finalMedia *dbstruct.MediaComponent) {
|
||||
// 机审成功后切面
|
||||
if option == consts.VideoModerationTaskUpdate_Success {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
auditcomp.AuditStatus = goproto.Int64(consts.VideoModeration_Passed)
|
||||
auditcomp.AuditOpinion = goproto.String("机审通过")
|
||||
}
|
||||
|
||||
// 机审失败后切面,将机审信息写入streamer表
|
||||
if option == consts.VideoModerationTaskUpdate_Rollback {
|
||||
auditcomp = &dbstruct.AuditComponent{}
|
||||
videoModerationOpinion := &strings.Builder{}
|
||||
if task.GetStatus() == consts.VideoModeration_ServiceFailed {
|
||||
videoModerationOpinion.WriteString("机审失败")
|
||||
|
@ -198,15 +199,17 @@ func getVideoUpdateInfo(task *dbstruct.VideoModerationTask, option int) (auditco
|
|||
|
||||
// 人审通过后切面,执行更新
|
||||
if option == consts.VideoModerationTaskUpdate_Pass {
|
||||
auditcomp.ReviewStatus = goproto.Int64(consts.VideoManuallyReview_Passed)
|
||||
auditcomp.ReviewOpinion = task.Remarks
|
||||
reviewcomp = &dbstruct.AuditComponent{}
|
||||
reviewcomp.AuditStatus = goproto.Int64(consts.VideoManuallyReview_Passed)
|
||||
reviewcomp.AuditOpinion = task.Remarks
|
||||
finalMedia = task.AuditedMedia
|
||||
}
|
||||
|
||||
// 人审拒绝后切面
|
||||
if option == consts.VideoModerationTaskUpdate_Reject {
|
||||
auditcomp.ReviewStatus = goproto.Int64(consts.VideoManuallyReview_Rejected)
|
||||
auditcomp.ReviewOpinion = task.Remarks
|
||||
reviewcomp = &dbstruct.AuditComponent{}
|
||||
reviewcomp.AuditStatus = goproto.Int64(consts.VideoManuallyReview_Rejected)
|
||||
reviewcomp.AuditOpinion = task.Remarks
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package dbstruct
|
||||
|
||||
type AuditComponent struct {
|
||||
AuditStatus *int64 `json:"audit_status" bson:"audit_status"` // 审核状态
|
||||
AuditOpinion *string `json:"audit_opinion" bson:"audit_opinion"` // 审核意见
|
||||
ReviewStatus *int64 `json:"review_status" bson:"review_status"` // 人审状态
|
||||
ReviewOpinion *string `json:"review_opinion" bson:"review_opinion"` // 人审意见
|
||||
AuditStatus *int64 `json:"audit_status" bson:"audit_status"` // 审核状态
|
||||
AuditOpinion *string `json:"audit_opinion" bson:"audit_opinion"` // 审核意见
|
||||
}
|
||||
|
||||
func (p *AuditComponent) GetAuditStatus() int64 {
|
||||
|
@ -20,17 +18,3 @@ func (p *AuditComponent) GetAuditOpinion() string {
|
|||
}
|
||||
return *p.AuditOpinion
|
||||
}
|
||||
|
||||
func (p *AuditComponent) GetReviewStatus() int64 {
|
||||
if p == nil || p.ReviewStatus == nil {
|
||||
return 0
|
||||
}
|
||||
return *p.ReviewStatus
|
||||
}
|
||||
|
||||
func (p *AuditComponent) GetReviewOpinion() string {
|
||||
if p == nil || p.ReviewOpinion == nil {
|
||||
return ""
|
||||
}
|
||||
return *p.ReviewOpinion
|
||||
}
|
||||
|
|
|
@ -1,31 +1,36 @@
|
|||
package dbstruct
|
||||
|
||||
type Streamer struct {
|
||||
Id *int64 `json:"id" bson:"_id"` // 主播表id
|
||||
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
|
||||
Gender *int64 `json:"gender" bson:"gender"` // 性别
|
||||
Bio *string `json:"bio" bson:"bio"` // 个性签名
|
||||
Cover *MediaComponent `json:"cover" bson:"cover"` // 封面
|
||||
Shorts *MediaComponent `json:"shorts" bson:"shorts"` // 展示视频
|
||||
Album *MediaComponent `json:"album" bson:"album"` // 相册
|
||||
Age *int64 `json:"age" bson:"age"` // 年龄
|
||||
Height *int64 `json:"height" bson:"height"` // 身高
|
||||
Weight *int64 `json:"weight" bson:"weight"` // 体重
|
||||
Constellation *string `json:"constellation" bson:"constellation"` // 星座
|
||||
City *string `json:"city" bson:"city"` // 所在城市
|
||||
Tag *[]string `json:"tag" bson:"tag"` // 主播标签
|
||||
Fans *int64 `json:"fans" bson:"fans"` // 全网粉丝
|
||||
AutoResponseMessage *string `json:"auto_response_message" bson:"auto_response_message"` // 自动回复消息
|
||||
Inviters *[]int64 `json:"inviters" bson:"inviters"` // 邀请人
|
||||
IsHided *int64 `json:"is_hided" bson:"is_hided"` // 是否隐藏
|
||||
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
|
||||
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
|
||||
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
||||
CoverAudit *AuditComponent `bson:"cover_audit"` // 封面审核
|
||||
ShortsAudit *AuditComponent `bson:"shorts_audit"` // 展示视频审核
|
||||
AlbumAudit *AuditComponent `bson:"album_audit"` // 相册审核
|
||||
BioAudit *AuditComponent `bson:"bio_audit"` // 个性签名审核
|
||||
AutoResponseMessageAudit *AuditComponent `bson:"auto_response_message_audit"` // 自动回复消息审核
|
||||
Id *int64 `json:"id" bson:"_id"` // 主播表id
|
||||
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
|
||||
Gender *int64 `json:"gender" bson:"gender"` // 性别
|
||||
Bio *string `json:"bio" bson:"bio"` // 个性签名
|
||||
Cover *MediaComponent `json:"cover" bson:"cover"` // 封面
|
||||
Shorts *MediaComponent `json:"shorts" bson:"shorts"` // 展示视频
|
||||
Album *MediaComponent `json:"album" bson:"album"` // 相册
|
||||
Age *int64 `json:"age" bson:"age"` // 年龄
|
||||
Height *int64 `json:"height" bson:"height"` // 身高
|
||||
Weight *int64 `json:"weight" bson:"weight"` // 体重
|
||||
Constellation *string `json:"constellation" bson:"constellation"` // 星座
|
||||
City *string `json:"city" bson:"city"` // 所在城市
|
||||
Tag *[]string `json:"tag" bson:"tag"` // 主播标签
|
||||
Fans *int64 `json:"fans" bson:"fans"` // 全网粉丝
|
||||
AutoResponseMessage *string `json:"auto_response_message" bson:"auto_response_message"` // 自动回复消息
|
||||
Inviters *[]int64 `json:"inviters" bson:"inviters"` // 邀请人
|
||||
IsHided *int64 `json:"is_hided" bson:"is_hided"` // 是否隐藏
|
||||
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
|
||||
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
|
||||
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
||||
CoverAudit *AuditComponent `bson:"cover_audit"` // 封面审核
|
||||
ShortsAudit *AuditComponent `bson:"shorts_audit"` // 展示视频审核
|
||||
AlbumAudit *AuditComponent `bson:"album_audit"` // 相册审核
|
||||
BioAudit *AuditComponent `bson:"bio_audit"` // 个性签名审核
|
||||
AutoResponseMessageAudit *AuditComponent `bson:"auto_response_message_audit"` // 自动回复消息审核
|
||||
CoverReview *AuditComponent `bson:"cover_review"` // 封面人审
|
||||
ShortsReview *AuditComponent `bson:"shorts_review"` // 展示视频人审
|
||||
AlbumReview *AuditComponent `bson:"album_review"` // 相册人审
|
||||
BioReview *AuditComponent `bson:"bio_review"` // 个性签名人审
|
||||
AutoResponseMessageReview *AuditComponent `bson:"auto_response_message_review"` // 自动回复消息人审
|
||||
|
||||
WechatLockType *int32 `json:"wechat_lock_type"` // 微信解锁方式
|
||||
WechatContact *string `json:"wechat_contact"` // 微信联系方式
|
||||
|
|
Loading…
Reference in New Issue