wupengfei 2 years ago
parent
commit
ad8a2e48fa

+ 9 - 7
application/api/controller/UserCar.php

@@ -2,7 +2,7 @@
 namespace app\api\controller;
 use AlibabaCloud\SDK\Dingtalk\Vyida_1_0\Models\GetFormDataByIDResponseBody\originator\name;
 use app\common\model\CarApprove;
-use app\common\model\CarFlow;
+use app\common\model\ApproveFlow;
 use app\common\model\CarInfo;
 use app\common\service\ApproveService;
 use think\Db;
@@ -33,11 +33,12 @@ class UserCar extends Base
      */
     public function getApproveFlow()
     {
-        $check_flow = CarFlow::where('user_id',$this->user_id)->where('type',1)->find();
+        $check_flow = ApproveFlow::where('user_id',$this->user_id)->where('type',1)->where('module',2)->find();
         $where = [];
         $where[] = ['l.type','=',1];
+        $where[] = ['l.module','=',2];
         if($check_flow)$where[] = ['l.sort','>',$check_flow->sort];
-        $list = CarFlow::field('l.user_id,u.name user_name,u.headimg')
+        $list = ApproveFlow::field('l.user_id,u.name user_name,u.headimg')
             ->alias('l')
             ->where($where)
             ->order('l.sort asc')
@@ -59,11 +60,12 @@ class UserCar extends Base
      */
     public function getCopyFlow()
     {
-        $check_flow = CarFlow::where('user_id',$this->user_id)->where('type',2)->find();
+        $check_flow = ApproveFlow::where('user_id',$this->user_id)->where('type',2)->where('module',2)->find();
         $where = [];
         $where[] = ['l.type','=',2];
+        $where[] = ['l.module','=',2];
         if($check_flow)$where[] = ['l.sort','>',$check_flow->sort];
-        $list = CarFlow::field('l.user_id,u.name user_name,u.headimg')
+        $list = ApproveFlow::field('l.user_id,u.name user_name,u.headimg')
             ->alias('l')
             ->where($where)
             ->order('l.sort asc')
@@ -98,11 +100,11 @@ class UserCar extends Base
         $request_param['user_id'] = $this->user_id;
         $request_param['apply_user'] = $this->user_id;
 
-        $flow = CarFlow::getApproveUser();// 用车审批流程设置
+        $flow = ApproveFlow::getApproveUser(2);// 用车审批流程设置
         $flow_user = array_column($flow,'user_id');
         $flow_key = array_search($request_param['user_id'],$flow_user);// 请用车是否在审批流程人员中
 
-        $copy = CarFlow::getCopyTo();
+        $copy = ApproveFlow::getCopyTo(2);
         $copy_user = array_column($copy,'user_id');
         $copy_key = array_search($request_param['user_id'],$copy_user);// 用车人是否在抄送人员中
 

+ 9 - 7
application/api/controller/UserLeave.php

@@ -2,7 +2,7 @@
 namespace app\api\controller;
 use AlibabaCloud\SDK\Dingtalk\Vyida_1_0\Models\GetFormDataByIDResponseBody\originator\name;
 use app\common\model\LeaveApprove;
-use app\common\model\LeaveFlow;
+use app\common\model\ApproveFlow;
 use app\common\model\LeaveInfo;
 use app\common\model\LeaveType;
 use app\common\service\ApproveService;
@@ -34,11 +34,12 @@ class UserLeave extends Base
      */
     public function getApproveFlow()
     {
-        $check_flow = LeaveFlow::where('user_id',$this->user_id)->where('type',1)->find();
+        $check_flow = ApproveFlow::where('user_id',$this->user_id)->where('type',1)->where('module',1)->find();
         $where = [];
         $where[] = ['l.type','=',1];
+        $where[] = ['l.module','=',1];
         if($check_flow)$where[] = ['l.sort','>',$check_flow->sort];
-        $list = LeaveFlow::field('l.user_id,u.name user_name,u.headimg')
+        $list = ApproveFlow::field('l.user_id,u.name user_name,u.headimg')
             ->alias('l')
             ->where($where)
             ->order('l.sort asc')
@@ -60,11 +61,12 @@ class UserLeave extends Base
      */
     public function getCopyFlow()
     {
-        $check_flow = LeaveFlow::where('user_id',$this->user_id)->where('type',2)->find();
+        $check_flow = ApproveFlow::where('user_id',$this->user_id)->where('type',2)->where('module',1)->find();
         $where = [];
         $where[] = ['l.type','=',2];
+        $where[] = ['l.module','=',1];
         if($check_flow)$where[] = ['l.sort','>',$check_flow->sort];
-        $list = LeaveFlow::field('l.user_id,u.name user_name,u.headimg')
+        $list = ApproveFlow::field('l.user_id,u.name user_name,u.headimg')
             ->alias('l')
             ->where($where)
             ->order('l.sort asc')
@@ -117,12 +119,12 @@ class UserLeave extends Base
         if(empty($request_param['user_id'])) $request_param['user_id'] = $this->user_id;
         $request_param['apply_user'] = $this->user_id;// 申请会员id
 
-        $flow = LeaveFlow::getApproveUser();// 请假审批流程设置
+        $flow = ApproveFlow::getApproveUser(1);// 请假审批流程设置
         $flow_user = array_column($flow,'user_id');
         $flow_key = array_search($request_param['user_id'],$flow_user);// 请假人是否在审批流程人员中
 
 
-        $copy = LeaveFlow::getCopyTo();
+        $copy = ApproveFlow::getCopyTo(1);
         $copy_user = array_column($copy,'user_id');
         $copy_key = array_search($request_param['user_id'],$copy_user);// 请假人是否在抄送人员中
 

+ 21 - 0
application/common/model/ApproveFlow.php

@@ -0,0 +1,21 @@
+<?php
+namespace app\common\model;
+use think\Model;
+// 审批流程设置
+class ApproveFlow extends Model
+{
+    // 获取审批人
+    public static function getApproveUser($module){
+        return static::where('type',1)->where('module',$module)
+            ->order('sort asc ,id asc')
+            ->select()->toArray();
+    }
+
+    // 获取抄送人
+    public static function getCopyTo($module)
+    {
+        return static::where('type',2)->where('module',$module)->order('sort asc ,id asc')->select()->toArray();
+    }
+
+
+}

+ 0 - 19
application/common/model/CarFlow.php

@@ -1,19 +0,0 @@
-<?php
-namespace app\common\model;
-use think\Model;
-// 用车审批流程设置
-class CarFlow extends Model
-{
-    // 获取审批人
-    public static function getApproveUser(){
-        return static::where('type',1)->order('sort asc ,id asc')->select()->toArray();
-    }
-
-    // 获取抄送人
-    public static function getCopyTo()
-    {
-        return static::where('type',2)->order('sort asc ,id asc')->select()->toArray();
-    }
-
-
-}

+ 0 - 19
application/common/model/LeaveFlow.php

@@ -1,19 +0,0 @@
-<?php
-namespace app\common\model;
-use think\Model;
-// 请假审批流程设置
-class LeaveFlow extends Model
-{
-    // 获取审批人
-    public static function getApproveUser(){
-        return static::where('type',1)->order('sort asc ,id asc')->select()->toArray();
-    }
-
-    // 获取抄送人
-    public static function getCopyTo()
-    {
-        return static::where('type',2)->order('sort asc ,id asc')->select()->toArray();
-    }
-
-
-}