This commit is contained in:
Leufolium 2024-07-31 16:50:37 +08:00
parent 70febfc421
commit bbb3f06e3a
2 changed files with 26 additions and 5 deletions

View File

@ -2578,7 +2578,7 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (
// 创建文字审核任务
req.Zone.Profile = goproto.String(profile)
s.CreateZoneTextAudit(ctx, req.Zone)
s.CreateZoneTextAudit(ctx, nil, req.Zone)
// 创建默认动态
cfg := apollostruct.ReferentialZoneMoment{}
@ -2610,7 +2610,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 {
@ -2644,7 +2659,8 @@ func (s *Service) ApiUpdateZone(ctx *gin.Context, req *zoneproto.ApiUpdateReq) (
return
}
s.CreateZoneTextAudit(ctx, req.Zone)
req.Zone.Profile = goproto.String(profile)
s.CreateZoneTextAudit(ctx, oldZone, req.Zone)
return
}

View File

@ -151,11 +151,16 @@ func (s *Service) CreateStreamerAuthApprovalDetailsTextAudit(ctx *gin.Context, n
return
}
func (s *Service) CreateZoneTextAudit(ctx *gin.Context, newZone *dbstruct.Zone) (tasks []*dbstruct.TextAuditTask) {
func (s *Service) CreateZoneTextAudit(ctx *gin.Context, oldZone *dbstruct.Zone, newZone *dbstruct.Zone) (tasks []*dbstruct.TextAuditTask) {
tasks = make([]*dbstruct.TextAuditTask, 0)
if newZone.Profile != nil {
oldTextPtr := goproto.String("")
if oldZone != nil {
oldTextPtr = oldZone.Profile
}
tasks = append(tasks, &dbstruct.TextAuditTask{
Mid: newZone.Mid,
RouteUrl: goproto.String(ctx.Request.URL.Path),
@ -164,7 +169,7 @@ func (s *Service) CreateZoneTextAudit(ctx *gin.Context, newZone *dbstruct.Zone)
AssociativeTableId: newZone.Id,
AssociativeTableColumn: goproto.String("profile"),
AuditedText: newZone.Profile,
OldText: goproto.String(""),
OldText: oldTextPtr,
})
}