소스 검색

委托单删除优化

huangsanjia 2 년 전
부모
커밋
888cc18463
1개의 변경된 파일14개의 추가작업 그리고 7개의 파일을 삭제
  1. 14 7
      application/admin/controller/Entrust.php

+ 14 - 7
application/admin/controller/Entrust.php

@@ -212,15 +212,22 @@ class Entrust extends Backend
         if (empty($ids)) {
             $this->error(__('Parameter %s can not be empty', 'ids'));
         }
-        $row = $this->model->get($ids);
-        if (!empty($row['gather_id'])){
-            $tab = $row['gather_tab'] == 'gather_txt_check_gc'?'gather_txt_gc':'gather_txt_gcms';
-            $id = $row['gather_id'];
-            $res = Db::name($tab)->where('id',$id)->find();
-            if ($res['status'] == 1){
-                $this->error('检测数据已确认,无法删除!');
+        $idList = explode(',',$ids);
+        $canDel = true;
+        foreach ($idList as $key => $value){
+            $row = $this->model->get($ids);
+            if (!empty($row['gather_id'])){
+                $tab = $row['gather_tab'] == 'gather_txt_check_gc'?'gather_txt_gc':'gather_txt_gcms';
+                $id = $row['gather_id'];
+                $res = Db::name($tab)->where('id',$id)->find();
+                if ($res['status'] == 1){
+                    $canDel = false;
+                }
             }
         }
+        if ($canDel === false){
+            $this->error('检测数据已确认,无法删除!');
+        }
         $pk = $this->model->getPk();
         $adminIds = $this->getDataLimitAdminIds();
         if (is_array($adminIds)) {