Merge pull request 'mainconf' (#678) from mainconf into main
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/678
This commit is contained in:
commit
47d266a635
|
@ -63,6 +63,8 @@ const (
|
|||
ClassScore2ClassResultMapKey = "class_score_2_class_result_map"
|
||||
IQResultMapKey = "IQ_result_map"
|
||||
ClassResultMapKey = "class_result_map"
|
||||
DefaultZoneTextKey = "default_zone_text"
|
||||
AuditTaskCollectionReflectKey = "audit_task_collection_reflect"
|
||||
)
|
||||
|
||||
// del_flag
|
||||
|
|
|
@ -51,7 +51,7 @@ type OpUpdateResp struct {
|
|||
type OpListReq struct {
|
||||
base.BaseRequest
|
||||
RouteUrl *string `json:"route_url"`
|
||||
AssociativeDatabase *string `json:"associative_data_base"`
|
||||
AssociativeDatabase *string `json:"associative_database"`
|
||||
AssociativeTableName *string `json:"associative_table_name"`
|
||||
AssociativeTableId *int64 `json:"associative_table_id"`
|
||||
AssociativeTableColumn *string `json:"associative_table_column"`
|
||||
|
|
|
@ -51,7 +51,7 @@ type OpUpdateResp struct {
|
|||
type OpListReq struct {
|
||||
base.BaseRequest
|
||||
RouteUrl *string `json:"route_url"`
|
||||
AssociativeDatabase *string `json:"associative_data_base"`
|
||||
AssociativeDatabase *string `json:"associative_database"`
|
||||
AssociativeTableName *string `json:"associative_table_name"`
|
||||
AssociativeTableId *int64 `json:"associative_table_id"`
|
||||
AssociativeTableColumn *string `json:"associative_table_column"`
|
||||
|
|
|
@ -51,7 +51,7 @@ type OpUpdateResp struct {
|
|||
type OpListReq struct {
|
||||
base.BaseRequest
|
||||
RouteUrl *string `json:"route_url"`
|
||||
AssociativeDatabase *string `json:"associative_data_base"`
|
||||
AssociativeDatabase *string `json:"associative_database"`
|
||||
AssociativeTableName *string `json:"associative_table_name"`
|
||||
AssociativeTableId *int64 `json:"associative_table_id"`
|
||||
AssociativeTableColumn *string `json:"associative_table_column"`
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package apollostruct
|
||||
|
||||
// 账户初始化数据
|
||||
type AuditTaskCollectionReflectCfg struct {
|
||||
Map map[string][]*CollectionInfo `json:"map"`
|
||||
}
|
||||
|
||||
type CollectionInfo struct {
|
||||
Database string `json:"database"` // 数据库
|
||||
TableName string `json:"table_name"` // 表名
|
||||
}
|
|
@ -3520,6 +3520,38 @@ func (m *Mongo) GetImageAuditTaskList(ctx *gin.Context, req *imageaudittaskproto
|
|||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetImageAuditTaskListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.ImageAuditTask, error) {
|
||||
list := make([]*dbstruct.ImageAuditTask, 0)
|
||||
|
||||
if len(databases) != len(tableNames) {
|
||||
return list, fmt.Errorf("length of databases is not equal to length of tableNames")
|
||||
}
|
||||
|
||||
col := m.getColImageAuditTask()
|
||||
query := qmgo.M{
|
||||
"is_aligned": qmgo.M{
|
||||
"$ne": consts.ImageAuditIsAligned_Yes,
|
||||
},
|
||||
"status": status,
|
||||
"del_flag": 0,
|
||||
}
|
||||
|
||||
orClause := make([]qmgo.M, 0)
|
||||
for i := range databases {
|
||||
orClause = append(orClause, qmgo.M{
|
||||
"associative_database": databases[i],
|
||||
"associative_table_name": tableNames[i],
|
||||
})
|
||||
}
|
||||
query["$or"] = orClause
|
||||
err := col.Find(ctx, query).Sort("-ct").Skip(int64(offset)).Limit(int64(limit)).All(&list)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return list, err
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetImageAuditTaskListByIds(ctx *gin.Context, ids []string) ([]*dbstruct.ImageAuditTask, error) {
|
||||
list := make([]*dbstruct.ImageAuditTask, 0)
|
||||
col := m.getColImageAuditTask()
|
||||
|
@ -3756,6 +3788,38 @@ func (m *Mongo) GetTextAuditTaskList(ctx *gin.Context, req *textaudittaskproto.O
|
|||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetTextAuditTaskListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.TextAuditTask, error) {
|
||||
list := make([]*dbstruct.TextAuditTask, 0)
|
||||
|
||||
if len(databases) != len(tableNames) {
|
||||
return list, fmt.Errorf("length of databases is not equal to length of tableNames")
|
||||
}
|
||||
|
||||
col := m.getColTextAuditTask()
|
||||
query := qmgo.M{
|
||||
"is_aligned": qmgo.M{
|
||||
"$ne": consts.TextAuditIsAligned_Yes,
|
||||
},
|
||||
"status": status,
|
||||
"del_flag": 0,
|
||||
}
|
||||
|
||||
orClause := make([]qmgo.M, 0)
|
||||
for i := range databases {
|
||||
orClause = append(orClause, qmgo.M{
|
||||
"associative_database": databases[i],
|
||||
"associative_table_name": tableNames[i],
|
||||
})
|
||||
}
|
||||
query["$or"] = orClause
|
||||
err := col.Find(ctx, query).Sort("-ct").Skip(int64(offset)).Limit(int64(limit)).All(&list)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return list, err
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetTextAuditTaskListByIds(ctx *gin.Context, ids []string) ([]*dbstruct.TextAuditTask, error) {
|
||||
list := make([]*dbstruct.TextAuditTask, 0)
|
||||
col := m.getColTextAuditTask()
|
||||
|
@ -5655,6 +5719,38 @@ func (m *Mongo) GetVideoModerationTaskList(ctx *gin.Context, req *video_moderati
|
|||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetVideoModerationTaskListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.VideoModerationTask, error) {
|
||||
list := make([]*dbstruct.VideoModerationTask, 0)
|
||||
|
||||
if len(databases) != len(tableNames) {
|
||||
return list, fmt.Errorf("length of databases is not equal to length of tableNames")
|
||||
}
|
||||
|
||||
col := m.getColVideoModerationTask()
|
||||
query := qmgo.M{
|
||||
"is_aligned": qmgo.M{
|
||||
"$ne": consts.VideoModerationIsAligned_Yes,
|
||||
},
|
||||
"status": status,
|
||||
"del_flag": 0,
|
||||
}
|
||||
|
||||
orClause := make([]qmgo.M, 0)
|
||||
for i := range databases {
|
||||
orClause = append(orClause, qmgo.M{
|
||||
"associative_database": databases[i],
|
||||
"associative_table_name": tableNames[i],
|
||||
})
|
||||
}
|
||||
query["$or"] = orClause
|
||||
err := col.Find(ctx, query).Sort("-ct").Skip(int64(offset)).Limit(int64(limit)).All(&list)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return list, err
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetVideoModerationTaskListByIds(ctx *gin.Context, ids []string) ([]*dbstruct.VideoModerationTask, error) {
|
||||
list := make([]*dbstruct.VideoModerationTask, 0)
|
||||
col := m.getColVideoModerationTask()
|
||||
|
|
|
@ -2575,11 +2575,23 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (
|
|||
return
|
||||
}
|
||||
|
||||
//读取默认动态文字配置
|
||||
defaultZoneText, err := apollo.GetStringValue(consts.DefaultZoneTextKey, apollo.ApolloOpts().SetNamespace("application"))
|
||||
if err != nil {
|
||||
logger.Error("Apollo read failed : %v", err)
|
||||
ec = errcode.ErrCodeApolloReadFail
|
||||
return
|
||||
}
|
||||
|
||||
// 暂存空间简介
|
||||
profile := req.Zone.GetProfile()
|
||||
|
||||
req.Zone.Mid = goproto.Int64(req.GetBaseRequest().Mid)
|
||||
req.Zone.ZoneMomentCount = goproto.Int64(0)
|
||||
req.Zone.ImageCount = goproto.Int64(0)
|
||||
req.Zone.VideoCount = goproto.Int64(0)
|
||||
req.Zone.IsZoneThirdPartnerHided = goproto.Int64(consts.IsHided_No)
|
||||
req.Zone.Profile = goproto.String(defaultZoneText)
|
||||
err, zid := _DefaultZone.OpCreate(ctx, &zoneproto.OpCreateReq{
|
||||
Zone: req.Zone,
|
||||
})
|
||||
|
@ -2609,6 +2621,10 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (
|
|||
return
|
||||
}
|
||||
|
||||
// 创建文字审核任务
|
||||
req.Zone.Profile = goproto.String(profile)
|
||||
s.CreateZoneTextAudit(ctx, nil, req.Zone)
|
||||
|
||||
// 创建默认动态
|
||||
cfg := apollostruct.ReferentialZoneMoment{}
|
||||
err = apollo.GetJson(consts.ReferentialZoneMomentKey, &cfg, apollo.ApolloOpts().SetNamespace("zone"))
|
||||
|
@ -2639,7 +2655,22 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (
|
|||
|
||||
func (s *Service) ApiUpdateZone(ctx *gin.Context, req *zoneproto.ApiUpdateReq) (ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeZoneSrvOk
|
||||
err := _DefaultZone.OpUpdate(ctx, &zoneproto.OpUpdateReq{
|
||||
|
||||
oldZone, err := _DefaultZone.GetById(ctx, req.Zone.GetId())
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
ec = errcode.ErrCodeZoneNotExist
|
||||
err = nil
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeZoneSrvFail
|
||||
return
|
||||
}
|
||||
|
||||
profile := req.Zone.GetProfile()
|
||||
req.Zone.Profile = nil
|
||||
err = _DefaultZone.OpUpdate(ctx, &zoneproto.OpUpdateReq{
|
||||
Zone: req.Zone,
|
||||
})
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
|
@ -2673,6 +2704,9 @@ func (s *Service) ApiUpdateZone(ctx *gin.Context, req *zoneproto.ApiUpdateReq) (
|
|||
return
|
||||
}
|
||||
|
||||
req.Zone.Profile = goproto.String(profile)
|
||||
s.CreateZoneTextAudit(ctx, oldZone, req.Zone)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer *
|
|||
|
||||
if newStreamer.Cover != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Cover.GetImageIds(), newStreamer.Cover.GetImageIds()) {
|
||||
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
||||
Mid: newStreamer.Mid,
|
||||
Mid: oldStreamer.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer"),
|
||||
AssociativeTableName: goproto.String("streamer"),
|
||||
|
@ -57,7 +57,7 @@ func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer *
|
|||
|
||||
if newStreamer.Album != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Album.GetImageIds(), newStreamer.Album.GetImageIds()) {
|
||||
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
||||
Mid: newStreamer.Mid,
|
||||
Mid: oldStreamer.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer"),
|
||||
AssociativeTableName: goproto.String("streamer"),
|
||||
|
@ -119,6 +119,7 @@ func (s *Service) CreateStreamerAuthApprovalDetailsImageAudit(ctx *gin.Context,
|
|||
|
||||
if newStreamerAuthApprovalDetails.Cover != nil && len(newStreamerAuthApprovalDetails.Cover.GetImageIds()) > 0 {
|
||||
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
||||
Mid: newStreamerAuthApprovalDetails.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer_auth_approval_details"),
|
||||
AssociativeTableName: goproto.String("streamer_auth_approval_details"),
|
||||
|
@ -132,6 +133,7 @@ func (s *Service) CreateStreamerAuthApprovalDetailsImageAudit(ctx *gin.Context,
|
|||
|
||||
if newStreamerAuthApprovalDetails.Album != nil && len(newStreamerAuthApprovalDetails.Album.GetImageIds()) > 0 {
|
||||
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
||||
Mid: newStreamerAuthApprovalDetails.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer_auth_approval_details"),
|
||||
AssociativeTableName: goproto.String("streamer_auth_approval_details"),
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"service/api/consts"
|
||||
imageaudittaskproto "service/api/proto/imageaudittask/proto"
|
||||
textaudittaskproto "service/api/proto/textaudittask/proto"
|
||||
videomoderationtaskproto "service/api/proto/video_moderation_task/proto"
|
||||
"service/apollostruct"
|
||||
"service/bizcommon/util"
|
||||
"service/dbstruct"
|
||||
"service/library/apollo"
|
||||
"service/library/logger"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ImageAuditTaskDecorator struct {
|
||||
ImageAuditTask *ImageAuditTask
|
||||
}
|
||||
|
||||
func (p *ImageAuditTaskDecorator) OpList(ctx *gin.Context, req *imageaudittaskproto.OpListReq) ([]*dbstruct.ImageAuditTask, error) {
|
||||
|
||||
// 获取映射表
|
||||
cfg := apollostruct.AuditTaskCollectionReflectCfg{}
|
||||
err := apollo.GetJson(consts.AuditTaskCollectionReflectKey, &cfg, apollo.ApolloOpts().SetNamespace("application"))
|
||||
if err != nil {
|
||||
logger.Error("Apollo read failed : %v", err)
|
||||
return make([]*dbstruct.ImageAuditTask, 0), err
|
||||
}
|
||||
|
||||
// 将查询的集合信息进行映射,决定查询方式
|
||||
key := fmt.Sprintf("%v|%v", util.DerefString(req.AssociativeDatabase), util.DerefString(req.AssociativeTableName))
|
||||
collectionInfos, ok := cfg.Map[key]
|
||||
|
||||
var queryFunc func(ctx *gin.Context, req *imageaudittaskproto.OpListReq) ([]*dbstruct.ImageAuditTask, error)
|
||||
if !ok || len(collectionInfos) == 0 {
|
||||
queryFunc = func(ctx *gin.Context, req *imageaudittaskproto.OpListReq) ([]*dbstruct.ImageAuditTask, error) {
|
||||
// 仅查询未对齐的任务
|
||||
req.NotAlignedOpt = 1
|
||||
return p.ImageAuditTask.OpList(ctx, req)
|
||||
}
|
||||
} else {
|
||||
queryFunc = func(ctx *gin.Context, req *imageaudittaskproto.OpListReq) ([]*dbstruct.ImageAuditTask, error) {
|
||||
databases := make([]string, 0)
|
||||
tableNames := make([]string, 0)
|
||||
for _, collectionInfo := range collectionInfos {
|
||||
databases = append(databases, collectionInfo.Database)
|
||||
tableNames = append(tableNames, collectionInfo.TableName)
|
||||
}
|
||||
return p.ImageAuditTask.OpListByCollectionInfos(ctx, databases, tableNames, util.DerefInt64(req.Status), req.Offset, req.Limit)
|
||||
}
|
||||
}
|
||||
return queryFunc(ctx, req)
|
||||
}
|
||||
|
||||
type TextAuditTaskDecorator struct {
|
||||
TextAuditTask *TextAuditTask
|
||||
}
|
||||
|
||||
func (p *TextAuditTaskDecorator) OpList(ctx *gin.Context, req *textaudittaskproto.OpListReq) ([]*dbstruct.TextAuditTask, error) {
|
||||
|
||||
// 获取映射表
|
||||
cfg := apollostruct.AuditTaskCollectionReflectCfg{}
|
||||
err := apollo.GetJson(consts.AuditTaskCollectionReflectKey, &cfg, apollo.ApolloOpts().SetNamespace("application"))
|
||||
if err != nil {
|
||||
logger.Error("Apollo read failed : %v", err)
|
||||
return make([]*dbstruct.TextAuditTask, 0), err
|
||||
}
|
||||
|
||||
// 将查询的集合信息进行映射,决定查询方式
|
||||
key := fmt.Sprintf("%v|%v", util.DerefString(req.AssociativeDatabase), util.DerefString(req.AssociativeTableName))
|
||||
collectionInfos, ok := cfg.Map[key]
|
||||
|
||||
var queryFunc func(ctx *gin.Context, req *textaudittaskproto.OpListReq) ([]*dbstruct.TextAuditTask, error)
|
||||
if !ok || len(collectionInfos) == 0 {
|
||||
queryFunc = func(ctx *gin.Context, req *textaudittaskproto.OpListReq) ([]*dbstruct.TextAuditTask, error) {
|
||||
// 仅查询未对齐的任务
|
||||
req.NotAlignedOpt = 1
|
||||
return p.TextAuditTask.OpList(ctx, req)
|
||||
}
|
||||
} else {
|
||||
queryFunc = func(ctx *gin.Context, req *textaudittaskproto.OpListReq) ([]*dbstruct.TextAuditTask, error) {
|
||||
databases := make([]string, 0)
|
||||
tableNames := make([]string, 0)
|
||||
for _, collectionInfo := range collectionInfos {
|
||||
databases = append(databases, collectionInfo.Database)
|
||||
tableNames = append(tableNames, collectionInfo.TableName)
|
||||
}
|
||||
return p.TextAuditTask.OpListByCollectionInfos(ctx, databases, tableNames, util.DerefInt64(req.Status), req.Offset, req.Limit)
|
||||
}
|
||||
}
|
||||
return queryFunc(ctx, req)
|
||||
}
|
||||
|
||||
type VideoModerationTaskDecorator struct {
|
||||
VideoModerationTask *VideoModerationTask
|
||||
}
|
||||
|
||||
func (p *VideoModerationTaskDecorator) OpList(ctx *gin.Context, req *videomoderationtaskproto.OpListReq) ([]*dbstruct.VideoModerationTask, error) {
|
||||
|
||||
// 获取映射表
|
||||
cfg := apollostruct.AuditTaskCollectionReflectCfg{}
|
||||
err := apollo.GetJson(consts.AuditTaskCollectionReflectKey, &cfg, apollo.ApolloOpts().SetNamespace("application"))
|
||||
if err != nil {
|
||||
logger.Error("Apollo read failed : %v", err)
|
||||
return make([]*dbstruct.VideoModerationTask, 0), err
|
||||
}
|
||||
|
||||
// 将查询的集合信息进行映射,决定查询方式
|
||||
key := fmt.Sprintf("%v|%v", util.DerefString(req.AssociativeDatabase), util.DerefString(req.AssociativeTableName))
|
||||
collectionInfos, ok := cfg.Map[key]
|
||||
|
||||
var queryFunc func(ctx *gin.Context, req *videomoderationtaskproto.OpListReq) ([]*dbstruct.VideoModerationTask, error)
|
||||
if !ok || len(collectionInfos) == 0 {
|
||||
queryFunc = func(ctx *gin.Context, req *videomoderationtaskproto.OpListReq) ([]*dbstruct.VideoModerationTask, error) {
|
||||
// 仅查询未对齐的任务
|
||||
req.NotAlignedOpt = 1
|
||||
return p.VideoModerationTask.OpList(ctx, req)
|
||||
}
|
||||
} else {
|
||||
queryFunc = func(ctx *gin.Context, req *videomoderationtaskproto.OpListReq) ([]*dbstruct.VideoModerationTask, error) {
|
||||
databases := make([]string, 0)
|
||||
tableNames := make([]string, 0)
|
||||
for _, collectionInfo := range collectionInfos {
|
||||
databases = append(databases, collectionInfo.Database)
|
||||
tableNames = append(tableNames, collectionInfo.TableName)
|
||||
}
|
||||
return p.VideoModerationTask.OpListByCollectionInfos(ctx, databases, tableNames, util.DerefInt64(req.Status), req.Offset, req.Limit)
|
||||
}
|
||||
}
|
||||
return queryFunc(ctx, req)
|
||||
}
|
|
@ -65,6 +65,15 @@ func (p *ImageAuditTask) OpList(ctx *gin.Context, req *imageaudittaskproto.OpLis
|
|||
return list, nil
|
||||
}
|
||||
|
||||
func (p *ImageAuditTask) OpListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.ImageAuditTask, error) {
|
||||
list, err := p.store.GetImageAuditTaskListByCollectionInfos(ctx, databases, tableNames, status, offset, limit)
|
||||
if err != nil {
|
||||
logger.Error("GetImageAuditTaskListByCollectionInfos fail, err: %v", err)
|
||||
return make([]*dbstruct.ImageAuditTask, 0), err
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (p *ImageAuditTask) OpUpdateByBatchId(ctx *gin.Context, batchId string, imageaudittask *dbstruct.ImageAuditTask) error {
|
||||
err := p.store.UpdateImageAuditTaskByBatchId(ctx, batchId, imageaudittask)
|
||||
if err != nil {
|
||||
|
|
|
@ -65,6 +65,15 @@ func (p *TextAuditTask) OpList(ctx *gin.Context, req *textaudittaskproto.OpListR
|
|||
return list, nil
|
||||
}
|
||||
|
||||
func (p *TextAuditTask) OpListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.TextAuditTask, error) {
|
||||
list, err := p.store.GetTextAuditTaskListByCollectionInfos(ctx, databases, tableNames, status, offset, limit)
|
||||
if err != nil {
|
||||
logger.Error("GetTextAuditTaskListByCollectionInfos fail, err: %v", err)
|
||||
return make([]*dbstruct.TextAuditTask, 0), err
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (p *TextAuditTask) OpUpdateByBatchId(ctx *gin.Context, batchId string, textaudittask *dbstruct.TextAuditTask) error {
|
||||
err := p.store.UpdateTextAuditTaskByBatchId(ctx, batchId, textaudittask)
|
||||
if err != nil {
|
||||
|
|
|
@ -65,6 +65,15 @@ func (p *VideoModerationTask) OpList(ctx *gin.Context, req *video_moderation_tas
|
|||
return list, nil
|
||||
}
|
||||
|
||||
func (p *VideoModerationTask) OpListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.VideoModerationTask, error) {
|
||||
list, err := p.store.GetVideoModerationTaskListByCollectionInfos(ctx, databases, tableNames, status, offset, limit)
|
||||
if err != nil {
|
||||
logger.Error("GetVideoModerationTaskListByCollectionInfos fail, err: %v", err)
|
||||
return make([]*dbstruct.VideoModerationTask, 0), err
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (p *VideoModerationTask) OpUpdateByBatchId(ctx *gin.Context, batchId string, video_moderation_task *dbstruct.VideoModerationTask) error {
|
||||
err := p.store.UpdateVideoModerationTaskByBatchId(ctx, batchId, video_moderation_task)
|
||||
if err != nil {
|
||||
|
|
|
@ -3181,10 +3181,10 @@ func (s *Service) OpGetImageAuditTaskVOList(ctx *gin.Context, req *imageaudittas
|
|||
return
|
||||
}
|
||||
|
||||
// 仅查询未对齐的任务
|
||||
req.NotAlignedOpt = 1
|
||||
|
||||
list, err := _DefaultImageAuditTask.OpList(ctx, req)
|
||||
imageAuditTaskProxy := &logic.ImageAuditTaskDecorator{
|
||||
ImageAuditTask: _DefaultImageAuditTask,
|
||||
}
|
||||
list, err := imageAuditTaskProxy.OpList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("OpGetImageAuditTaskListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeImageAuditTaskSrvFail
|
||||
|
@ -3273,10 +3273,10 @@ func (s *Service) OpGetTextAuditTaskVOList(ctx *gin.Context, req *textaudittaskp
|
|||
return
|
||||
}
|
||||
|
||||
// 仅查询未对齐的任务
|
||||
req.NotAlignedOpt = 1
|
||||
|
||||
list, err := _DefaultTextAuditTask.OpList(ctx, req)
|
||||
textAuditTaskProxy := &logic.TextAuditTaskDecorator{
|
||||
TextAuditTask: _DefaultTextAuditTask,
|
||||
}
|
||||
list, err := textAuditTaskProxy.OpList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("OpGetTextAuditTaskListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeTextAuditTaskSrvFail
|
||||
|
@ -3362,9 +3362,11 @@ func (s *Service) OpGetVideoModerationTaskVOList(ctx *gin.Context, req *videomod
|
|||
ec = errcode.ErrCodeVideoModerationTaskSrvOk
|
||||
|
||||
// 仅查询未对齐的任务
|
||||
req.NotAlignedOpt = 1
|
||||
videoModerationTaskProxy := &logic.VideoModerationTaskDecorator{
|
||||
VideoModerationTask: _DefaultVideoModerationTask,
|
||||
}
|
||||
|
||||
list, err := _DefaultVideoModerationTask.OpList(ctx, req)
|
||||
list, err := videoModerationTaskProxy.OpList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("OpGetVideoModerationTaskListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeVideoModerationTaskSrvFail
|
||||
|
|
|
@ -44,7 +44,7 @@ func (s *Service) CreateUpdateStreamerTextAudit(ctx *gin.Context, oldStreamer *d
|
|||
if newStreamer.Bio != nil && oldStreamer.GetBio() != newStreamer.GetBio() {
|
||||
|
||||
tasks = append(tasks, &dbstruct.TextAuditTask{
|
||||
Mid: newStreamer.Mid,
|
||||
Mid: oldStreamer.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer"),
|
||||
AssociativeTableName: goproto.String("streamer"),
|
||||
|
@ -58,7 +58,7 @@ func (s *Service) CreateUpdateStreamerTextAudit(ctx *gin.Context, oldStreamer *d
|
|||
if newStreamer.AutoResponseMessage != nil && oldStreamer.GetAutoResponseMessage() != newStreamer.GetAutoResponseMessage() {
|
||||
|
||||
tasks = append(tasks, &dbstruct.TextAuditTask{
|
||||
Mid: newStreamer.Mid,
|
||||
Mid: oldStreamer.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer"),
|
||||
AssociativeTableName: goproto.String("streamer"),
|
||||
|
@ -121,6 +121,7 @@ func (s *Service) CreateStreamerAuthApprovalDetailsTextAudit(ctx *gin.Context, n
|
|||
if newStreamerAuthApprovalDetails.Bio != nil {
|
||||
|
||||
tasks = append(tasks, &dbstruct.TextAuditTask{
|
||||
Mid: newStreamerAuthApprovalDetails.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer_auth_approval_details"),
|
||||
AssociativeTableName: goproto.String("streamer_auth_approval_details"),
|
||||
|
@ -134,6 +135,7 @@ func (s *Service) CreateStreamerAuthApprovalDetailsTextAudit(ctx *gin.Context, n
|
|||
if newStreamerAuthApprovalDetails.AutoResponseMessage != nil {
|
||||
|
||||
tasks = append(tasks, &dbstruct.TextAuditTask{
|
||||
Mid: newStreamerAuthApprovalDetails.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer_auth_approval_details"),
|
||||
AssociativeTableName: goproto.String("streamer_auth_approval_details"),
|
||||
|
@ -149,6 +151,36 @@ func (s *Service) CreateStreamerAuthApprovalDetailsTextAudit(ctx *gin.Context, n
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Service) CreateZoneTextAudit(ctx *gin.Context, oldZone *dbstruct.Zone, newZone *dbstruct.Zone) (tasks []*dbstruct.TextAuditTask) {
|
||||
tasks = make([]*dbstruct.TextAuditTask, 0)
|
||||
|
||||
midp := newZone.Mid
|
||||
|
||||
if newZone.Profile != nil {
|
||||
|
||||
oldTextPtr := goproto.String("")
|
||||
if oldZone != nil {
|
||||
oldTextPtr = oldZone.Profile
|
||||
midp = oldZone.Mid
|
||||
}
|
||||
|
||||
tasks = append(tasks, &dbstruct.TextAuditTask{
|
||||
Mid: midp,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("zone"),
|
||||
AssociativeTableName: goproto.String("zone"),
|
||||
AssociativeTableId: newZone.Id,
|
||||
AssociativeTableColumn: goproto.String("profile"),
|
||||
AuditedText: newZone.Profile,
|
||||
OldText: oldTextPtr,
|
||||
})
|
||||
}
|
||||
|
||||
addTextAuditTasks(ctx, tasks, true)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func addTextAuditTasks(ctx *gin.Context, tasks []*dbstruct.TextAuditTask, options ...any) error {
|
||||
for _, task := range tasks {
|
||||
err := addTextAuditTask(ctx, task, options...)
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
momentproto "service/api/proto/moment/proto"
|
||||
streamerproto "service/api/proto/streamer/proto"
|
||||
streamerauthapprovaldetailsproto "service/api/proto/streamerauthapprovaldetails/proto"
|
||||
zoneproto "service/api/proto/zone/proto"
|
||||
zonemomentproto "service/api/proto/zonemoment/proto"
|
||||
"service/bizcommon/util"
|
||||
"service/dbstruct"
|
||||
|
@ -44,6 +45,7 @@ func (handler *TextAuditTaskResultHandler) initTextAuditTaskUpdateFuncGeneratorM
|
|||
handler.generateZoneMomentTextUpdateFunc()
|
||||
handler.generateStreamerAuthApprovalDetailsBioUpdateFunc()
|
||||
handler.generateStreamerAuthApprovalDetailsAutoResponseMessageUpdateFunc()
|
||||
handler.generateZoneProfileUpdateFunc()
|
||||
}
|
||||
|
||||
func (handler *TextAuditTaskResultHandler) getTextAuditTaskUpdateFunc(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
|
||||
|
@ -223,6 +225,24 @@ func (handler *TextAuditTaskResultHandler) generateZoneMomentTextUpdateFunc() {
|
|||
}
|
||||
}
|
||||
|
||||
// 空间表->简介
|
||||
func (handler *TextAuditTaskResultHandler) generateZoneProfileUpdateFunc() {
|
||||
handler.textAuditTaskUpdateFuncGeneratorMap["zone|zone|profile"] = func(ctx *gin.Context, task *dbstruct.TextAuditTask, option int) func() error {
|
||||
return func() error {
|
||||
id := task.AssociativeTableId
|
||||
auditcomp, reviewcomp, finalText := getTextUpdateInfo(task, option)
|
||||
return _DefaultZone.OpUpdate(ctx, &zoneproto.OpUpdateReq{
|
||||
Zone: &dbstruct.Zone{
|
||||
Id: id,
|
||||
Profile: finalText,
|
||||
ProfileAudit: auditcomp,
|
||||
ProfileReview: reviewcomp,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 尝试完成审核
|
||||
func tryToFinishTextAuditTaskOfMoment(ctx *gin.Context, task *dbstruct.TextAuditTask) error {
|
||||
// 机审通过,尝试触发moment_audit_task的人审
|
||||
|
|
|
@ -17,7 +17,7 @@ func (s *Service) CreateUpdateStreamerVideoModeration(ctx *gin.Context, oldStrea
|
|||
|
||||
if newStreamer.Shorts != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Shorts.GetVideoIds(), newStreamer.Shorts.GetVideoIds()) {
|
||||
tasks = append(tasks, &dbstruct.VideoModerationTask{
|
||||
Mid: newStreamer.Mid,
|
||||
Mid: oldStreamer.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer"),
|
||||
AssociativeTableName: goproto.String("streamer"),
|
||||
|
@ -79,6 +79,7 @@ func (s *Service) CreateStreamerAuthApprovalDetailsVideoModeration(ctx *gin.Cont
|
|||
|
||||
if newStreamerAuthApprovalDetails.Shorts != nil && len(newStreamerAuthApprovalDetails.Shorts.GetVideoIds()) > 0 {
|
||||
tasks = append(tasks, &dbstruct.VideoModerationTask{
|
||||
Mid: newStreamerAuthApprovalDetails.Mid,
|
||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||
AssociativeDatabase: goproto.String("streamer_auth_approval_details"),
|
||||
AssociativeTableName: goproto.String("streamer_auth_approval_details"),
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
package dbstruct
|
||||
|
||||
type Zone struct {
|
||||
Id *int64 `json:"id" bson:"_id"` // 空间表id
|
||||
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
|
||||
Profile *string `json:"profile" bson:"profile"` // 空间简介
|
||||
LastZoneMomentCt *int64 `json:"last_zone_moment_ct" bson:"last_zone_moment_ct"` // 最后空间动态创建时间
|
||||
ZoneMomentCount *int64 `json:"zone_moment_count" bson:"zone_moment_count"` // 空间内动态总数
|
||||
ImageCount *int64 `json:"image_count" bson:"image_count"` // 空间内图片总数
|
||||
VideoCount *int64 `json:"video_count" bson:"video_count"` // 空间内视频总数
|
||||
IsZoneThirdPartnerHided *int64 `json:"is_zone_third_partner_hided" bson:"is_zone_third_partner_hided"` // 是否隐藏空间代运营
|
||||
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
|
||||
Profile *string `json:"profile" bson:"profile"` // 空间简介
|
||||
LastZoneMomentCt *int64 `json:"last_zone_moment_ct" bson:"last_zone_moment_ct"` // 最后空间动态创建时间
|
||||
ZoneMomentCount *int64 `json:"zone_moment_count" bson:"zone_moment_count"` // 空间内动态总数
|
||||
ImageCount *int64 `json:"image_count" bson:"image_count"` // 空间内图片总数
|
||||
VideoCount *int64 `json:"video_count" bson:"video_count"` // 空间内视频总数
|
||||
IsZoneThirdPartnerHided *int64 `json:"is_zone_third_partner_hided" bson:"is_zone_third_partner_hided"` // 是否隐藏空间代运营
|
||||
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
|
||||
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
|
||||
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
||||
ProfileAudit *AuditComponent `json:"profile_audit" bson:"profile_audit"` // 空间简介审核
|
||||
ProfileReview *AuditComponent `json:"profile_review" bson:"profile_review"` // 空间简介人审
|
||||
}
|
||||
|
||||
func (p *Zone) GetId() int64 {
|
||||
|
@ -41,3 +43,10 @@ func (p *Zone) GetIsZoneThirdPartnerHided() int64 {
|
|||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (p *Zone) GetProfile() string {
|
||||
if p != nil && p.Profile != nil {
|
||||
return *p.Profile
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue