138 lines
3.8 KiB
PHP
138 lines
3.8 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
|
||
namespace app\adminapi\controller\item;
|
||
|
||
|
||
use app\adminapi\controller\BaseAdminController;
|
||
use app\adminapi\lists\item\ItemCateLists;
|
||
use app\adminapi\logic\item\ItemCateLogic;
|
||
use app\adminapi\validate\item\ItemCateValidate;
|
||
|
||
|
||
/**
|
||
* 项目分类控制器
|
||
* Class ItemCateController
|
||
* @package app\adminapi\controller\item
|
||
*/
|
||
class ItemCateController extends BaseAdminController
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 获取项目分类列表
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/16 13:23
|
||
*/
|
||
public function lists()
|
||
{
|
||
return $this->dataLists(new ItemCateLists());
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 添加项目分类
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/16 13:23
|
||
*/
|
||
public function add()
|
||
{
|
||
$params = (new ItemCateValidate())->post()->goCheck('add');
|
||
$result = ItemCateLogic::add($params);
|
||
if (true === $result) {
|
||
return $this->success('添加成功', [], 1, 1);
|
||
}
|
||
return $this->fail(ItemCateLogic::getError());
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 编辑项目分类
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/16 13:23
|
||
*/
|
||
public function edit()
|
||
{
|
||
$params = (new ItemCateValidate())->post()->goCheck('edit');
|
||
$result = ItemCateLogic::edit($params);
|
||
if (true === $result) {
|
||
return $this->success('编辑成功', [], 1, 1);
|
||
}
|
||
return $this->fail(ItemCateLogic::getError());
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 删除项目分类
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/16 13:23
|
||
*/
|
||
public function delete()
|
||
{
|
||
$params = (new ItemCateValidate())->post()->goCheck('delete');
|
||
ItemCateLogic::delete($params);
|
||
return $this->success('删除成功', [], 1, 1);
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取项目分类详情
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2024/01/16 13:23
|
||
*/
|
||
public function detail()
|
||
{
|
||
$params = (new ItemCateValidate())->goCheck('detail');
|
||
$result = ItemCateLogic::detail($params);
|
||
return $this->data($result);
|
||
}
|
||
|
||
/**
|
||
* @notes 更改项目分类状态
|
||
* @return \think\response\Json
|
||
* @author likeadmin
|
||
* @date 2022/2/21 10:15
|
||
*/
|
||
public function updateStatus()
|
||
{
|
||
$params = (new ItemCateValidate())->post()->goCheck('status');
|
||
$result = ItemCateLogic::updateStatus($params);
|
||
if (true === $result) {
|
||
return $this->success('修改成功', [], 1, 1);
|
||
}
|
||
return $this->fail(ItemCateLogic::getError());
|
||
}
|
||
|
||
/**
|
||
* @notes 获取项目分类
|
||
* @return \think\response\Json
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author 段誉
|
||
* @date 2022/10/13 10:54
|
||
*/
|
||
public function all()
|
||
{
|
||
$result = ItemCateLogic::getAllData();
|
||
return $this->data($result);
|
||
}
|
||
|
||
} |