刘桂岩 5 years ago
parent
commit
090d35e807
1 changed files with 32 additions and 0 deletions
  1. 32 0
      application/inter/controller/Dcquery.php

+ 32 - 0
application/inter/controller/Dcquery.php

@@ -500,4 +500,36 @@ class Dcquery extends Controller
         }
         }
         return json_encode($info);
         return json_encode($info);
     }
     }
+
+    public function statis()
+    {
+        if(isset($_REQUEST['phone']) && !empty($_REQUEST['phone'])){
+            $phone = $_REQUEST['phone'];
+        }else{
+            return json_encode(['code'=>'1033','status'=>'fail','msg'=>'请进行电话传参']);
+        }
+        if(isset($_REQUEST['date'][0]) && !empty($_REQUEST['date'][0])){
+            $where = ['createdAt','between',[$_REQUEST['date'][0],$_REQUEST['date'][1]]];
+        }else{
+            $where = [];
+        }
+        $dlInfo = DB::table('manager')->where('phone',$phone)->where('status',1)->field('institution_id')->select();
+        $class = DB::table('constant')->where('parent_id','exam_class')->column('constant_value');
+        $data = [];
+        foreach ($dlInfo as $k=>$v){
+            $ins = DB::table('institution')->where('id',$v['institution_id'])->value('name');
+            $data[$k]['id'] = $v['institution_id'];
+            $data[$k]['ins_name'] = $ins;
+            $exam = DB::table('exams')->where('institution_id',$v['institution_id'])->where($where)->count();
+            $data[$k]['type_num'] = [];
+            $data[$k]['type_num'][] = ['ALL',$exam];
+            if(!empty($class)){
+                foreach ($class as $key=>$value){
+                    $number = DB::table('exams')->where('institution_id',$v['institution_id'])->where('exam_class',$value)->where($where)->count();
+                    $data[$k][] = [$value,$number];
+                }
+            }
+        }
+        return json_encode($data);
+    }
 }
 }