wugg 2 роки тому
батько
коміт
a30bdc0e09
1 змінених файлів з 8 додано та 13 видалено
  1. 8 13
      app/admin/controller/Proorder.php

+ 8 - 13
app/admin/controller/Proorder.php

@@ -38,36 +38,31 @@ public function waitlist(){
     $where = [['is_del',"=",0]];
     $order_code= isset($this->post['order_code']) && $this->post['order_code'] !==""? intval($this->post['order_code']):"";
     if($order_code!=""){
-        $where[]= ["order_code",'like',"%$order_code%"];
+        $where[]= ["a.order_code",'like',"%$order_code%"];
     }
     $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !==""? trim($this->post['apply_id']) :"";
     if($apply_id!=""){
-        $where[]=["apply_id","=",$apply_id];
+        $where[]=["a.wait_id","=",$apply_id];
     }
     $action_uid = isset($this->post['action_uid']) && $this->post['action_uid'] !==""? trim($this->post['action_uid']) :"";
     if($action_uid!=""){
-        $where[]=["action_uid","=",$action_uid];
+        $where[]=["a.action_uid","=",$action_uid];
     }
-    $count = Db::name('workflow')->where($where)->count();
+    $count = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")->where($where)->count();
     $total = ceil("$count/$size");
     $page = $page>$total ? $total:$page;
-    $list = Db::name("workflow")
-        ->field("apply_id,apply_name,addtime,action_uid,action_name,order_status,order_type,order_process,order_code,order_id,id")
-        ->where($where)->page($page,$size)->order("addtime desc")->select();
+    $list = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")
+        ->field("a.wait_id apply_id,a.wait_name apply_name,a.addtime,a.action_uid,a.action_name,a.order_status,a.order_type,a.order_process,a.order_code,a.order_id,a.id")
+        ->where($where)->page($page,$size)->order("a.addtime desc")->select();
     $data=[];//->field("status,order_name,process_name")
     foreach ($list as $value) {
         $str = Db::name("process")->where(['process_type' => $value['order_type']])->field("process_name,status")->find();
-        $var = Db::name("action_process")->where(['order_type'=>$value['order_type'],'order_process'=>$value['order_process']])->field("status_name,order_process,order_name,roleid")->find();
+        $var = Db::name("action_process")->where(['order_type'=>$value['order_type'],'order_process'=>$value['order_status']])->field("status_name,order_process,order_name,roleid")->find();
  // var_dump(Db::name("action_process")->getLastSql());
         $item = Db::name('role')->where(['id'=>$var['roleid']])->field("role_name")->find();
         $value['process_name']=$str['process_name'];
       $value['order_name']=$var['order_name'];
-       // $value['order_id']=$var['order_id'];
-      //  $value['order_process']=$var['order_process'];
         $value['status_name'] = $var['status_name'];
-   $value['roleid'] = $var['roleid'];
-      $value['status']=$str['status'];
-    $value['role_name']=$item['role_name'];
         $data[]=$value;
     }
     return app_show(0,"获取成功",["list"=>$data,'count'=>$count]);