|
...
|
...
|
@@ -334,22 +334,6 @@ class ProductLogic extends BaseLogic |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :编辑产品
|
|
|
|
* @name :editProduct
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/7 10:02
|
|
|
|
*/
|
|
|
|
public function editProductRoute($id,$route){
|
|
|
|
$info = $this->model->read(['id'=>$id]);
|
|
|
|
if($info['route'] != $route){
|
|
|
|
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
|
|
|
|
}
|
|
|
|
$this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]);
|
|
|
|
return $route;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :删除数据
|
|
|
|
* @name :delete
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -406,13 +390,32 @@ class ProductLogic extends BaseLogic |
|
|
|
* @time :2023/8/9 10:17
|
|
|
|
*/
|
|
|
|
public function getStatusNumber(){
|
|
|
|
$map = [];
|
|
|
|
//三种状态 0:草稿 1:发布 2:回收站
|
|
|
|
$data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3];
|
|
|
|
foreach ($data as $k => $v){
|
|
|
|
//查詢所有分類
|
|
|
|
$cateModel = new Category();
|
|
|
|
$cateList = $cateModel->list(['status'=>1],'id',['id','pid']);
|
|
|
|
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
|
|
|
|
if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
|
|
|
|
$featured_ids = $cateModel->where('title', 'like', '%Featured%')->pluck('id')->toArray();
|
|
|
|
//获取当前的子集
|
|
|
|
$featured_arr = [];
|
|
|
|
foreach ($featured_ids as $id){
|
|
|
|
$featured_arr = array_values(array_unique(_get_all_sub($id,$cateList)));
|
|
|
|
}
|
|
|
|
if(!empty($featured_arr)){
|
|
|
|
$cateRelated = new CategoryRelated();
|
|
|
|
$product_ids = $cateRelated->whereNotIn('cate_id',$featured_arr)->pluck('product_id')->unique()->toArray();
|
|
|
|
$map['id'] = ['in',$product_ids];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($v == 3){
|
|
|
|
$data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->count();
|
|
|
|
$data[$k] = $this->model->formatQuery($map)->count();
|
|
|
|
}else{
|
|
|
|
$data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id']])->count();
|
|
|
|
$map['status'] = $v;
|
|
|
|
$data[$k] = $this->model->formatQuery($map)->count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
...
|
...
|
@@ -847,4 +850,34 @@ class ProductLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :产品列表搜索参数时分类列表
|
|
|
|
* @param :
|
|
|
|
* @name :getSearchCategoryList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/7/9 14:56
|
|
|
|
*/
|
|
|
|
public function getSearchCategoryList()
|
|
|
|
{
|
|
|
|
$categoryModel = new Category();
|
|
|
|
$this->param['deleted_at'] = null;
|
|
|
|
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
|
|
|
|
if(($this->param['featured_status'] != Category::STATUS_ACTIVE)) {
|
|
|
|
$this->param['title'] = ['not like','%Featured%'];
|
|
|
|
}
|
|
|
|
$list = $categoryModel->list($this->param, ['sort', 'id'], ['id', 'pid', 'title']);
|
|
|
|
if (!empty($list)) {
|
|
|
|
$data = [];
|
|
|
|
foreach ($list as $v) {
|
|
|
|
$v = (array)$v;
|
|
|
|
if ($v['pid'] == 0) {
|
|
|
|
$v['sub'] = _get_child($v['id'], $list);
|
|
|
|
$data[] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|