[天神模式]删除符合条件的报表完成

This commit is contained in:
2023-07-28 16:46:52 +08:00
parent 8ab89bca34
commit 18d48c7fea
2 changed files with 36 additions and 2 deletions

View File

@@ -85,3 +85,22 @@ func (gm _GMService) DeleteParks(parks []string) error {
tx.Commit(ctx)
return nil
}
func (gm _GMService) DeleteReports(pid string, reports []string) error {
ctx, cancel := global.TimeoutContext()
defer cancel()
tx, err := global.DB.Begin(ctx)
if err != nil {
gm.l.Error("未能启动数据库事务", zap.Error(err))
return fmt.Errorf("未能启动数据库事务,%w", err)
}
err = repository.GMRepository.DeleteReports(ctx, tx, pid, reports)
if err != nil {
tx.Rollback(ctx)
return err
}
tx.Commit(ctx)
return nil
}