multi-store/app/admin/controller/setting/CategoryController.php
2024-05-30 21:37:55 +08:00

95 lines
2.2 KiB
PHP

<?php
namespace app\admin\controller\setting;
use app\admin\controller\BaseAdminController;
use app\admin\lists\setting\CategoryLists;
use app\admin\logic\setting\CategoryLogic;
use app\admin\validate\setting\CategoryValidate;
/**
* 分类表控制器
* Class CategoryController
* @package app\admin\controller\setting
*/
class CategoryController extends BaseAdminController
{
/**
* @notes 获取分类表列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/05 16:13
*/
public function lists()
{
return $this->dataLists(new CategoryLists());
}
/**
* @notes 添加分类表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/05 16:13
*/
public function add()
{
$params = (new CategoryValidate())->post()->goCheck('add');
$result = CategoryLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(CategoryLogic::getError());
}
/**
* @notes 编辑分类表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/05 16:13
*/
public function edit()
{
$params = (new CategoryValidate())->post()->goCheck('edit');
$result = CategoryLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(CategoryLogic::getError());
}
/**
* @notes 删除分类表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/05 16:13
*/
public function delete()
{
$params = (new CategoryValidate())->post()->goCheck('delete');
CategoryLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取分类表详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/05 16:13
*/
public function detail()
{
$params = (new CategoryValidate())->goCheck('detail');
$result = CategoryLogic::detail($params);
return $this->data($result);
}
}