erp/app/admin/controller/supplier/SupplierController.php
2024-04-23 18:03:12 +08:00

95 lines
2.2 KiB
PHP

<?php
namespace app\admin\controller\supplier;
use app\admin\controller\BaseAdminController;
use app\admin\lists\supplier\SupplierLists;
use app\admin\logic\supplier\SupplierLogic;
use app\admin\validate\supplier\SupplierValidate;
/**
* 供应商管理控制器
* Class SupplierController
* @package app\admin\controller\supplier
*/
class SupplierController extends BaseAdminController
{
/**
* @notes 获取供应商管理列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function lists()
{
return $this->dataLists(new SupplierLists());
}
/**
* @notes 添加供应商管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function add()
{
$params = (new SupplierValidate())->post()->goCheck('add');
$result = SupplierLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupplierLogic::getError());
}
/**
* @notes 编辑供应商管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function edit()
{
$params = (new SupplierValidate())->post()->goCheck('edit');
$result = SupplierLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupplierLogic::getError());
}
/**
* @notes 删除供应商管理
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function delete()
{
$params = (new SupplierValidate())->post()->goCheck('delete');
SupplierLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取供应商管理详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/23 15:56
*/
public function detail()
{
$params = (new SupplierValidate())->goCheck('detail');
$result = SupplierLogic::detail($params);
return $this->data($result);
}
}