logistics/app/adminapi/controller/vehicle/VehicleController.php
2023-08-30 22:36:10 +08:00

78 lines
1.8 KiB
PHP

<?php
namespace app\adminapi\controller\vehicle;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\vehicle\VehicleLists;
use app\adminapi\logic\vehicle\VehicleLogic;
use app\adminapi\validate\vehicle\VehicleValidate;
/**
* Vehicle控制器
* Class VehicleController
* @package app\adminapi\controller
*/
class VehicleController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/17 09:23
*/
public function lists()
{
return $this->dataLists(new VehicleLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/17 09:23
*/
public function add()
{
$params = (new VehicleValidate())->post()->goCheck('add');
$result = VehicleLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(VehicleLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/17 09:23
*/
public function edit()
{
$params = (new VehicleValidate())->post()->goCheck('edit');
$result = VehicleLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(VehicleLogic::getError());
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/08/17 09:23
*/
public function detail()
{
$params = (new VehicleValidate())->goCheck('detail');
$result = VehicleLogic::detail($params);
return $this->data($result);
}
}