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,96 +1,100 @@
<?php
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
{
/**
* @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');
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());
}
}
/**
* @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());
}
}

View File

@ -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']);
}