pull/25/head
张萌 2 years ago
parent d8cb282c9f
commit 80d1af3d0d

@ -29,10 +29,10 @@ class ExamineStep extends Common
{ {
$userModel = new \app\admin\model\User(); $userModel = new \app\admin\model\User();
$list = $this->where(['flow_id' => $flow_id])->order('order_id asc')->select(); $list = $this->where(['flow_id' => $flow_id])->order('order_id asc')->select();
foreach ($list as $k=>$v) { foreach ($list as $k => $v) {
$list[$k]['user_id_info'] = $userModel->getListByStr($v['user_id']); $list[$k]['user_id_info'] = $userModel->getListByStr($v['user_id']);
} }
return $list ? : []; return $list ?: [];
} }
/** /**
@ -50,19 +50,19 @@ class ExamineStep extends Common
//处理数据 //处理数据
$resSuccess = true; $resSuccess = true;
$dataStep = []; $dataStep = [];
foreach ($data as $k=>$v) { foreach ($data as $k => $v) {
if (!intval($v['status']) || (in_array($v['status'],[2,3]) && !$v['user_id'])) { if (!intval($v['status']) || (in_array($v['status'], [2, 3]) && !$v['user_id'])) {
$resSuccess = false; $resSuccess = false;
} }
$dataStep[$k]['relation'] = 1; $dataStep[$k]['relation'] = 1;
if (in_array($v['status'],[2,3])) { if (in_array($v['status'], [2, 3])) {
$dataStep[$k]['user_id'] = $v['user_id'] ? arrayToString($v['user_id']) : ''; //处理user_id $dataStep[$k]['user_id'] = $v['user_id'] ? arrayToString($v['user_id']) : ''; //处理user_id
$dataStep[$k]['relation'] = ($v['status'] == 3) ? 1 : 2; $dataStep[$k]['relation'] = ($v['status'] == 3) ? 1 : 2;
} }
if ($v['step']) { if ($v['step']) {
$dataStep[$k]['step_id'] = $v['step']; $dataStep[$k]['step_id'] = $v['step'];
} }
$dataStep[$k]['order_id'] = $k+1; $dataStep[$k]['order_id'] = $k + 1;
$dataStep[$k]['flow_id'] = $flow_id; $dataStep[$k]['flow_id'] = $flow_id;
$dataStep[$k]['status'] = $v['status']; $dataStep[$k]['status'] = $v['status'];
$dataStep[$k]['create_time'] = time(); $dataStep[$k]['create_time'] = time();
@ -75,7 +75,7 @@ class ExamineStep extends Common
$this->saveAll($dataStep); $this->saveAll($dataStep);
$this->commit(); $this->commit();
return true; return true;
} catch(\Exception $e) { } catch (\Exception $e) {
$this->error = '审批步骤创建失败'; $this->error = '审批步骤创建失败';
$this->rollback(); $this->rollback();
return false; return false;
@ -94,9 +94,9 @@ class ExamineStep extends Common
public function orderData($flow_id) public function orderData($flow_id)
{ {
$step_list = db('admin_examine_step')->where(['flow_id' => $flow_id])->order('order_id')->select(); $step_list = db('admin_examine_step')->where(['flow_id' => $flow_id])->order('order_id')->select();
foreach ($step_list as $k=>$v) { foreach ($step_list as $k => $v) {
$data = []; $data = [];
$data = ['step_id' => $v['step_id'],'order_id' => $k]; $data = ['step_id' => $v['step_id'], 'order_id' => $k];
db('admin_examine_step')->update($data); db('admin_examine_step')->update($data);
} }
} }
@ -114,7 +114,7 @@ class ExamineStep extends Common
public function nextStepUser($user_id, $flow_id, $types, $types_id, $order_id, $check_user_id) 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); $res = nextCheckData($user_id, $flow_id, $types, $types_id, $order_id, $check_user_id);
return $res ? : []; return $res ?: [];
} }
/** /**
@ -136,7 +136,7 @@ class ExamineStep extends Common
$this->error = '参数错误!'; $this->error = '参数错误!';
return false; return false;
} }
if (in_array($dataInfo['check_status'], ['2','3'])) { if (in_array($dataInfo['check_status'], ['2', '3'])) {
$this->error = '审批已经结束!'; $this->error = '审批已经结束!';
return false; return false;
} }
@ -176,29 +176,61 @@ class ExamineStep extends Common
} }
switch (trim($types)) { 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 'oa_examine' :
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; $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();
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; 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 'crm_contract' :
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; $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();
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; 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 'crm_receivables' :
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; $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();
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; 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 'crm_invoice':
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; $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();
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; break;
case 'crm_customer_check': $dataInfo = db('crm_customer_check')->where(['customer_check_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':
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; $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;
} }
$stepInfo = []; $stepInfo = [];
if ($dataInfo['flow_id'] && !in_array($dataInfo['check_status'],['5'])) { if ($dataInfo['flow_id'] && !in_array($dataInfo['check_status'], ['5'])) {
//固定审批流 //固定审批流
$stepInfo = db('admin_examine_step')->where(['flow_id' => $dataInfo['flow_id'],'order_id' => $dataInfo['order_id']])->find(); $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'];
} }
$data = []; $data = [];
$data['stepInfo'] = $stepInfo; $data['stepInfo'] = $stepInfo;
$data['step_id'] = $stepInfo['step_id'] ? : ''; $data['step_id'] = $stepInfo['step_id'] ?: '';
$data['dataInfo'] = $dataInfo; $data['dataInfo'] = $dataInfo;
return $data; return $data;
} }
@ -225,10 +257,12 @@ class ExamineStep extends Common
} }
break; break;
case 2 : case 2 :
case 3 :$examine_user_id_arr = stringToArray($stepInfo['user_id']); break; case 3 :
$examine_user_id_arr = stringToArray($stepInfo['user_id']);
break;
case 4 : case 4 :
$order_id = $stepInfo['order_id'] ? $stepInfo['order_id']-1 : 0; $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'); $last_step_id = db('admin_examine_step')->where(['flow_id' => $stepInfo['flow_id'], 'order_id' => $order_id])->value('step_id');
$last_step_info = db('admin_examine_step')->where(['step_id' => $last_step_id])->find(); $last_step_info = db('admin_examine_step')->where(['step_id' => $last_step_id])->find();
$last_user_id = $this->getUserByStep($last_step_id, $user_id); $last_user_id = $this->getUserByStep($last_step_id, $user_id);
if (count(stringToArray($last_user_id)) !== 1) { if (count(stringToArray($last_user_id)) !== 1) {
@ -243,9 +277,10 @@ class ExamineStep extends Common
$examine_user_id_arr = stringToArray($examine_user_id); $examine_user_id_arr = stringToArray($examine_user_id);
} }
break; break;
default : $examine_user_id_arr = []; default :
$examine_user_id_arr = [];
} }
return array_unique($examine_user_id_arr) ? ','.implode(',',array_filter(array_unique($examine_user_id_arr))).',' : ''; return array_unique($examine_user_id_arr) ? ',' . implode(',', array_filter(array_unique($examine_user_id_arr))) . ',' : '';
} }
/** /**
@ -259,9 +294,9 @@ class ExamineStep extends Common
if ($types_id == 0 && $order_id == 0) { if ($types_id == 0 && $order_id == 0) {
$check_user_ids = []; $check_user_ids = [];
} else { } else {
$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'); $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');
} }
return $check_user_ids ? : []; return $check_user_ids ?: [];
} }
/** /**
@ -272,7 +307,7 @@ class ExamineStep extends Common
*/ */
public function getUserByPer($types) public function getUserByPer($types)
{ {
if (!in_array($types,['oa_examine','crm_contract','crm_receivables'])) { if (!in_array($types, ['oa_examine', 'crm_contract', 'crm_receivables'])) {
$this->error = '参数错误'; $this->error = '参数错误';
return false; return false;
} }
@ -280,10 +315,18 @@ class ExamineStep extends Common
$adminUserId = model('User')->getAdminId(); //管理员ID $adminUserId = model('User')->getAdminId(); //管理员ID
//获取有审核权限的user_id //获取有审核权限的user_id
switch ($types) { switch ($types) {
case 'oa_examine' : $examine_user_id_arr = $userModel->getUserByPer('oa', 'examine', 'check'); break; case 'oa_examine' :
case 'crm_contract' : $examine_user_id_arr = $userModel->getUserByPer('crm', 'contract', 'check'); break; $examine_user_id_arr = $userModel->getUserByPer('oa', 'examine', 'check');
case 'crm_receivables' : $examine_user_id_arr = $userModel->getUserByPer('crm', 'receivables', 'check'); break; break;
case 'crm_invoice' : $examine_user_id_arr = $userModel->getUserByPer('crm', 'invoice', '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;
} }
$examine_user_id_arr = $examine_user_id_arr ? array_merge($examine_user_id_arr, $adminUserId) : $adminUserId; $examine_user_id_arr = $examine_user_id_arr ? array_merge($examine_user_id_arr, $adminUserId) : $adminUserId;
return $examine_user_id_arr; return $examine_user_id_arr;
@ -299,10 +342,10 @@ class ExamineStep extends Common
{ {
$user_ids = []; $user_ids = [];
if ($flow_id && $order_id) { if ($flow_id && $order_id) {
$stepInfo = db('admin_examine_step')->where(['flow_id' => $flow_id,'order_id' => $order_id])->find(); $stepInfo = db('admin_examine_step')->where(['flow_id' => $flow_id, 'order_id' => $order_id])->find();
$user_ids = $this->getUserByStep($stepInfo['step_id'], $user_id); $user_ids = $this->getUserByStep($stepInfo['step_id'], $user_id);
} }
return $user_ids ? : []; return $user_ids ?: [];
} }
/** /**
@ -330,11 +373,11 @@ class ExamineStep extends Common
//创建人或负责人或管理员有撤销权限 //创建人或负责人或管理员有撤销权限
//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 || in_array($check_user_id, $admin_user_ids)) {
if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id) { if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id) {
if (!in_array($dataInfo['check_status'],['2','3','4','6'])) { if (!in_array($dataInfo['check_status'], ['2', '3', '4', '6'])) {
$is_recheck = 1; $is_recheck = 1;
} }
} }
if (in_array($check_user_id, stringToArray($dataInfo['check_user_id'])) && !in_array($dataInfo['check_status'],['2','3','4','6'])) { if (in_array($check_user_id, stringToArray($dataInfo['check_user_id'])) && !in_array($dataInfo['check_status'], ['2', '3', '4', '6'])) {
$is_check = 1; $is_check = 1;
} }
@ -342,7 +385,7 @@ class ExamineStep extends Common
$createUserInfo = $userModel->getUserById($dataInfo['create_user_id']); $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; $createUserInfo['check_time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
if ($dataInfo['check_status'] == 4 && $dataInfo['create_user_id']!=trim( $dataInfo['check_status'], ',')) { if ($dataInfo['check_status'] == 4 && $dataInfo['create_user_id'] != trim($dataInfo['check_status'], ',')) {
$createUserInfo['check_type'] = 2; $createUserInfo['check_type'] = 2;
$newlist[1]['type'] = '2'; //撤销 $newlist[1]['type'] = '2'; //撤销
$newlist[1]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5 $newlist[1]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5
@ -353,7 +396,7 @@ class ExamineStep extends Common
$newlist[0]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null; $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]['user_id_info'] = array($createUserInfo);
$newlist[1]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null; $newlist[1]['time'] = !empty($dataInfo['update_time']) ? date('Y-m-d H:i:s', $dataInfo['update_time']) : null;
} elseif ($dataInfo['check_status'] == 4 && $dataInfo['create_user_id']==trim( $dataInfo['check_status'], ',')){ } elseif ($dataInfo['check_status'] == 4 && $dataInfo['create_user_id'] == trim($dataInfo['check_status'], ',')) {
$createUserInfo['check_type'] = 3; $createUserInfo['check_type'] = 3;
$newlist[0]['type'] = '3'; //创建 $newlist[0]['type'] = '3'; //创建
$newlist[0]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5 $newlist[0]['status'] = '5'; //创建前端要求给创建人加一个status字段定义为5
@ -376,7 +419,7 @@ class ExamineStep extends Common
if ($dataInfo['check_status'] !== 4 || $action !== 'view') { if ($dataInfo['check_status'] !== 4 || $action !== 'view') {
$list = db('admin_examine_step')->where(['flow_id' => $flow_id])->order('order_id asc')->select(); $list = db('admin_examine_step')->where(['flow_id' => $flow_id])->order('order_id asc')->select();
$is_break = false; $is_break = false;
foreach ($list as $k=>$v) { foreach ($list as $k => $v) {
$type = 4; $type = 4;
$examine_user_ids = ''; $examine_user_ids = '';
//判断步骤审批人是否存在 //判断步骤审批人是否存在
@ -385,7 +428,7 @@ class ExamineStep extends Common
if ($examine_user_arr) { if ($examine_user_arr) {
$newStepInfo = $v; $newStepInfo = $v;
$user_id_info_arr = []; $user_id_info_arr = [];
foreach ($examine_user_arr as $key=>$val) { foreach ($examine_user_arr as $key => $val) {
$user_id_info = []; $user_id_info = [];
$user_id_info = $userModel->getUserById($val); $user_id_info = $userModel->getUserById($val);
$check_type = 4; //type 0失败1通过2撤销3创建4待审核5未提交 $check_type = 4; //type 0失败1通过2撤销3创建4待审核5未提交
@ -396,7 +439,7 @@ class ExamineStep extends Common
$check_type = 1; $check_type = 1;
$type = !empty($dataInfo['check_user_id']) ? 4 : 1; $type = !empty($dataInfo['check_user_id']) ? 4 : 1;
} }
if(in_array($val, $check_user_ids) && $dataInfo['check_status'] == 2){ if (in_array($val, $check_user_ids) && $dataInfo['check_status'] == 2) {
$check_type = 1; $check_type = 1;
$type = 1; $type = 1;
} }
@ -410,7 +453,7 @@ class ExamineStep extends Common
} }
$fail_check_user_ids = $this->getUserByCheck($types, $types_id, $v['order_id'], 0); //拒绝人员 $fail_check_user_ids = $this->getUserByCheck($types, $types_id, $v['order_id'], 0); //拒绝人员
if ($dataInfo['check_status'] == 3) { if ($dataInfo['check_status'] == 3) {
if (in_array($val,$fail_check_user_ids)) { if (in_array($val, $fail_check_user_ids)) {
$is_break = true; $is_break = true;
$check_type = 0; $check_type = 0;
$type = 0; $type = 0;
@ -419,7 +462,7 @@ class ExamineStep extends Common
} }
$user_id_info['check_type'] = $check_type; $user_id_info['check_type'] = $check_type;
$check_time = ''; $check_time = '';
$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'); $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');
$user_id_info['check_time'] = !empty($check_time) ? date('Y-m-d H:i:s', $check_time) : ''; $user_id_info['check_time'] = !empty($check_time) ? date('Y-m-d H:i:s', $check_time) : '';
$user_id_info_arr[] = $user_id_info; $user_id_info_arr[] = $user_id_info;
} }
@ -442,10 +485,10 @@ class ExamineStep extends Common
} else { } else {
$newStepList = $newlist; $newStepList = $newlist;
} }
$data['steplist'] = $newStepList ? : []; $data['steplist'] = $newStepList ?: [];
$data['is_check'] = $is_check; $data['is_check'] = $is_check;
$data['is_recheck'] = $is_recheck; $data['is_recheck'] = $is_recheck;
return $data ? : []; return $data ?: [];
} }
/** /**
@ -456,8 +499,8 @@ class ExamineStep extends Common
*/ */
public function getStepByOrder($flow_id, $order_id) public function getStepByOrder($flow_id, $order_id)
{ {
$data = db('admin_examine_step')->where(['flow_id' => $flow_id,'order_id' => $order_id])->find(); $data = db('admin_examine_step')->where(['flow_id' => $flow_id, 'order_id' => $order_id])->find();
return $data ? : []; return $data ?: [];
} }
/** /**
@ -482,13 +525,13 @@ class ExamineStep extends Common
$dataInfo = $typeInfo['dataInfo']; $dataInfo = $typeInfo['dataInfo'];
//type 0失败1通过2撤销3创建4待审核5未提交 //type 0失败1通过2撤销3创建4待审核5未提交
$i = 0; $i = 0;
if(empty($recordList)){ if (empty($recordList)) {
$createUserInfo = $userModel->getUserById($dataInfo['create_user_id']); $createUserInfo = $userModel->getUserById($dataInfo['create_user_id']);
$userList[0]['userInfo'] = $createUserInfo; $userList[0]['userInfo'] = $createUserInfo;
$userList[0]['type'] = 3; //创建 $userList[0]['type'] = 3; //创建
$userList[0]['time'] = $dataInfo['update_time'] ? : ''; $userList[0]['time'] = $dataInfo['update_time'] ?: '';
}else{ } else {
foreach ($recordList as $k=>$v) { foreach ($recordList as $k => $v) {
$userList[$i]['userInfo'] = $userModel->getUserById($v['check_user_id']); $userList[$i]['userInfo'] = $userModel->getUserById($v['check_user_id']);
$userList[$i]['type'] = $v['status']; $userList[$i]['type'] = $v['status'];
$userList[$i]['time'] = $v['check_time']; $userList[$i]['time'] = $v['check_time'];
@ -513,17 +556,17 @@ class ExamineStep extends Common
//创建人或负责人或管理员有撤销权限 //创建人或负责人或管理员有撤销权限
// 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 || in_array($check_user_id, $admin_user_ids)) {
if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id) { if ($dataInfo['create_user_id'] == $check_user_id || $dataInfo['owner_user_id'] == $check_user_id) {
if (!in_array($dataInfo['check_status'],['2','3','4','5','6'])) { if (!in_array($dataInfo['check_status'], ['2', '3', '4', '5', '6'])) {
$is_recheck = 1; $is_recheck = 1;
} }
} }
if (in_array($check_user_id, stringToArray($dataInfo['check_user_id'])) && !in_array($dataInfo['check_status'],['2','3','4','5','6'])) { if (in_array($check_user_id, stringToArray($dataInfo['check_user_id'])) && !in_array($dataInfo['check_status'], ['2', '3', '4', '5', '6'])) {
$is_check = 1; $is_check = 1;
} }
$data['steplist'] = $userList; $data['steplist'] = $userList;
$data['is_check'] = $is_check; $data['is_check'] = $is_check;
$data['is_recheck'] = $is_recheck; $data['is_recheck'] = $is_recheck;
return $data ? : []; return $data ?: [];
} }
} }

@ -424,11 +424,11 @@ class CustomerPool extends ApiCommon
$customerCheckData['update_time'] = time(); $customerCheckData['update_time'] = time();
$customerCheckData['check_status'] = 1; //0待审核1审核通中2审核通过3审核未通过 $customerCheckData['check_status'] = 1; //0待审核1审核通中2审核通过3审核未通过
//权限判断 //权限判断
if (!$examineStepModel->checkExamine($user_id, 'crm_contract', $param['id'])) { if (!$examineStepModel->checkExamine($user_id, 'crm_customer_check', $param['id'])) {
return resultArray(['error' => $examineStepModel->getError()]); return resultArray(['error' => $examineStepModel->getError()]);
} }
//审批主体详情 //审批主体详情
$dataInfo = db('crm_customer_check')->where('customer_check_id', 'in', $param['customer_check_id'])->find(); $dataInfo = db('crm_customer_check')->where('customer_check_id', 'in', $param['id'])->find();
$flowInfo = $examineFlowModel->getDataById($dataInfo['flow_id']); $flowInfo = $examineFlowModel->getDataById($dataInfo['flow_id']);
$is_end = 0; // 1审批结束 $is_end = 0; // 1审批结束

Loading…
Cancel
Save