wupengfei 2 年之前
父节点
当前提交
389856c580
共有 2 个文件被更改,包括 14 次插入13 次删除
  1. 1 11
      application/api/controller/Evection.php
  2. 13 2
      application/common/model/ApproveFlow.php

+ 1 - 11
application/api/controller/Evection.php

@@ -52,17 +52,7 @@ class Evection extends Base
      */
     public function getCopyFlow()
     {
-        $check_flow = ApproveFlow::where('user_id',$this->user_id)->where('type',2)->where('module',3)->find();
-        $where = [];
-        $where[] = ['l.type','=',2];
-        $where[] = ['l.module','=',3];
-        if($check_flow)$where[] = ['l.sort','>',$check_flow->sort];
-        $list = ApproveFlow::field('l.user_id,u.name user_name,u.headimg')
-            ->alias('l')
-            ->where($where)
-            ->order('l.sort asc')
-            ->leftJoin('StoreMember u','u.id = l.user_id')
-            ->select()->toArray();
+        $list = ApproveFlow::getCopyTo(3,$this->user_id);
         $this->success('ok',['list'=>$list]);
     }
 

+ 13 - 2
application/common/model/ApproveFlow.php

@@ -20,9 +20,20 @@ class ApproveFlow extends Model
     }
 
     // 获取抄送人
-    public static function getCopyTo($module)
+    public static function getCopyTo($module,$user_id)
     {
-        return static::where('type',2)->where('module',$module)->order('sort asc ,id asc')->select()->toArray();
+        $check_flow = ApproveFlow::where('user_id',$user_id)->where('type',2)->where('module',$module)->find();
+        $where = [];
+        $where[] = ['l.type','=',2];
+        $where[] = ['l.module','=',$module];
+        if($check_flow)$where[] = ['l.sort','>',$check_flow->sort];
+        $list = ApproveFlow::field('l.user_id,u.name user_name,u.headimg')
+            ->alias('l')
+            ->where($where)
+            ->order('l.sort asc')
+            ->leftJoin('StoreMember u','u.id = l.user_id')
+            ->select()->toArray();
+       return $list;
     }