|
|
|
@ -153,27 +153,23 @@ class DistillationWordService extends BaseService |
|
|
|
* @param mixed $id |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
public function deleteData(mixed $id): array |
|
|
|
public function deleteData(array $ids): array |
|
|
|
{ |
|
|
|
$data = $this->dao->get(['id' => $id]); |
|
|
|
if (empty($data)) { |
|
|
|
return []; |
|
|
|
} |
|
|
|
// 落库
|
|
|
|
Db::startTrans(); |
|
|
|
try { |
|
|
|
//删主表
|
|
|
|
$this->dao->update($id, ['delete_time' => time()]); |
|
|
|
$this->dao->update([['id', 'in', $ids]], ['delete_time' => time()]); |
|
|
|
//删子表
|
|
|
|
$this->transDao->update(['distillation_id' => $id], ['delete_time' => time()]); |
|
|
|
$this->expandDao->update(['distillation_id' => $id], ['delete_time' => time()]); |
|
|
|
$this->questionsDao->update(['distillation_id' => $id], ['delete_time' => time()]); |
|
|
|
$this->transDao->update([['distillation_id', 'in', $ids]], ['delete_time' => time()]); |
|
|
|
$this->expandDao->update([['distillation_id', 'in', $ids]], ['delete_time' => time()]); |
|
|
|
$this->questionsDao->update([['distillation_id', 'in', $ids]], ['delete_time' => time()]); |
|
|
|
Db::commit(); |
|
|
|
} catch (\Exception $exception) { |
|
|
|
Db::rollback(); |
|
|
|
throw new ApiException($exception->getMessage()); |
|
|
|
} |
|
|
|
return ['id' => $id]; |
|
|
|
return ['id' => $ids]; |
|
|
|
} |
|
|
|
|
|
|
|
public function selectData() |
|
|
|
|