This commit is contained in:
weiz 2024-04-16 14:22:59 +08:00
parent 5e24f88d76
commit 6c82588e34
2 changed files with 102 additions and 93 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
namespace app\adminapi\controller\zjzx_finance; namespace app\adminapi\controller\zjzx_finance;
use app\adminapi\controller\BaseAdminController; use app\adminapi\controller\BaseAdminController;
@ -71,9 +72,12 @@ class ZjzxInvoiceController extends BaseAdminController
public function delete() public function delete()
{ {
$params = (new ZjzxInvoiceValidate())->post()->goCheck('delete'); $params = (new ZjzxInvoiceValidate())->post()->goCheck('delete');
ZjzxInvoiceLogic::delete($params); $result = ZjzxInvoiceLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1); return $this->success('删除成功', [], 1, 1);
} }
return $this->fail(ZjzxInvoiceLogic::getError());
}
/** /**

View File

@ -107,6 +107,11 @@
*/ */
public static function delete(array $params): bool public static function delete(array $params): bool
{ {
$data = ZjzxRefund::where('invoice_id', 'in', $params['id'])->findOrEmpty();
if (!$data->isEmpty()) {
self::setError('此数据关联了到账台账信息');
return false;
}
return ZjzxInvoice::destroy($params['id']); return ZjzxInvoice::destroy($params['id']);
} }