103 lines
2.4 KiB
PHP
103 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
use app\admin\controller\BaseAdminController;
|
|
use app\admin\lists\ProductCategoryLists;
|
|
use app\admin\logic\ProductCategoryLogic;
|
|
use app\admin\validate\ProductCategoryValidate;
|
|
use support\Request;
|
|
|
|
|
|
/**
|
|
* ProductCategory控制器
|
|
* Class ProductCategoryController
|
|
* @package app\admin\controller
|
|
*/
|
|
class ProductCategoryController extends BaseAdminController
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 获取列表
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2025/07/11 11:41
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new ProductCategoryLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2025/07/11 11:41
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new ProductCategoryValidate())->post()->goCheck('add');
|
|
$result = ProductCategoryLogic::add($params);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(ProductCategoryLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2025/07/11 11:41
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new ProductCategoryValidate())->post()->goCheck('edit');
|
|
$result = ProductCategoryLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(ProductCategoryLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2025/07/11 11:41
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new ProductCategoryValidate())->post()->goCheck('delete');
|
|
ProductCategoryLogic::delete($params);
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取详情
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2025/07/11 11:41
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new ProductCategoryValidate())->goCheck('detail');
|
|
$result = ProductCategoryLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
public function all(Request $request)
|
|
{
|
|
$params = $request->get();
|
|
$result = ProductCategoryLogic::all($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
}
|