Merge pull request '1' (#667) from feat-IRONFANS-176-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/667
This commit is contained in:
chenhao 2024-07-31 16:50:59 +08:00
commit e132aeb8bf
2 changed files with 26 additions and 5 deletions

View File

@ -2629,7 +2629,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{}
@ -2661,7 +2661,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 {
@ -2695,7 +2710,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,
})
}