|
@@ -1,374 +1,97 @@
|
|
|
<?php
|
|
|
+
|
|
|
namespace app\common\service;
|
|
|
-use app\common\model\CarApprove;
|
|
|
-use app\common\model\CarInfo;
|
|
|
-use app\common\model\LeaveInfo;
|
|
|
-use app\common\model\LeaveApprove;
|
|
|
-use app\common\model\EvectionInfo;
|
|
|
-use app\common\model\EvectionApprove;
|
|
|
-use app\common\model\OfferInfo;
|
|
|
-use app\common\model\OfferApprove;
|
|
|
-use app\common\model\MaintainApprove;
|
|
|
-use app\common\model\MaintainInfo;
|
|
|
-use app\common\model\DocumentInfo;
|
|
|
-use app\common\model\DocumentApprove;
|
|
|
-use app\common\model\ContractInfo;
|
|
|
-use app\common\model\ContractApprove;
|
|
|
+
|
|
|
+use app\common\constant\CommonConstant;
|
|
|
+use app\common\model\Approve;
|
|
|
+use app\common\model\ApproveInfo;
|
|
|
+use app\common\model\User;
|
|
|
use think\Db;
|
|
|
use think\Exception;
|
|
|
|
|
|
/**
|
|
|
- * 审批
|
|
|
- * Class ApproveService
|
|
|
+ * 审批服务类
|
|
|
*/
|
|
|
class ApproveService
|
|
|
{
|
|
|
- protected static $ret_val = true;
|
|
|
- protected static $msg = '';
|
|
|
|
|
|
/**
|
|
|
- * 请假审批
|
|
|
- * @param $apply_id 申请记录id
|
|
|
- * @param $user_id 审批会员
|
|
|
- * @param $status 审批状态
|
|
|
- * @param $remark 审批备注
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public static function approveLeave($apply_id,$user_id,$status,$remark)
|
|
|
+ * 列表
|
|
|
+ *
|
|
|
+ * @param $module
|
|
|
+ * @param $status
|
|
|
+ * @param $start_time
|
|
|
+ * @param $end_time
|
|
|
+ * @param $search
|
|
|
+ * @param $offset
|
|
|
+ * @param $length
|
|
|
+ * @param $user
|
|
|
+ **/
|
|
|
+ public static function get_list($module, $status, $start_time, $end_time, $search, $offset, $length, $user)
|
|
|
{
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $apply_info = LeaveInfo::where('id',$apply_id)->find()->toArray();
|
|
|
- $approve_info = LeaveApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->find();
|
|
|
- if(empty($approve_info)) throw new Exception('没有审核权限');
|
|
|
- if(!in_array($status,[2,3]))throw new Exception('审批状态错误');
|
|
|
- $approve_info = $approve_info->toArray();
|
|
|
- if($approve_info['status'] == 0) throw new Exception('请等待审核');
|
|
|
- if($approve_info['status'] != 1) throw new Exception('该记录已审核');
|
|
|
- if($apply_info['status'] != 1) throw new Exception('该记录已审核或已取消');
|
|
|
- $approve_update = [];
|
|
|
- $approve_update['status'] = $status;
|
|
|
- $approve_update['remark'] = $remark;
|
|
|
- $approve_update['approve_time'] = date('Y-m-d H:i:s');
|
|
|
- $approve_time = time() - strtotime($approve_info['start_time']);
|
|
|
- $approve_update['time'] = $approve_time;
|
|
|
- $approve_update['time_desc'] = get_stay_time($approve_time);
|
|
|
- LeaveApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->update($approve_update);// 更新审批记录
|
|
|
- $leave_data = [];
|
|
|
- // 审批流程数 + 1
|
|
|
- $leave_data['cur_num'] = $apply_info['cur_num'] + 1;
|
|
|
- if($approve_info['flow'] < $apply_info['approve_num']){
|
|
|
- // 更新下一级审批记录状态
|
|
|
- LeaveApprove::where(['info_id'=>$approve_info['info_id'],'flow'=>$approve_info['flow'] + 1,'approve_type'=>1])->update(['status'=>1,'start_time'=>date('Y-m-d H:i:s')]);
|
|
|
- if($status == 3) $leave_data['status'] = 3;
|
|
|
- } else if($approve_info['flow'] == $apply_info['approve_num']) {
|
|
|
- $leave_data['status'] = $status;
|
|
|
- }
|
|
|
- LeaveInfo::where('id',$apply_info['id'])->update($leave_data);// 更新请假状态
|
|
|
- Db::commit();
|
|
|
- }catch (\Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- static::$ret_val = false;
|
|
|
- static::$msg = $e->getMessage();
|
|
|
+ if (!array_key_exists($module, CommonConstant::get_module_list())) {
|
|
|
+ return [];
|
|
|
}
|
|
|
- return ['ret_val'=>static::$ret_val ,'msg'=>static::$msg];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 用车申请审批
|
|
|
- * @param $apply_id 申请记录id
|
|
|
- * @param $user_id 审批会员
|
|
|
- * @param $status 审批状态
|
|
|
- * @param $remark 审批备注
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public static function approveCar($apply_id,$user_id,$status,$remark)
|
|
|
- {
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $apply_info = CarInfo::where('id',$apply_id)->find()->toArray();
|
|
|
- $approve_info = CarApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->find();
|
|
|
- if(empty($approve_info)) throw new Exception('没有审核权限');
|
|
|
- if(!in_array($status,[2,3]))throw new Exception('审批状态错误');
|
|
|
- $approve_info = $approve_info->toArray();
|
|
|
-
|
|
|
- if($approve_info['approve_user'] != $user_id) throw new Exception('没有审核权限');
|
|
|
- if($approve_info['status'] == 0) throw new Exception('请等待审核');
|
|
|
- if($approve_info['status'] != 1) throw new Exception('该记录已审核');
|
|
|
- if($apply_info['status'] != 1) throw new Exception('该记录已审核或已取消');
|
|
|
- $approve_update = [];
|
|
|
- $approve_update['status'] = $status;
|
|
|
- $approve_update['remark'] = $remark;
|
|
|
- $approve_update['approve_time'] = date('Y-m-d H:i:s');
|
|
|
- $approve_time = time() - strtotime($approve_info['start_time']);
|
|
|
- $approve_update['time'] = $approve_time;
|
|
|
- $approve_update['time_desc'] = get_stay_time($approve_time);
|
|
|
- CarApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->update($approve_update);// 更新审批记录
|
|
|
- $car_data = [];
|
|
|
- // 审批流程数 + 1
|
|
|
- $car_data['cur_num'] = $apply_info['cur_num'] + 1;
|
|
|
- if($approve_info['flow'] < $apply_info['approve_num']){
|
|
|
- // 更新下一级审批记录状态
|
|
|
- CarApprove::where(['car_id'=>$approve_info['car_id'],'flow'=>$approve_info['flow'] + 1,'approve_type'=>1])->update(['status'=>1,'start_time'=>date('Y-m-d H:i:s')]);
|
|
|
- if($status == 3) $car_data['status'] = 3;
|
|
|
- } else if($approve_info['flow'] == $apply_info['approve_num']) {
|
|
|
- $car_data['status'] = $status;
|
|
|
- }
|
|
|
- CarInfo::where('id',$apply_info['id'])->update($car_data);// 更新用车申请状态
|
|
|
- Db::commit();
|
|
|
- }catch (\Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- static::$ret_val = false;
|
|
|
- static::$msg = $e->getMessage();
|
|
|
+ if (!in_array($status, [1, 2, 3])) {
|
|
|
+ return [];
|
|
|
}
|
|
|
- return ['ret_val'=>static::$ret_val ,'msg'=>static::$msg];
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * 出差申请审批
|
|
|
- * @param $apply_id 申请记录id
|
|
|
- * @param $user_id 审批会员
|
|
|
- * @param $status 审批状态
|
|
|
- * @param $remark 审批备注
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public static function approveEvection($apply_id,$user_id,$status,$remark)
|
|
|
- {
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $apply_info = EvectionInfo::where('id',$apply_id)->find()->toArray();
|
|
|
- $approve_info =EvectionApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->find();
|
|
|
- if(empty($approve_info)) throw new Exception('没有审核权限');
|
|
|
- if(!in_array($status,[2,3]))throw new Exception('审批状态错误');
|
|
|
- $approve_info = $approve_info->toArray();
|
|
|
- if($approve_info['status'] == 0) throw new Exception('请等待审核');
|
|
|
- if($approve_info['status'] != 1) throw new Exception('该记录已审核');
|
|
|
- if($apply_info['status'] != 1) throw new Exception('该记录已审核或已取消');
|
|
|
- $approve_update = [];
|
|
|
- $approve_update['status'] = $status;
|
|
|
- $approve_update['remark'] = $remark;
|
|
|
- $approve_update['approve_time'] = date('Y-m-d H:i:s');
|
|
|
- $approve_time = time() - strtotime($approve_info['start_time']);
|
|
|
- $approve_update['time'] = $approve_time;
|
|
|
- $approve_update['time_desc'] = get_stay_time($approve_time);
|
|
|
- EvectionApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->update($approve_update);// 更新审批记录
|
|
|
- $Info_up = [];
|
|
|
- // 审批流程数 + 1
|
|
|
- $Info_up['cur_num'] = $approve_info['cur_num'] + 1;
|
|
|
- if($approve_info['flow'] < $approve_info['approve_num']){
|
|
|
- // 更新下一级审批记录状态
|
|
|
- EvectionApprove::where(['info_id'=>$approve_info['info_id'],'flow'=>$approve_info['flow'] + 1,'approve_type'=>1])->update(['status'=>1,'start_time'=>date('Y-m-d H:i:s')]);
|
|
|
- if($status == 3) $Info_up['status'] = 3;
|
|
|
- } else if($approve_info['flow'] == $approve_info['approve_num']) {
|
|
|
- $Info_up['status'] = $status;
|
|
|
- }
|
|
|
- EvectionInfo::where('id',$approve_info['id'])->update($Info_up);// 更新用车申请状态
|
|
|
- Db::commit();
|
|
|
- }catch (\Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- static::$ret_val = false;
|
|
|
- static::$msg = $e->getMessage();
|
|
|
- }
|
|
|
- return ['ret_val'=>static::$ret_val ,'msg'=>static::$msg];
|
|
|
+ $userid = $user['userid'];
|
|
|
+ $aliasName = 'approve.';
|
|
|
+// $jobName = 'approveInfo.';
|
|
|
+ $field = 'id,info_id,status,create_at';
|
|
|
+ $joinField = 'id,user_id,order_no,apply_date,reason,type,desc,start_time,end_time';
|
|
|
+ $list = Approve::field($field)
|
|
|
+ ->when($status, function ($query) use ($aliasName,$status) {
|
|
|
+ if ($status == 1) {
|
|
|
+ $query->where($aliasName.'status', 'in',[CommonConstant::STATUS_1,CommonConstant::STATUS_2]);
|
|
|
+ }
|
|
|
+ if ($status == 2) {
|
|
|
+ $query->where($aliasName.'status', 'in', [CommonConstant::STATUS_3,CommonConstant::STATUS_4]);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ->where($aliasName.'is_deleted', CommonConstant::IS_DELETED_0)
|
|
|
+ ->where($aliasName.'approve_user', $userid)
|
|
|
+ ->withJoin(['approveInfo' => function ($query) use ($joinField) {
|
|
|
+ $query->withField($joinField)
|
|
|
+ ->where('is_deleted',CommonConstant::IS_DELETED_0);
|
|
|
+ }]);
|
|
|
+// $list = self::get_with($list, $module, $status);
|
|
|
+ $list = $list->limit($offset, $length)
|
|
|
+ ->order('id desc')
|
|
|
+ ->select();
|
|
|
+ return $list;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 呈批申请审批
|
|
|
- * @param $apply_id 申请记录id
|
|
|
- * @param $user_id 审批会员
|
|
|
- * @param $status 审批状态
|
|
|
- * @param $remark 审批备注
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public static function approveOffer($apply_id,$user_id,$status,$remark)
|
|
|
- {
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $apply_info = OfferInfo::where('id',$apply_id)->find()->toArray();
|
|
|
- $approve_info =OfferApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->find();
|
|
|
- if(empty($approve_info)) throw new Exception('没有审核权限');
|
|
|
- if(!in_array($status,[2,3]))throw new Exception('审批状态错误');
|
|
|
- $approve_info = $approve_info->toArray();
|
|
|
- if($approve_info['approve_user'] != $user_id) throw new Exception('没有审核权限');
|
|
|
- if($approve_info['status'] == 0) throw new Exception('请等待审核');
|
|
|
- if($approve_info['status'] != 1) throw new Exception('该记录已审核');
|
|
|
- if($apply_info['status'] != 1) throw new Exception('该记录已审核或已取消');
|
|
|
- $approve_update = [];
|
|
|
- $approve_update['status'] = $status;
|
|
|
- $approve_update['remark'] = $remark;
|
|
|
- $approve_update['approve_time'] = date('Y-m-d H:i:s');
|
|
|
- $approve_time = time() - strtotime($approve_info['start_time']);
|
|
|
- $approve_update['time'] = $approve_time;
|
|
|
- $approve_update['time_desc'] = get_stay_time($approve_time);
|
|
|
- OfferApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->update($approve_update);// 更新审批记录
|
|
|
- $Info_up = [];
|
|
|
- // 审批流程数 + 1
|
|
|
- $Info_up['cur_num'] = $apply_info['cur_num'] + 1;
|
|
|
- if($approve_info['flow'] < $apply_info['approve_num']){
|
|
|
- // 更新下一级审批记录状态
|
|
|
- OfferApprove::where(['info_id'=>$approve_info['info_id'],'flow'=>$approve_info['flow'] + 1,'approve_type'=>1])->update(['status'=>1,'start_time'=>date('Y-m-d H:i:s')]);
|
|
|
- if($status == 3) $Info_up['status'] = 3;
|
|
|
- } else if($approve_info['flow'] == $apply_info['approve_num']) {
|
|
|
- $Info_up['status'] = $status;
|
|
|
- }
|
|
|
- OfferInfo::where('id',$apply_info['id'])->update($Info_up);// 更新用车申请状态
|
|
|
- Db::commit();
|
|
|
- }catch (\Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- static::$ret_val = false;
|
|
|
- static::$msg = $e->getMessage();
|
|
|
- }
|
|
|
- return ['ret_val'=>static::$ret_val ,'msg'=>static::$msg];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 维修申请审批
|
|
|
- * @param $apply_id 申请记录id
|
|
|
- * @param $user_id 审批会员
|
|
|
- * @param $status 审批状态
|
|
|
- * @param $remark 审批备注
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public static function approveMaintain($apply_id,$user_id,$status,$remark)
|
|
|
+ public static function get_with($list, $module, $status)
|
|
|
{
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $apply_info = MaintainInfo::where('id',$apply_id)->find()->toArray();
|
|
|
- $approve_info =MaintainApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->find();
|
|
|
- if(empty($approve_info)) throw new Exception('没有审核权限');
|
|
|
- if(!in_array($status,[2,3]))throw new Exception('审批状态错误');
|
|
|
- $approve_info = $approve_info->toArray();
|
|
|
- if($approve_info['status'] == 0) throw new Exception('请等待审核');
|
|
|
- if($approve_info['status'] != 1) throw new Exception('该记录已审核');
|
|
|
- if($apply_info['status'] != 1) throw new Exception('该记录已审核或已取消');
|
|
|
- $approve_update = [];
|
|
|
- $approve_update['status'] = $status;
|
|
|
- $approve_update['remark'] = $remark;
|
|
|
- $approve_update['approve_time'] = date('Y-m-d H:i:s');
|
|
|
- $approve_time = time() - strtotime($approve_info['start_time']);
|
|
|
- $approve_update['time'] = $approve_time;
|
|
|
- $approve_update['time_desc'] = get_stay_time($approve_time);
|
|
|
- MaintainApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->update($approve_update);// 更新审批记录
|
|
|
- $Info_up = [];
|
|
|
- // 审批流程数 + 1
|
|
|
- $Info_up['cur_num'] = $apply_info['cur_num'] + 1;
|
|
|
- if($approve_info['flow'] < $apply_info['approve_num']){
|
|
|
- // 更新下一级审批记录状态
|
|
|
- MaintainApprove::where(['info_id'=>$approve_info['info_id'],'flow'=>$approve_info['flow'] + 1,'approve_type'=>1])->update(['status'=>1,'start_time'=>date('Y-m-d H:i:s')]);
|
|
|
- if($status == 3) $Info_up['status'] = 3;
|
|
|
- } else if($approve_info['flow'] == $apply_info['approve_num']) {
|
|
|
- $Info_up['status'] = $status;
|
|
|
- }
|
|
|
- MaintainInfo::where('id',$apply_info['id'])->update($Info_up);// 更新申请状态
|
|
|
- Db::commit();
|
|
|
- }catch (\Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- static::$ret_val = false;
|
|
|
- static::$msg = $e->getMessage();
|
|
|
+ switch ($module) {
|
|
|
+ case CommonConstant::MODULE_5:
|
|
|
+ $list = $list->with(['peer_user' => function ($query) {
|
|
|
+ $query->field('id,info_id,name');
|
|
|
+ }, 'approve_info' => function ($query) use ($status) {
|
|
|
+ $query->field('id,info_id,status,approve_user')
|
|
|
+ ->where('status', $status)
|
|
|
+ ->with(['user' => function ($query) {
|
|
|
+ $query->field('userid,name');
|
|
|
+ }]);
|
|
|
+ }]);
|
|
|
+ break;
|
|
|
}
|
|
|
- return ['ret_val'=>static::$ret_val ,'msg'=>static::$msg];
|
|
|
+ return $list;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * 学校文件
|
|
|
- * @param $apply_id 申请记录id
|
|
|
- * @param $user_id 审批会员
|
|
|
- * @param $status 审批状态
|
|
|
- * @param $remark 审批备注
|
|
|
- * @return array
|
|
|
+ * 拼接查询字段
|
|
|
*/
|
|
|
- public static function approveDocument($apply_id,$user_id,$status,$remark)
|
|
|
+ public static function getAliasField($field, $aliasName)
|
|
|
{
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $apply_info =DocumentInfo::where('id',$apply_id)->find()->toArray();
|
|
|
- $approve_info =DocumentApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->find();
|
|
|
- if(empty($approve_info)) throw new Exception('没有审核权限');
|
|
|
- if(!in_array($status,[2,3]))throw new Exception('审批状态错误');
|
|
|
- $approve_info = $approve_info->toArray();
|
|
|
- if($approve_info['status'] == 0) throw new Exception('请等待审核');
|
|
|
- if($approve_info['status'] != 1) throw new Exception('该记录已审核');
|
|
|
- if($apply_info['status'] != 1) throw new Exception('该记录已审核或已取消');
|
|
|
- $approve_update = [];
|
|
|
- $approve_update['status'] = $status;
|
|
|
- $approve_update['remark'] = $remark;
|
|
|
- $approve_update['approve_time'] = date('Y-m-d H:i:s');
|
|
|
- $approve_time = time() - strtotime($approve_info['start_time']);
|
|
|
- $approve_update['time'] = $approve_time;
|
|
|
- $approve_update['time_desc'] = get_stay_time($approve_time);
|
|
|
- DocumentApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->update($approve_update);// 更新审批记录
|
|
|
- $Info_up = [];
|
|
|
- // 审批流程数 + 1
|
|
|
- $Info_up['cur_num'] = $apply_info['cur_num'] + 1;
|
|
|
- if($approve_info['flow'] < $apply_info['approve_num']){
|
|
|
- // 更新下一级审批记录状态
|
|
|
- DocumentApprove::where(['info_id'=>$approve_info['info_id'],'flow'=>$approve_info['flow'] + 1,'approve_type'=>1])->update(['status'=>1,'start_time'=>date('Y-m-d H:i:s')]);
|
|
|
- if($status == 3) $Info_up['status'] = 3;
|
|
|
- } else if($approve_info['flow'] == $apply_info['approve_num']) {
|
|
|
- $Info_up['status'] = $status;
|
|
|
- }
|
|
|
- DocumentInfo::where('id',$apply_info['id'])->update($Info_up);// 更新申请状态
|
|
|
- Db::commit();
|
|
|
- }catch (\Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- static::$ret_val = false;
|
|
|
- static::$msg = $e->getMessage();
|
|
|
+ $field = explode(',', $field);
|
|
|
+ foreach ($field as &$value) {
|
|
|
+ $value = $aliasName . $value;
|
|
|
}
|
|
|
- return ['ret_val'=>static::$ret_val ,'msg'=>static::$msg];
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 合同审批
|
|
|
- * @param $apply_id 申请记录id
|
|
|
- * @param $user_id 审批会员
|
|
|
- * @param $status 审批状态
|
|
|
- * @param $remark 审批备注
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public static function approveContract($apply_id,$user_id,$status,$remark)
|
|
|
- {
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $apply_info =ContractInfo::where('id',$apply_id)->find()->toArray();
|
|
|
- $approve_info =ContractApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->find();
|
|
|
- if(empty($approve_info)) throw new Exception('没有审核权限');
|
|
|
- if(!in_array($status,[2,3]))throw new Exception('审批状态错误');
|
|
|
- $approve_info = $approve_info->toArray();
|
|
|
- if($approve_info['status'] == 0) throw new Exception('请等待审核');
|
|
|
- if($approve_info['status'] != 1) throw new Exception('该记录已审核');
|
|
|
- if($apply_info['status'] != 1) throw new Exception('该记录已审核或已取消');
|
|
|
- $approve_update = [];
|
|
|
- $approve_update['status'] = $status;
|
|
|
- $approve_update['remark'] = $remark;
|
|
|
- $approve_update['approve_time'] = date('Y-m-d H:i:s');
|
|
|
- $approve_time = time() - strtotime($approve_info['start_time']);
|
|
|
- $approve_update['time'] = $approve_time;
|
|
|
- $approve_update['time_desc'] = get_stay_time($approve_time);
|
|
|
- ContractApprove::where('info_id',$apply_id)->where('approve_user',$user_id)->where('approve_type',1)->update($approve_update);// 更新审批记录
|
|
|
- $Info_up = [];
|
|
|
- // 审批流程数 + 1
|
|
|
- $Info_up['cur_num'] = $apply_info['cur_num'] + 1;
|
|
|
- if($approve_info['flow'] < $apply_info['approve_num']){
|
|
|
- // 更新下一级审批记录状态
|
|
|
- ContractApprove::where(['info_id'=>$approve_info['info_id'],'flow'=>$approve_info['flow'] + 1,'approve_type'=>1])->update(['status'=>1,'start_time'=>date('Y-m-d H:i:s')]);
|
|
|
- if($status == 3) $Info_up['status'] = 3;
|
|
|
- } else if($approve_info['flow'] == $apply_info['approve_num']) {
|
|
|
- $Info_up['status'] = $status;
|
|
|
- }
|
|
|
- ContractInfo::where('id',$apply_info['id'])->update($Info_up);// 更新申请状态
|
|
|
- Db::commit();
|
|
|
- }catch (\Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- static::$ret_val = false;
|
|
|
- static::$msg = $e->getMessage();
|
|
|
- }
|
|
|
- return ['ret_val'=>static::$ret_val ,'msg'=>static::$msg];
|
|
|
+ return $field;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|