erp/app/admin/controller/setting/LabelController.php
2024-02-17 18:01:44 +08:00

95 lines
2.1 KiB
PHP

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