You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wkcrm/application/admin/model/ExamineStep.php

572 lines
26 KiB

4 years ago
<?php
// +----------------------------------------------------------------------
// | Description: 审批步骤
// +----------------------------------------------------------------------
// | Author: Michael_xu | gengxiaoxu@5kcrm.com
// +----------------------------------------------------------------------
namespace app\admin\model;
use think\Db;
use app\admin\model\Common;
use think\Request;
use think\Validate;
class ExamineStep extends Common
{
2 years ago
/**
4 years ago
* 为了数据库的整洁同时又不影响Model和Controller的名称
* 我们约定每个模块的数据表都加上相同的前缀比如CRM模块用crm作为数据表前缀
*/
2 years ago
protected $name = 'admin_examine_step';
4 years ago
/**
* 获取有效审批步骤列表
2 years ago
* @param flow_id 审批流程ID
* @param user_id 审批申请人ID
4 years ago
* @return
2 years ago
*/
4 years ago
public function getDataList($flow_id)
{
$userModel = new \app\admin\model\User();
$list = $this->where(['flow_id' => $flow_id])->order('order_id asc')->select();
2 years ago
foreach ($list as $k => $v) {
4 years ago
$list[$k]['user_id_info'] = $userModel->getListByStr($v['user_id']);
}
2 years ago
return $list ?: [];
}
4 years ago
2 years ago
/**
4 years ago
* 审批步骤(创建、编辑)
2 years ago
* @param flow_id 审批流程ID
4 years ago
* @param status 1负责人主管2指定用户任意一人3指定用户多人会签4上一级审批人主管
2 years ago
* @return
4 years ago
*/
public function createStepData($data, $flow_id)
{
2 years ago
if (!intval($flow_id)) {
$this->error = '审批流程创建失败';
return false;
}
4 years ago
//处理数据
$resSuccess = true;
$dataStep = [];
2 years ago
foreach ($data as $k => $v) {
if (!intval($v['status']) || (in_array($v['status'], [2, 3]) && !$v['user_id'])) {
4 years ago
$resSuccess = false;
}
$dataStep[$k]['relation'] = 1;
2 years ago
if (in_array($v['status'], [2, 3])) {
4 years ago
$dataStep[$k]['user_id'] = $v['user_id'] ? arrayToString($v['user_id']) : ''; //处理user_id
$dataStep[$k]['relation'] = ($v['status'] == 3) ? 1 : 2;
}
if ($v['step']) {
$dataStep[$k]['step_id'] = $v['step'];
}
2 years ago
$dataStep[$k]['order_id'] = $k + 1;
4 years ago
$dataStep[$k]['flow_id'] = $flow_id;
$dataStep[$k]['status'] = $v['status'];
2 years ago
$dataStep[$k]['create_time'] = time();
4 years ago
}
if ($resSuccess) {
//提交事务
$this->startTrans();
try {
$this->where(['flow_id' => $flow_id])->delete();
$this->saveAll($dataStep);
$this->commit();
2 years ago
return true;
} catch (\Exception $e) {
4 years ago
$this->error = '审批步骤创建失败';
$this->rollback();
return false;
2 years ago
}
4 years ago
} else {
$this->error = '参数错误';
2 years ago
return false;
}
4 years ago
}
2 years ago
/**
4 years ago
* 审批步骤(排序,防止位置情况造成排序错乱)
2 years ago
* @param flow_id 审批流程ID
* @return
*/
4 years ago
public function orderData($flow_id)
{
2 years ago
$step_list = db('admin_examine_step')->where(['flow_id' => $flow_id])->order('order_id')->select();
foreach ($step_list as $k => $v) {
$data = [];
$data = ['step_id' => $v['step_id'], 'order_id' => $k];
db('admin_examine_step')->update($data);
}
}
4 years ago
2 years ago
/**
4 years ago
* 下一审批人(审批是否结束)
2 years ago
* @param user_id 审批申请人ID
* @param flow_id 审批流ID
* @param types 关联对象
* @param types_id 联对象ID
* @param order_id 审批排序ID
4 years ago
* @param status 1负责人主管2指定用户任意一人3指定用户多人会签4上一级审批人主管
2 years ago
* @param check_user_id 当前审核人ID
*/
4 years ago
public function nextStepUser($user_id, $flow_id, $types, $types_id, $order_id, $check_user_id)
{
$res = nextCheckData($user_id, $flow_id, $types, $types_id, $order_id, $check_user_id);
2 years ago
return $res ?: [];
4 years ago
}
2 years ago
/**
4 years ago
* 审批步骤权限
2 years ago
* @param step_id 审批步骤ID
* @param user_id 审批人ID当前登录人
* @param create_user_id 申请人ID
* @param types 关联对象
* @param types_id 联对象ID
* @param status 1负责人主管2指定用户任意一人3指定用户多人会签4上一级审批人主管
* @return
*/
4 years ago
public function checkExamine($user_id, $types, $types_id)
{
$data = $this->getDataByTypes($types, $types_id);
$dataInfo = $data['dataInfo']; //审批主体信息
$stepInfo = $data['stepInfo']; //审批步骤信息
if (!$dataInfo) {
$this->error = '参数错误!';
2 years ago
return false;
4 years ago
}
2 years ago
if (in_array($dataInfo['check_status'], ['2', '3'])) {
4 years ago
$this->error = '审批已经结束!';
return false;
2 years ago
}
4 years ago
if ($dataInfo['flow_id'] > 0) {
//固定流程
//当前步骤已审批user_id
$check_user_ids = $this->getUserByCheck($types, $types_id, $dataInfo['order_id']);
if (in_array($user_id, $check_user_ids)) {
$this->error = '您已审核,请勿重复操作!';
2 years ago
return false;
4 years ago
}
$examine_user_id_arr = array();
// $examine_user_id_arr = $this->getUserByStep($stepInfo['step_id'], $dataInfo['create_user_id']); //获取审批步骤审批人
$examine_user_id_arr = $dataInfo['check_user_id']; //获取审批步骤审批人
$examine_user_id_arr = stringToArray($examine_user_id_arr);
} else {
$examine_user_id_arr = $this->getUserByPer($types);
}
2 years ago
if (!in_array($user_id, $examine_user_id_arr)) {
$this->error = '没有权限';
return false;
}
4 years ago
return true;
}
2 years ago
/**
4 years ago
* 审批对象获取审批相关信息
2 years ago
* @param types 关联对象
* @param types_id 联对象ID
* @return
*/
4 years ago
public function getDataByTypes($types, $types_id)
{
2 years ago
if (empty($types) || empty($types_id)) {
$this->error = '参数错误';
return false;
}
4 years ago
2 years ago
switch (trim($types)) {
case 'oa_examine' :
$dataInfo = db('oa_examine')->where(['examine_id' => intval($types_id)])->field('create_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'crm_contract' :
$dataInfo = db('crm_contract')->where(['contract_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'crm_receivables' :
$dataInfo = db('crm_receivables')->where(['receivables_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'crm_invoice':
$dataInfo = db('crm_invoice')->where(['invoice_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_purchase':
$dataInfo = db('jxc_purchase')->where(['purchase_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_retreat':
$dataInfo = db('jxc_retreat')->where(['retreat_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_sale':
$dataInfo = db('jxc_sale')->where(['sale_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_salereturn':
$dataInfo = db('jxc_salereturn')->where(['salereturn_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_payment':
$dataInfo = db('jxc_payment')->where(['payment_note_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_collection':
$dataInfo = db('jxc_collection')->where(['collection_note_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_inventory':
$dataInfo = db('jxc_inventory')->where(['inventory_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'jxc_allocation':
$dataInfo = db('jxc_allocation')->where(['allocation_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'crm_customer_check':
$dataInfo = db('crm_customer_check')->where(['customer_check_id' => intval($types_id)])->field('user_id,create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
case 'crm_business':
$dataInfo = db('crm_business')->where(['business_id' => intval($types_id)])->field('create_user_id,owner_user_id,check_user_id,flow_id,order_id,check_status,update_time')->find();
break;
3 years ago
}
4 years ago
$stepInfo = [];
2 years ago
if ($dataInfo['flow_id'] && !in_array($dataInfo['check_status'], ['5'])) {
4 years ago
//固定审批流
2 years ago
$stepInfo = db('admin_examine_step')->where(['flow_id' => $dataInfo['flow_id'], 'order_id' => $dataInfo['order_id']])->find();
}
if ($types=="crm_customer_check"){
$dataInfo['create_user_id']=$dataInfo['user_id'];
$dataInfo['owner_user_id']=$dataInfo['user_id'];
4 years ago
}
2 years ago
$data = [];
$data['stepInfo'] = $stepInfo;
$data['step_id'] = $stepInfo['step_id'] ?: '';
$data['dataInfo'] = $dataInfo;
return $data;
}
4 years ago
/**
* 获取审批步骤审批人信息
2 years ago
* @param step_id 审批步骤ID
* @param status 1负责人主管2指定用户任意一人3指定用户多人会签4上一级审批人主管
* @param user_id 审批主体申请人user_id
4 years ago
* @return
2 years ago
*/
4 years ago
public function getUserByStep($step_id, $user_id)
{
$stepInfo = db('admin_examine_step')->where(['step_id' => $step_id])->find();
$examine_user_id_arr = [];
//固定审批流
switch ($stepInfo['status']) {
case 1 :
$examine_user_id = db('admin_user')->where(['id' => $user_id])->value('parent_id');
if ($examine_user_id) {
$examine_user_id_arr[] = $examine_user_id;
} else {
$examine_user_id_arr[] = 1;
}
break;
2 years ago
case 2 :
case 3 :
$examine_user_id_arr = stringToArray($stepInfo['user_id']);
break;
case 4 :
$order_id = $stepInfo['order_id'] ? $stepInfo['order_id'] - 1 : 0;
$last_step_id = db('admin_examine_step')->where(['flow_id' => $stepInfo['flow_id'], 'order_id' => $order_id])->value('step_id');
4 years ago
$last_step_info = db('admin_examine_step')->where(['step_id' => $last_step_id])->find();
$last_user_id = $this->getUserByStep($last_step_id, $user_id);
if (count(stringToArray($last_user_id)) !== 1) {
$this->error = '审批流程出错';
return false;
}
$last_user_id_arr = stringToArray($last_user_id);
$examine_user_id = $this->getUserByStep($last_step_id, $last_user_id_arr[0]);
//$examine_user_id = db('admin_user')->where(['id' => $last_step_info['user_id']])->value('parent_id');
$examine_user_id_arr = [];
if ($examine_user_id) {
$examine_user_id_arr = stringToArray($examine_user_id);
2 years ago
}
4 years ago
break;
2 years ago
default :
$examine_user_id_arr = [];
4 years ago
}
2 years ago
return array_unique($examine_user_id_arr) ? ',' . implode(',', array_filter(array_unique($examine_user_id_arr))) . ',' : '';
}
4 years ago
/**
* 获取当前步骤已审批的user_id
2 years ago
* @param step_id 审批步骤ID
* @param status 1审核通过0审核失败2撤销
4 years ago
* @return
*/
public function getUserByCheck($types, $types_id = 0, $order_id = 0, $status = 1)
{
if ($types_id == 0 && $order_id == 0) {
$check_user_ids = [];
} else {
2 years ago
$check_user_ids = db('admin_examine_record')->where(['types' => $types, 'types_id' => $types_id, 'order_id' => $order_id, 'is_end' => 0, 'status' => $status])->column('check_user_id');
4 years ago
}
2 years ago
return $check_user_ids ?: [];
}
4 years ago
/**
* 获取授权审批的user_id
2 years ago
* @param step_id 审批步骤ID
* @param
4 years ago
* @return
2 years ago
*/
4 years ago
public function getUserByPer($types)
{
2 years ago
if (!in_array($types, ['oa_examine', 'crm_contract', 'crm_receivables'])) {
4 years ago
$this->error = '参数错误';
return false;
}
$userModel = new \app\admin\model\User();
$adminUserId = model('User')->getAdminId(); //管理员ID
//获取有审核权限的user_id
switch ($types) {
2 years ago
case 'oa_examine' :
$examine_user_id_arr = $userModel->getUserByPer('oa', 'examine', 'check');
break;
case 'crm_contract' :
$examine_user_id_arr = $userModel->getUserByPer('crm', 'contract', 'check');
break;
case 'crm_receivables' :
$examine_user_id_arr = $userModel->getUserByPer('crm', 'receivables', 'check');
break;
case 'crm_invoice' :
$examine_user_id_arr = $userModel->getUserByPer('crm', 'invoice', 'check');
break;
4 years ago
}
$examine_user_id_arr = $examine_user_id_arr ? array_merge($examine_user_id_arr, $adminUserId) : $adminUserId;
return $examine_user_id_arr;
2 years ago
}
4 years ago
/**
* 获取审批步骤相关userId
2 years ago
* @param flow_id 流程ID
* @param order_id 排序ID
4 years ago
* @return
*/
public function getStepUserByOrder($flow_id, $order_id, $user_id)
{
$user_ids = [];
if ($flow_id && $order_id) {
2 years ago
$stepInfo = db('admin_examine_step')->where(['flow_id' => $flow_id, 'order_id' => $order_id])->find();
4 years ago
$user_ids = $this->getUserByStep($stepInfo['step_id'], $user_id);
}
2 years ago
return $user_ids ?: [];
4 years ago
}
/**
* 获取有效审批步骤列表(固定审批)
2 years ago
* @param flow_id 审批流程ID
* @param user_id 审批申请人ID
* @param check_user_id 当前操作人ID
4 years ago
* @return
2 years ago
*/
4 years ago
public function getStepList($flow_id, $user_id, $types, $types_id = 0, $check_user_id = 0, $action = '', $category_id = '')
{
$userModel = new \app\admin\model\User();
$newlist = [];
2 years ago
4 years ago
$dataInfo['order_id'] = 0;
if ($types_id) {
$typesInfo = $this->getDataByTypes($types, $types_id);
$dataInfo = $typesInfo['dataInfo'];
}
$is_check = 0; //审批权限(1有)
$is_recheck = 0; //撤销审批权限(1有)
$admin_user_ids = $userModel->getAdminId();
//创建人或负责人或管理员有撤销权限
//if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id || in_array($check_user_id, $admin_user_ids)) {
if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id) {
2 years ago
if (!in_array($dataInfo['check_status'], ['2', '3', '4', '6'])) {
4 years ago
$is_recheck = 1;
}
}
2 years ago
if (in_array($check_user_id, stringToArray($dataInfo['check_user_id'])) && !in_array($dataInfo['check_status'], ['2', '3', '4', '6'])) {
4 years ago
$is_check = 1;
}
if ($action == 'view') {
$createUserInfo = $userModel->getUserById($dataInfo['create_user_id']);
$createUserInfo['check_time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
2 years ago
if ($dataInfo['check_status'] == 4 && $dataInfo['create_user_id'] != trim($dataInfo['check_status'], ',')) {
4 years ago
$createUserInfo['check_type'] = 2;
4 years ago
$newlist[1]['type'] = '2'; //撤销
$newlist[1]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5
$createUserInfo['check_type'] = 3;
$newlist[0]['type'] = '3'; //创建
$newlist[0]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5
$newlist[0]['user_id_info'] = array($createUserInfo);
$newlist[0]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
$newlist[1]['user_id_info'] = array($createUserInfo);
$newlist[1]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
2 years ago
} elseif ($dataInfo['check_status'] == 4 && $dataInfo['create_user_id'] == trim($dataInfo['check_status'], ',')) {
4 years ago
$createUserInfo['check_type'] = 3;
$newlist[0]['type'] = '3'; //创建
$newlist[0]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5
$createUserInfo['check_type'] = 2;
$newlist[1]['type'] = '2'; //撤销
$newlist[1]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5
$newlist[0]['user_id_info'] = array($createUserInfo);
$newlist[0]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
$newlist[1]['user_id_info'] = array($createUserInfo);
$newlist[1]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
4 years ago
} else {
$createUserInfo['check_type'] = 3;
$newlist[0]['type'] = '3'; //创建
4 years ago
$newlist[0]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5
4 years ago
$newlist[0]['user_id_info'] = array($createUserInfo);
$newlist[0]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
4 years ago
}
}
$stepList = [];
if ($dataInfo['check_status'] !== 4 || $action !== 'view') {
$list = db('admin_examine_step')->where(['flow_id' => $flow_id])->order('order_id asc')->select();
$is_break = false;
2 years ago
foreach ($list as $k => $v) {
4 years ago
$type = 4;
$examine_user_ids = '';
//判断步骤审批人是否存在
$examine_user_ids = $this->getUserByStep($v['step_id'], $user_id);
$examine_user_arr = stringToArray($examine_user_ids);
if ($examine_user_arr) {
$newStepInfo = $v;
$user_id_info_arr = [];
2 years ago
foreach ($examine_user_arr as $key => $val) {
4 years ago
$user_id_info = [];
$user_id_info = $userModel->getUserById($val);
$check_type = 4; //type 0失败1通过2撤销3创建4待审核5未提交
//当前步骤已审批user_id
$check_user_ids = [];
$check_user_ids = $this->getUserByCheck($types, $types_id, $v['order_id'], 1);
if (in_array($val, $check_user_ids)) {
$check_type = 1;
$type = !empty($dataInfo['check_user_id']) ? 4 : 1;
}
2 years ago
if (in_array($val, $check_user_ids) && $dataInfo['check_status'] == 2) {
4 years ago
$check_type = 1;
$type = 1;
}
4 years ago
$re_check_user_ids = $this->getUserByCheck($types, $types_id, $v['order_id'], 2); //撤销人员
if ($dataInfo['check_status'] == 4) {
if ($re_check_user_ids) {
$is_break = true;
$check_type = 2;
$type = 2;
}
}
$fail_check_user_ids = $this->getUserByCheck($types, $types_id, $v['order_id'], 0); //拒绝人员
if ($dataInfo['check_status'] == 3) {
2 years ago
if (in_array($val, $fail_check_user_ids)) {
4 years ago
$is_break = true;
$check_type = 0;
$type = 0;
}
//if ($action == 'view') break;
}
$user_id_info['check_type'] = $check_type;
$check_time = '';
2 years ago
$check_time = db('admin_examine_record')->where(['types' => $types, 'types_id' => $types_id, 'flow_id' => $flow_id, 'order_id' => $v['order_id'], 'check_user_id' => $val, 'is_end' => 0])->value('check_time');
4 years ago
$user_id_info['check_time'] = !empty($check_time) ? date('Y-m-d H:i:s', $check_time) : '';
$user_id_info_arr[] = $user_id_info;
}
$newStepInfo['user_id'] = $examine_user_ids;
$newStepInfo['user_id_info'] = $user_id_info_arr;
if ($dataInfo['order_id'] > $v['order_id']) {
$type = 1;
}
//if ($is_break !== false) break;
2 years ago
$newStepInfo['type'] = $type;
4 years ago
$stepList[] = $newStepInfo;
}
2 years ago
}
4 years ago
}
$newStepList = [];
if ($newlist && $stepList) {
$newStepList = array_merge($newlist, $stepList);
} elseif ($stepList) {
$newStepList = $stepList;
} else {
$newStepList = $newlist;
}
2 years ago
$data['steplist'] = $newStepList ?: [];
4 years ago
$data['is_check'] = $is_check;
$data['is_recheck'] = $is_recheck;
2 years ago
return $data ?: [];
4 years ago
}
/**
* 根据order_id获取审批步骤
2 years ago
* @param flow_id 审批流程ID
* @param order_id 审批排序ID
4 years ago
* @return
2 years ago
*/
4 years ago
public function getStepByOrder($flow_id, $order_id)
{
2 years ago
$data = db('admin_examine_step')->where(['flow_id' => $flow_id, 'order_id' => $order_id])->find();
return $data ?: [];
}
4 years ago
/**
* 获取有效审批步骤列表(自选审批)
2 years ago
* @param types 类型
* @param types_id 类型ID
* @param action 操作类型: view、save
4 years ago
* @return
2 years ago
*/
4 years ago
public function getPerStepList($types, $types_id, $user_id, $check_user_id, $action = '')
{
$examineRecordModel = new \app\admin\model\ExamineRecord();
$userModel = new \app\admin\model\User();
$userList = [];
//有效的审批记录
$where = [];
$where['types'] = $types;
$where['types_id'] = $types_id;
$where['is_end'] = 0;
$recordList = $examineRecordModel->getDataList($where);
$typeInfo = $this->getDataByTypes($types, $types_id);
$dataInfo = $typeInfo['dataInfo'];
//type 0失败1通过2撤销3创建4待审核5未提交
4 years ago
$i = 0;
2 years ago
if (empty($recordList)) {
4 years ago
$createUserInfo = $userModel->getUserById($dataInfo['create_user_id']);
$userList[0]['userInfo'] = $createUserInfo;
$userList[0]['type'] = 3; //创建
2 years ago
$userList[0]['time'] = $dataInfo['update_time'] ?: '';
} else {
foreach ($recordList as $k => $v) {
4 years ago
$userList[$i]['userInfo'] = $userModel->getUserById($v['check_user_id']);
$userList[$i]['type'] = $v['status'];
$userList[$i]['time'] = $v['check_time'];
$i++;
}
4 years ago
}
if ($dataInfo['check_status'] <= 1 && $dataInfo['check_user_id']) {
$check_user_id_arr = stringToArray($dataInfo['check_user_id']);
$userList[$i]['userInfo'] = $userModel->getUserById($check_user_id_arr[0]);
$userList[$i]['type'] = '4';
}
if ($dataInfo['check_status'] == 5 && $dataInfo['check_user_id']) {
$userList = [];
$check_user_id_arr = stringToArray($dataInfo['check_user_id']);
$userList[0]['userInfo'] = $userModel->getUserById($check_user_id_arr[0]);
$userList[0]['type'] = '5';
2 years ago
}
4 years ago
$is_check = 0; //审批权限(1有)
$is_recheck = 0; //撤销审批权限(1有)
$admin_user_ids = $userModel->getAdminId();
//创建人或负责人或管理员有撤销权限
// if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id || in_array($check_user_id, $admin_user_ids)) {
if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id) {
2 years ago
if (!in_array($dataInfo['check_status'], ['2', '3', '4', '5', '6'])) {
4 years ago
$is_recheck = 1;
}
}
2 years ago
if (in_array($check_user_id, stringToArray($dataInfo['check_user_id'])) && !in_array($dataInfo['check_status'], ['2', '3', '4', '5', '6'])) {
4 years ago
$is_check = 1;
}
$data['steplist'] = $userList;
$data['is_check'] = $is_check;
$data['is_recheck'] = $is_recheck;
2 years ago
return $data ?: [];
}
4 years ago
}