作者 lyh

gx

@@ -406,26 +406,15 @@ class ProductLogic extends BaseLogic @@ -406,26 +406,15 @@ class ProductLogic extends BaseLogic
406 * @time :2023/8/9 10:17 406 * @time :2023/8/9 10:17
407 */ 407 */
408 public function getStatusNumber(){ 408 public function getStatusNumber(){
409 - $map = [];  
410 //三种状态 0:草稿 1:发布 2:回收站 409 //三种状态 0:草稿 1:发布 2:回收站
411 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3]; 410 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3];
412 foreach ($data as $k => $v){ 411 foreach ($data as $k => $v){
413 - if(!isset($this->param['featured'])){  
414 $cateModel = new Category(); 412 $cateModel = new Category();
415 $ids = $cateModel->where('title', 'not like', '%Featured%')->pluck('id')->toArray(); 413 $ids = $cateModel->where('title', 'not like', '%Featured%')->pluck('id')->toArray();
416 - if(!empty($ids)){  
417 - $cateRelated = new CategoryRelated();  
418 - $product_ids = $cateRelated->whereIn('cate_id',$ids)->pluck('product_id')->toArray();  
419 - $map['id'] = ['in',$product_ids];  
420 - }  
421 - }else{  
422 - $map['id'] = ['in',$ids];  
423 - }  
424 if($v == 3){ 414 if($v == 3){
425 - $data[$k] = $this->model->formatQuery($map)->count(); 415 + $data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->whereIn('id',$ids)->count();
426 }else{ 416 }else{
427 - $map['status'] = $v;  
428 - $data[$k] = $this->model->formatQuery($map)->count(); 417 + $data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id'],''])->count();
429 } 418 }
430 } 419 }
431 return $this->success($data); 420 return $this->success($data);