diff --git a/app/adminapi/controller/zjzx_finance/ZjzxInvoiceController.php b/app/adminapi/controller/zjzx_finance/ZjzxInvoiceController.php index 06b42fc0a..bf1933eb4 100644 --- a/app/adminapi/controller/zjzx_finance/ZjzxInvoiceController.php +++ b/app/adminapi/controller/zjzx_finance/ZjzxInvoiceController.php @@ -1,96 +1,100 @@ dataLists(new ZjzxInvoiceLists()); - } - - - /** - * @notes 添加造价咨询--开票台账 - * @return \think\response\Json - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function add() - { - $params = (new ZjzxInvoiceValidate())->post()->goCheck('add'); - $result = ZjzxInvoiceLogic::add($params); - if (true === $result) { - return $this->success('添加成功', [], 1, 1); - } - return $this->fail(ZjzxInvoiceLogic::getError()); - } - - - /** - * @notes 编辑造价咨询--开票台账 - * @return \think\response\Json - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function edit() - { - $params = (new ZjzxInvoiceValidate())->post()->goCheck('edit'); - $result = ZjzxInvoiceLogic::edit($params); - if (true === $result) { - return $this->success('编辑成功', [], 1, 1); - } - return $this->fail(ZjzxInvoiceLogic::getError()); - } - - - /** - * @notes 删除造价咨询--开票台账 - * @return \think\response\Json - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function delete() - { - $params = (new ZjzxInvoiceValidate())->post()->goCheck('delete'); - ZjzxInvoiceLogic::delete($params); - return $this->success('删除成功', [], 1, 1); - } - - - /** - * @notes 获取造价咨询--开票台账详情 - * @return \think\response\Json - * @author likeadmin - * @date 2024/03/15 17:05 - */ - public function detail() - { - $params = (new ZjzxInvoiceValidate())->goCheck('detail'); - $result = ZjzxInvoiceLogic::detail($params); - return $this->data($result); - } - public function datas() + namespace app\adminapi\controller\zjzx_finance; + + use app\adminapi\controller\BaseAdminController; + use app\adminapi\lists\zjzx_finance\ZjzxInvoiceLists; + use app\adminapi\logic\zjzx_finance\ZjzxInvoiceLogic; + use app\adminapi\validate\zjzx_finance\ZjzxInvoiceValidate; + + + /** + * 造价咨询--开票台账控制器 + * Class ZjzxInvoiceController + * @package app\adminapi\controller\zjzx_finance + */ + class ZjzxInvoiceController extends BaseAdminController { - return $this->data(ZjzxInvoiceLogic::datas()); - } -} \ No newline at end of file + + + /** + * @notes 获取造价咨询--开票台账列表 + * @return \think\response\Json + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function lists() + { + return $this->dataLists(new ZjzxInvoiceLists()); + } + + + /** + * @notes 添加造价咨询--开票台账 + * @return \think\response\Json + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function add() + { + $params = (new ZjzxInvoiceValidate())->post()->goCheck('add'); + $result = ZjzxInvoiceLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(ZjzxInvoiceLogic::getError()); + } + + + /** + * @notes 编辑造价咨询--开票台账 + * @return \think\response\Json + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function edit() + { + $params = (new ZjzxInvoiceValidate())->post()->goCheck('edit'); + $result = ZjzxInvoiceLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(ZjzxInvoiceLogic::getError()); + } + + + /** + * @notes 删除造价咨询--开票台账 + * @return \think\response\Json + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function delete() + { + $params = (new ZjzxInvoiceValidate())->post()->goCheck('delete'); + $result = ZjzxInvoiceLogic::delete($params); + if (true === $result) { + return $this->success('删除成功', [], 1, 1); + } + return $this->fail(ZjzxInvoiceLogic::getError()); + } + + + /** + * @notes 获取造价咨询--开票台账详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/03/15 17:05 + */ + public function detail() + { + $params = (new ZjzxInvoiceValidate())->goCheck('detail'); + $result = ZjzxInvoiceLogic::detail($params); + return $this->data($result); + } + + public function datas() + { + return $this->data(ZjzxInvoiceLogic::datas()); + } + } \ No newline at end of file diff --git a/app/adminapi/logic/zjzx_finance/ZjzxInvoiceLogic.php b/app/adminapi/logic/zjzx_finance/ZjzxInvoiceLogic.php index 5420fe2f6..d3972b174 100644 --- a/app/adminapi/logic/zjzx_finance/ZjzxInvoiceLogic.php +++ b/app/adminapi/logic/zjzx_finance/ZjzxInvoiceLogic.php @@ -107,6 +107,11 @@ */ 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']); }