|
...
|
...
|
@@ -31,15 +31,15 @@ class CategoryController extends BaseController |
|
|
|
*/
|
|
|
|
public function index(Category $category)
|
|
|
|
{
|
|
|
|
if(!empty($this->map['title'])){
|
|
|
|
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
|
|
|
|
}
|
|
|
|
$this->map['project_id'] = $this->user['project_id'];
|
|
|
|
$this->map = $this->searchParam();
|
|
|
|
$filed = ['id', 'project_id', 'pid', 'title', 'image', 'route','keywords', 'describe', 'status','created_at'];
|
|
|
|
$list = $category->list($this->map,'id',$filed);
|
|
|
|
$data = [];
|
|
|
|
if(!empty($list)){
|
|
|
|
foreach ($list as $k =>$v){
|
|
|
|
$v['url'] = $this->user['domain'] . $v['url'];
|
|
|
|
$v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;
|
|
|
|
$v['image_link'] = getImageUrl($v['image']);
|
|
|
|
$v = $this->handleParam($v);
|
|
|
|
$list[$k] = $v;
|
|
|
|
}
|
|
...
|
...
|
@@ -49,17 +49,18 @@ class CategoryController extends BaseController |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :分类处理参数
|
|
|
|
* @name :handleParam
|
|
|
|
* @remark :搜索参数处理
|
|
|
|
* @name :searchParam
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/17 11:10
|
|
|
|
* @time :2023/9/14 14:57
|
|
|
|
*/
|
|
|
|
public function handleParam($v){
|
|
|
|
$v['url'] = $this->user['domain'] . $v['url'];
|
|
|
|
$v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;
|
|
|
|
$v['image_link'] = getImageUrl($v['image']);
|
|
|
|
return $v;
|
|
|
|
public function searchParam(){
|
|
|
|
if(!empty($this->map['title'])){
|
|
|
|
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
|
|
|
|
}
|
|
|
|
$this->map['project_id'] = $this->user['project_id'];
|
|
|
|
return $this->map;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|