作者 liyuhang

gx

@@ -35,7 +35,6 @@ class BaseController extends Controller @@ -35,7 +35,6 @@ class BaseController extends Controller
35 $info = Cache::get($this->token); 35 $info = Cache::get($this->token);
36 $this->user = $info; 36 $this->user = $info;
37 $this->uid = $info['id']; 37 $this->uid = $info['id'];
38 - $this->param['project_id'] = $this->user['project_id'];  
39 }else{ 38 }else{
40 return response(['code'=>Code::USER_ERROR,'msg'=>'当前用户未登录']); 39 return response(['code'=>Code::USER_ERROR,'msg'=>'当前用户未登录']);
41 } 40 }
@@ -89,19 +89,23 @@ class NewsCategoryController extends BaseController @@ -89,19 +89,23 @@ class NewsCategoryController extends BaseController
89 ],[ 89 ],[
90 'id.required' => 'ID不能为空', 90 'id.required' => 'ID不能为空',
91 ]); 91 ]);
92 - foreach ($this->param['id'] as $k=>$v){ 92 + foreach ($this->param['id'] as $v){
  93 + var_dump($v);
93 //查询是否有子分类 94 //查询是否有子分类
94 - $id = $newsCategory->read(['pid'=>$this->param['id']],['id']); 95 + $id = $newsCategory->read(['pid'=>$v],['id']);
95 if($id !== false){ 96 if($id !== false){
96 $this->response('当前分类拥有子分类不允许删除',Code::USER_ERROR); 97 $this->response('当前分类拥有子分类不允许删除',Code::USER_ERROR);
97 } 98 }
98 //查看当前分内下是否有商品 99 //查看当前分内下是否有商品
99 - $news->read(['category_id'=>$this->param['id']],['id']); 100 + $id = $news->read(['category_id'=>$v],['id']);
  101 +
100 if($id !== false){ 102 if($id !== false){
101 $this->response('当前分类拥有商品',Code::USER_ERROR); 103 $this->response('当前分类拥有商品',Code::USER_ERROR);
102 } 104 }
103 } 105 }
104 $this->param['id'] = ['in',$id]; 106 $this->param['id'] = ['in',$id];
  107 + var_dump($this->map);
  108 + die();
105 $rs = $newsCategory->del($this->param); 109 $rs = $newsCategory->del($this->param);
106 if($rs === false){ 110 if($rs === false){
107 $this->response('error',Code::USER_ERROR); 111 $this->response('error',Code::USER_ERROR);