Browse Source

审核记录优化

wufeng 2 years ago
parent
commit
8047a70034
1 changed files with 20 additions and 30 deletions
  1. 20 30
      app/admin/controller/Process.php

+ 20 - 30
app/admin/controller/Process.php

@@ -58,24 +58,23 @@ class Process extends Base
         return app_show(0, "获取成功", $info);
     }
 
-    /**
-     * @return \think\response\Json|void
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     */
+    //审核记录
     public function process()
     {
-        $process_type = isset($this->post['type']) && $this->post['type'] != "" ? $this->post['type'] : "";
-        if ($process_type == "") {
-            return error_show(1004, "参数type 不能为空");
-        }
-        $orderCode = isset($this->post['orderCode']) && $this->post['orderCode'] != "" ? $this->post['orderCode'] : "";
-        if ($orderCode == "") {
-            return error_show(1004, "参数orderCode不能为空");
-        }
+        $param = $this->request->filter('trim')->only(['type','orderCode'],'post');
+
+        $val=Validate::rule([]);
+        if(!$val->check($param))return error_show(1004,$val->getError());
+//        $process_type = isset($this->post['type']) && $this->post['type'] != "" ? $this->post['type'] : "";
+//        if ($process_type == "") {
+//            return error_show(1004, "参数type 不能为空");
+//        }
+//        $orderCode = isset($this->post['orderCode']) && $this->post['orderCode'] != "" ? $this->post['orderCode'] : "";
+//        if ($orderCode == "") {
+//            return error_show(1004, "参数orderCode不能为空");
+//        }
         $list = Db::name("action_process")
-            ->where(['order_type' => $process_type, "is_del" => 0, "status" => 1])
+            ->where(['order_type' => $param['type'], "is_del" => 0, "status" => 1])
             ->order("weight desc,id desc")
             ->column('*', 'order_process');
 
@@ -83,11 +82,11 @@ class Process extends Base
         $order_process_s = array_column($list, 'order_process');
 
         $rs = Db::name("process_order")
-            ->where(["order_type" => $process_type])
+            ->where(["order_type" => $param['type']])
             ->whereIn('action_process', $order_process_s)
             ->field('id,action_uid,action_name,addtime,action_process,order_type,source');
-        if (is_numeric($orderCode)) $rs->where('order_id', $orderCode);
-        else $rs->where('order_code', $orderCode);
+        if (is_numeric($param['orderCode'])) $rs->where('order_id', $param['orderCode']);
+        else $rs->where('order_code', $param['orderCode']);
 
         $node = $rs
             ->select()
@@ -103,19 +102,10 @@ class Process extends Base
             $value['weight'] = isset($list[$value['action_process']]['weight']) ? $list[$value['action_process']]['weight'] : '';
             $value['is_del'] = isset($list[$value['action_process']]['is_del']) ? $list[$value['action_process']]['is_del'] : '';
 
-
-//        $value = isset($list[$value['action_process']])?array_merge($list[$value['action_process']],$value):$value;
-//        $node = Db::name("process_order")
-//            ->where([
-//                "order_type"=>$value['order_type'],
-//                "action_process"=>$value['order_process'],
-//                "order_code"=>$orderCode])
-//            ->find();
-//        $value['action_uid']= isset($node[$value['order_process']]['action_uid']) ? $node[$value['order_process']]['action_uid']:'';
-//        $value['action_name']= isset($node[$value['order_process']]['action_name']) ? $node[$value['order_process']]['action_name']:'';
-//        $value['addtime']= isset($node[$value['order_process']]['addtime']) ? $node[$value['order_process']]['addtime']:'';
-//        $data[]=$value;
         }
+
+        if ($node) array_unshift($node, ['status_name' => '创建', 'order_process' => -1]);
+
         return app_show(0, "获取成功", $node);
     }