101 lines
2.3 KiB
PHP
101 lines
2.3 KiB
PHP
<?php
|
|
namespace app\adminapi\controller\custom;
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
use app\adminapi\lists\custom\CustomLists;
|
|
use app\adminapi\logic\custom\CustomLogic;
|
|
use app\adminapi\validate\custom\CustomValidate;
|
|
|
|
|
|
/**
|
|
* Custom控制器
|
|
* Class CustomController
|
|
* @package app\adminapi\controller\custom
|
|
*/
|
|
class CustomController extends BaseAdminController
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 获取列表
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2023/11/11 22:10
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new CustomLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2023/11/11 22:10
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new CustomValidate())->post()->goCheck('add');
|
|
$result = CustomLogic::add($params,$this->adminId);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(CustomLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2023/11/11 22:10
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new CustomValidate())->post()->goCheck('edit');
|
|
$result = CustomLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(CustomLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2023/11/11 22:10
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new CustomValidate())->post()->goCheck('delete');
|
|
$result = CustomLogic::delete($params);
|
|
if (true === $result) {
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
return $this->fail(CustomLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取详情
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2023/11/11 22:10
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new CustomValidate())->goCheck('detail');
|
|
$result = CustomLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
public function datas()
|
|
{
|
|
return $this->data(CustomLogic::datas());
|
|
}
|
|
|
|
|
|
} |