|
...
|
...
|
@@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
namespace App\Http\Controllers\Bside\Product;
|
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Http\Controllers\Bside\BaseController;
|
|
|
|
use App\Http\Logic\Bside\Product\CategoryLogic;
|
|
|
|
use App\Http\Requests\Bside\product\CategoryRequest;
|
|
...
|
...
|
@@ -20,12 +21,12 @@ class CategoryController extends BaseController |
|
|
|
public function index(CategoryLogic $logic)
|
|
|
|
{
|
|
|
|
$map = [];
|
|
|
|
if(!empty($this->param['title'])){
|
|
|
|
$map[] = ['title', 'like', "%{$this->param['title']}%"];
|
|
|
|
if(!empty($this->param['search'])){
|
|
|
|
$map[] = ['title', 'like', "%{$this->param['search']}%"];
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = $logic->getList($map);
|
|
|
|
return $this->success($data);
|
|
|
|
$sort = ['id' => 'desc'];
|
|
|
|
$data = $logic->getList($map, $sort, ['id', 'pid', 'title', 'image', 'keywords', 'describe', 'status','created_at'],0);
|
|
|
|
return $this->success(Arr::listToTree($data));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function info(Request $request, CategoryLogic $logic){
|
|
...
|
...
|
@@ -35,7 +36,7 @@ class CategoryController extends BaseController |
|
|
|
'id.required' => 'ID不能为空'
|
|
|
|
]);
|
|
|
|
$data = $logic->getInfo($this->param['id']);
|
|
|
|
return $this->success($data);
|
|
|
|
return $this->success(Arr::twoKeepKeys($data, ['id', 'pid', 'title', 'image', 'keywords', 'describe', 'status']));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function save(CategoryRequest $request, CategoryLogic $logic)
|
|
...
|
...
|
@@ -55,4 +56,6 @@ class CategoryController extends BaseController |
|
|
|
$data = $logic->delete($this->param['ids']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
//todo Ai生成 关键词和描述
|
|
|
|
} |
...
|
...
|
|