Merge pull request 'bug fix' (#25) from zm into master

Reviewed-on: mengfucius/wkcrm#25
pull/40/head
张萌 2 years ago
commit 3a9b3fbb61

@ -176,26 +176,58 @@ 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'] ?: '';
@ -225,7 +257,9 @@ 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');
@ -243,7 +277,8 @@ 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))) . ',' : '';
} }
@ -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;

@ -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