by Robin at 20240703

This commit is contained in:
Leufolium 2024-07-03 16:36:31 +08:00
parent 302adfee08
commit 6979bbc09f
9 changed files with 389 additions and 30 deletions

View File

@ -2563,6 +2563,43 @@ func (m *Mongo) GetStreamerAuthApprovalDetailsListByIds(ctx *gin.Context, ids []
return list, err
}
func (m *Mongo) TryToCompleteStreamerAuthApprovalDetailsAudit(ctx *gin.Context, id int64) error {
col := m.getColStreamerAuthApprovalDetails()
set := qmgo.M{
"status": int64(consts.StreamerAuthApprovalDetails_Approving),
"ut": time.Now().Unix(),
}
up := qmgo.M{
"$set": set,
}
filter := qmgo.M{
"_id": id,
"approve_status": consts.StreamerAuthApprovalDetailsApprove_Waiting,
"cover_audit.audit_status": qmgo.M{
"$ne": consts.ImageAudit_Created,
},
"shorts_audit.audit_status": qmgo.M{
"$ne": consts.VideoModeration_Created,
},
"album_audit.audit_status": qmgo.M{
"$ne": consts.ImageAudit_Created,
},
"bio_audit.audit_status": qmgo.M{
"$ne": consts.TextAudit_Created,
},
"auto_response_message_audit.audit_status": qmgo.M{
"$ne": consts.TextAudit_Created,
},
"del_flag": 0,
}
err := col.UpdateOne(ctx, filter, up)
if err == qmgo.ErrNoSuchDocuments {
err = nil
return err
}
return err
}
func (m *Mongo) UpdateStreamerAuthApprovalDetailsByIdsAndApproveStatus(ctx *gin.Context, streamerauthapprovaldetails *dbstruct.StreamerAuthApprovalDetails, ids []int64, approveStatus int64) error {
col := m.getColStreamerAuthApprovalDetails()
set := util.EntityToM(streamerauthapprovaldetails)

View File

@ -6,6 +6,7 @@ import (
accountproto "service/api/proto/account/proto"
momentproto "service/api/proto/moment/proto"
streamerproto "service/api/proto/streamer/proto"
streamerauthapprovaldetailsproto "service/api/proto/streamerauthapprovaldetails/proto"
zonemomentproto "service/api/proto/zonemoment/proto"
"service/bizcommon/util"
"service/dbstruct"
@ -40,6 +41,8 @@ func (handler *ImageAuditTaskResultHandler) initImageAuditTaskUpdateFuncGenerato
handler.generateStreamerAlbumUpdateFunc()
handler.generateMomentMediaComponentUpdateFunc()
handler.generateZoneMomentMediaComponentUpdateFunc()
handler.generateStreamerAuthApprovalDetailsCoverUpdateFunc()
handler.generateStreamerAuthApprovalDetailsAlbumUpdateFunc()
}
func (handler *ImageAuditTaskResultHandler) getImageAuditTaskUpdateFunc(ctx *gin.Context, task *dbstruct.ImageAuditTask, option int) func() error {
@ -199,6 +202,112 @@ func (handler *ImageAuditTaskResultHandler) generateZoneMomentMediaComponentUpda
}
}
// 主播审核完善表->封面
func (handler *ImageAuditTaskResultHandler) generateStreamerAuthApprovalDetailsCoverUpdateFunc() {
handler.imageAuditTaskUpdateFuncGeneratorMap["streamer_auth_approval_details|streamer_auth_approval_details|cover"] = func(ctx *gin.Context, task *dbstruct.ImageAuditTask, option int) func() error {
return func() error {
// 成功后切面
if option == consts.ImageAuditTaskUpdate_Success {
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
CoverAudit: &dbstruct.AuditComponent{
AuditStatus: goproto.Int64(consts.ImageAudit_Passed),
AuditOpinion: goproto.String("机审通过"),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
// 非成功后切面
imageAuditOpinion := &strings.Builder{}
if task.GetStatus() == consts.ImageAudit_ServiceFailed {
imageAuditOpinion.WriteString("机审失败")
} else {
// 写入具体原因
for i, pass := range task.AuditedMediaResults {
if !pass {
imageaudit := task.ImageAudits[i]
imageAuditOpinion.WriteString(fmt.Sprintf("图片%d%s ", i+1, strings.Join(imageaudit.NotPassScenes, ",")))
}
}
}
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
CoverAudit: &dbstruct.AuditComponent{
AuditStatus: task.Status,
AuditOpinion: goproto.String(imageAuditOpinion.String()),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
}
}
// 主播审核完善表->相册
func (handler *ImageAuditTaskResultHandler) generateStreamerAuthApprovalDetailsAlbumUpdateFunc() {
handler.imageAuditTaskUpdateFuncGeneratorMap["streamer_auth_approval_details|streamer_auth_approval_details|album"] = func(ctx *gin.Context, task *dbstruct.ImageAuditTask, option int) func() error {
return func() error {
// 成功后切面
if option == consts.ImageAuditTaskUpdate_Success {
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
AlbumAudit: &dbstruct.AuditComponent{
AuditStatus: goproto.Int64(consts.ImageAudit_Passed),
AuditOpinion: goproto.String("机审通过"),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
// 非成功后切面
imageAuditOpinion := &strings.Builder{}
if task.GetStatus() == consts.ImageAudit_ServiceFailed {
imageAuditOpinion.WriteString("机审失败")
} else {
// 写入具体原因
for i, pass := range task.AuditedMediaResults {
if !pass {
imageaudit := task.ImageAudits[i]
imageAuditOpinion.WriteString(fmt.Sprintf("图片%d%s ", i+1, strings.Join(imageaudit.NotPassScenes, ",")))
}
}
}
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
AlbumAudit: &dbstruct.AuditComponent{
AuditStatus: task.Status,
AuditOpinion: goproto.String(imageAuditOpinion.String()),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
}
}
// 通过动态表图像
func passMomentImageAuditTask(ctx *gin.Context, task *dbstruct.ImageAuditTask) (err error) {
if err := _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{

View File

@ -154,3 +154,12 @@ func (p *StreamerAuthApprovalDetails) GetStreamerAuthApprovalDetailsListByIds(ct
}
return list, nil
}
func (p *StreamerAuthApprovalDetails) TryToCompleteAudit(ctx *gin.Context, id int64) error {
err := p.store.TryToCompleteStreamerAuthApprovalDetailsAudit(ctx, id)
if err != nil {
logger.Error("TryToCompleteStreamerAuthApprovalDetailsAudit fail, err: %v", err)
return err
}
return nil
}

View File

@ -6,6 +6,7 @@ import (
accountproto "service/api/proto/account/proto"
momentproto "service/api/proto/moment/proto"
streamerproto "service/api/proto/streamer/proto"
streamerauthapprovaldetailsproto "service/api/proto/streamerauthapprovaldetails/proto"
zonemomentproto "service/api/proto/zonemoment/proto"
"service/bizcommon/util"
"service/dbstruct"
@ -41,6 +42,8 @@ func (handler *TextAuditTaskResultHandler) initTextAuditTaskUpdateFuncGeneratorM
handler.generateStreamerAutoResponseMessageUpdateFunc()
handler.generateMomentTextUpdateFunc()
handler.generateZoneMomentTextUpdateFunc()
handler.generateStreamerAuthApprovalDetailsBioUpdateFunc()
handler.generateStreamerAuthApprovalDetailsAutoResponseMessageUpdateFunc()
}
func (handler *TextAuditTaskResultHandler) getTextAuditTaskUpdateFunc(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
@ -229,3 +232,97 @@ func (handler *TextAuditTaskResultHandler) generateZoneMomentTextUpdateFunc() {
}
}
}
// 主播表->个性签名
func (handler *TextAuditTaskResultHandler) generateStreamerAuthApprovalDetailsBioUpdateFunc() {
handler.textAuditTaskUpdateFuncGeneratorMap["streamer_auth_approval_details|streamer_auth_approval_details|bio"] = func(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
return func() error {
// 成功后切面
if option == consts.TextAuditTaskUpdate_Success {
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
BioAudit: &dbstruct.AuditComponent{
AuditStatus: goproto.Int64(consts.TextAudit_Passed),
AuditOpinion: goproto.String("机审通过"),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
// 非成功后切面
var textAuditOpinion string
if task.GetStatus() == consts.TextAudit_ServiceFailed {
textAuditOpinion = "机审失败"
} else {
textAuditOpinion = fmt.Sprintf("%s", strings.Join(task.TextAudit.NotPassScenes, ","))
}
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
BioAudit: &dbstruct.AuditComponent{
AuditStatus: task.Status,
AuditOpinion: goproto.String(textAuditOpinion),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
}
}
// 主播表->个性签名
func (handler *TextAuditTaskResultHandler) generateStreamerAuthApprovalDetailsAutoResponseMessageUpdateFunc() {
handler.textAuditTaskUpdateFuncGeneratorMap["streamer_auth_approval_details|streamer_auth_approval_details|auto_response_message"] = func(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
return func() error {
// 成功后切面
if option == consts.TextAuditTaskUpdate_Success {
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
AutoResponseMessageAudit: &dbstruct.AuditComponent{
AuditStatus: goproto.Int64(consts.TextAudit_Passed),
AuditOpinion: goproto.String("机审通过"),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
// 非成功后切面
var textAuditOpinion string
if task.GetStatus() == consts.TextAudit_ServiceFailed {
textAuditOpinion = "机审失败"
} else {
textAuditOpinion = fmt.Sprintf("%s", strings.Join(task.TextAudit.NotPassScenes, ","))
}
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
AutoResponseMessageAudit: &dbstruct.AuditComponent{
AuditStatus: task.Status,
AuditOpinion: goproto.String(textAuditOpinion),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
}
}

View File

@ -3,6 +3,7 @@ package service
import (
"fmt"
"service/api/consts"
streamerauthapprovaldetailsproto "service/api/proto/streamerauthapprovaldetails/proto"
zonemomentproto "service/api/proto/zonemoment/proto"
"service/bizcommon/util"
"service/dbstruct"
@ -33,6 +34,7 @@ func (handler *VideoModerationTaskResultHandler) initVideoModerationTaskUpdateFu
handler.videoModerationTaskUpdateFuncGeneratorMap = make(map[string]func(ctx *gin.Context, task *dbstruct.VideoModerationTask, option int) func() error)
handler.generateZoneMomentMediaComponentUpdateFunc()
handler.generateStreamerAuthApprovalDetailsShortsUpdateFunc()
}
func (handler *VideoModerationTaskResultHandler) getVideoModerationTaskUpdateFunc(ctx *gin.Context, task *dbstruct.VideoModerationTask, option int) func() error {
@ -92,3 +94,55 @@ func (handler *VideoModerationTaskResultHandler) generateZoneMomentMediaComponen
}
}
}
// 主播审核完善表->展示视频
func (handler *VideoModerationTaskResultHandler) generateStreamerAuthApprovalDetailsShortsUpdateFunc() {
handler.videoModerationTaskUpdateFuncGeneratorMap["streamer_auth_approval_details|streamer_auth_approval_details|shorts"] = func(ctx *gin.Context, task *dbstruct.VideoModerationTask, option int) func() error {
return func() error {
// 成功后切面
if option == consts.VideoModerationTaskUpdate_Success {
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
ShortsAudit: &dbstruct.AuditComponent{
AuditStatus: goproto.Int64(consts.ImageAudit_Passed),
AuditOpinion: goproto.String("机审通过"),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
// 非成功后切面
videoModerationOpinion := &strings.Builder{}
if task.GetStatus() == consts.VideoModeration_ServiceFailed {
videoModerationOpinion.WriteString("机审失败")
} else {
// 写入具体原因
for i, pass := range task.AuditedMediaResults {
if !pass {
videoModerationOpinion.WriteString(fmt.Sprintf("视频%d%s ", i+1, task.Description[i]))
}
}
}
err := _DefaultStreamerAuthApprovalDetails.OpUpdate(ctx, &streamerauthapprovaldetailsproto.OpUpdateReq{
StreamerAuthApprovalDetails: &dbstruct.StreamerAuthApprovalDetails{
Id: task.AssociativeTableId,
ShortsAudit: &dbstruct.AuditComponent{
AuditStatus: task.Status,
AuditOpinion: goproto.String(videoModerationOpinion.String()),
},
},
})
if err != nil {
return err
}
return _DefaultStreamerAuthApprovalDetails.TryToCompleteAudit(ctx, task.GetAssociativeTableId())
}
}
}

View File

@ -0,0 +1,20 @@
package dbstruct
type AuditComponent struct {
AuditStatus *int64 `json:"audit_status" bson:"audit_status"` // 审核状态
AuditOpinion *string `json:"audit_opinion" bson:"audit_opinion"` // 审核意见
}
func (p *AuditComponent) GetAuditStatus() int64 {
if p == nil || p.AuditStatus == nil {
return 0
}
return *p.AuditStatus
}
func (p *AuditComponent) GetAuditOpinion() string {
if p == nil || p.AuditOpinion == nil {
return ""
}
return *p.AuditOpinion
}

View File

@ -29,6 +29,20 @@ type ImageAuditTask struct {
ImageAudits []*ImageAudit // 每个任务的结果
}
func (p *ImageAuditTask) GetStatus() int64 {
if p == nil || p.Status == nil {
return 0
}
return *p.Status
}
func (p *ImageAuditTask) GetAssociativeTableId() int64 {
if p == nil || p.AssociativeTableId == nil {
return 0
}
return *p.AssociativeTableId
}
func (p *ImageAuditTask) IsEmpty() bool {
if p == nil {
return true

View File

@ -35,13 +35,13 @@ type StreamerAuthApproval struct {
type StreamerAuthApprovalBasic struct {
Id *int64 `json:"id" bson:"_id"` // 女神认证审批入站表id
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
Avatar *MediaComponent `json:"avatar"` // 头像
Name *string `json:"name"` // 昵称
Gender *int64 `json:"gender"` // 性别
ContactWay *string `json:"contact_way"` // 联系方式
AccountShot *MediaComponent `json:"account_shot"` // 账号截图
Fans *int64 `json:"fans"` // 全网粉丝
MainPlatform *string `json:"main_platform"` // 主营平台
Avatar *MediaComponent `json:"avatar" bson:"avatar"` // 头像
Name *string `json:"name" bson:"name"` // 昵称
Gender *int64 `json:"gender" bson:"gender"` // 性别
ContactWay *string `json:"contact_way" bson:"contact_way"` // 联系方式
AccountShot *MediaComponent `json:"account_shot" bson:"account_shot"` // 账号截图
Fans *int64 `json:"fans" bson:"fans"` // 全网粉丝
MainPlatform *string `json:"main_platform" bson:"main_platform"` // 主营平台
ApproveStatus *int64 `json:"approve_status" bson:"approve_status"` // 审批状态
Remarks *string `json:"remarks" bson:"remarks"` // 备注
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
@ -64,29 +64,34 @@ func (p *StreamerAuthApprovalBasic) GetMid() int64 {
}
type StreamerAuthApprovalDetails struct {
Id *int64 `json:"id" bson:"_id"` // 女神认证审批完善表id
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
Bio *string `json:"bio"` // 个性签名
Cover *MediaComponent `json:"cover"` // 封面
Shorts *MediaComponent `json:"shorts"` // 展示视频
Album *MediaComponent `json:"album"` // 相册
Age *int64 `json:"age"` // 年龄
Height *int64 `json:"height"` // 身高
Weight *int64 `json:"weight"` // 体重
Constellation *string `json:"constellation"` // 星座
City *string `json:"city"` // 所在城市
Tag *[]string `json:"tag"` // 主播标签
Inviters *[]int64 `json:"inviters"` // 邀请人
AutoResponseMessage *string `json:"auto_response_message"` // 自动回复消息
WechatLockType *int64 `json:"wechat_lock_type"` // 微信解锁方式
WechatContact *string `json:"wechat_contact"` // 微信联系方式
WechatCoinPrice *int64 `json:"wechat_coin_price"` // 微信金币价格
Status *int64 `json:"status" bson:"status"` // 状态
ApproveStatus *int64 `json:"approve_status" bson:"approve_status"` // 审批状态
Remarks *string `json:"remarks" bson:"remarks"` // 备注
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
Id *int64 `json:"id" bson:"_id"` // 女神认证审批完善表id
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
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"` // 主播标签
Inviters *[]int64 `json:"inviters" bson:"inviters"` // 邀请人
AutoResponseMessage *string `json:"auto_response_message" bson:"auto_response_message"` // 自动回复消息
WechatLockType *int64 `json:"wechat_lock_type" bson:"wechat_lock_type"` // 微信解锁方式
WechatContact *string `json:"wechat_contact" bson:"wechat_contact"` // 微信联系方式
WechatCoinPrice *int64 `json:"wechat_coin_price" bson:"wechat_coin_price"` // 微信金币价格
Status *int64 `json:"status" bson:"status"` // 状态
ApproveStatus *int64 `json:"approve_status" bson:"approve_status"` // 审批状态
Remarks *string `json:"remarks" bson:"remarks"` // 备注
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
CoverAudit *AuditComponent `json:"cover_audit" bson:"cover_audit"` // 封面审核
ShortsAudit *AuditComponent `json:"shorts_audit" bson:"shorts_audit"` // 展示视频审核
AlbumAudit *AuditComponent `json:"album_audit" bson:"album_audit"` // 相册审核
BioAudit *AuditComponent `json:"bio_audit" bson:"bio_audit"` // 个性签名审核
AutoResponseMessageAudit *AuditComponent `json:"auto_response_message_audit" bson:"auto_response_message_audit"` // 自动回复消息审核
}
func (p *StreamerAuthApprovalDetails) GetId() int64 {

View File

@ -25,6 +25,20 @@ type TextAuditTask struct {
TextAudit *TextAudit // 任务的结果
}
func (p *TextAuditTask) GetStatus() int64 {
if p == nil || p.Status == nil {
return 0
}
return *p.Status
}
func (p *TextAuditTask) GetAssociativeTableId() int64 {
if p == nil || p.AssociativeTableId == nil {
return 0
}
return *p.AssociativeTableId
}
func (p *TextAuditTask) IsEmpty() bool {
if p == nil {
return true