engineering/app/adminapi/controller/custom/CustomServiceController.php
2024-03-14 16:13:59 +08:00

108 lines
2.6 KiB
PHP

<?php
namespace app\adminapi\controller\custom;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\custom\CustomServiceLists;
use app\adminapi\logic\custom\CustomServiceLogic;
use app\adminapi\validate\custom\CustomServiceValidate;
/**
* CustomService控制器
* Class CustomServiceController
* @package app\adminapi\controller\custom_service
*/
class CustomServiceController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/11/12 14:00
*/
public function lists()
{
return $this->dataLists(new CustomServiceLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/11/12 14:00
*/
public function add()
{
$params = (new CustomServiceValidate())->post()->goCheck('add');
$result = CustomServiceLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(CustomServiceLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/11/12 14:00
*/
public function edit(): \think\response\Json
{
$params = (new CustomServiceValidate())->post()->goCheck('edit');
$result = CustomServiceLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(CustomServiceLogic::getError());
}
/**
* @notes 处理
* @return \think\response\Json
* @author likeadmin
* @date 2023/11/12 14:00
*/
public function solve(): \think\response\Json
{
$params = (new CustomServiceValidate())->post()->goCheck('check');
$result = CustomServiceLogic::check($params);
if (true === $result) {
return $this->success('处理成功', [], 1, 1);
}
return $this->fail(CustomServiceLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2023/11/11 22:56
*/
public function delete()
{
$params = (new CustomServiceValidate())->post()->goCheck('delete');
CustomServiceLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/11/12 14:00
*/
public function detail()
{
$params = (new CustomServiceValidate())->goCheck('detail');
$result = CustomServiceLogic::detail($params);
return $this->data($result);
}
}