|
...
|
...
|
@@ -89,19 +89,23 @@ class NewsCategoryController extends BaseController |
|
|
|
],[
|
|
|
|
'id.required' => 'ID不能为空',
|
|
|
|
]);
|
|
|
|
foreach ($this->param['id'] as $k=>$v){
|
|
|
|
foreach ($this->param['id'] as $v){
|
|
|
|
var_dump($v);
|
|
|
|
//查询是否有子分类
|
|
|
|
$id = $newsCategory->read(['pid'=>$this->param['id']],['id']);
|
|
|
|
$id = $newsCategory->read(['pid'=>$v],['id']);
|
|
|
|
if($id !== false){
|
|
|
|
$this->response('当前分类拥有子分类不允许删除',Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
//查看当前分内下是否有商品
|
|
|
|
$news->read(['category_id'=>$this->param['id']],['id']);
|
|
|
|
$id = $news->read(['category_id'=>$v],['id']);
|
|
|
|
|
|
|
|
if($id !== false){
|
|
|
|
$this->response('当前分类拥有商品',Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->param['id'] = ['in',$id];
|
|
|
|
var_dump($this->map);
|
|
|
|
die();
|
|
|
|
$rs = $newsCategory->del($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->response('error',Code::USER_ERROR);
|
...
|
...
|
|