|
|
|
@ -390,7 +390,6 @@ class Business extends ApiCommon
|
|
|
|
|
$userModel = new \app\admin\model\User();
|
|
|
|
|
$is_end = $param['is_end'] ?: 0; //1赢单2输单3无效
|
|
|
|
|
$remark = $param['statusRemark'];
|
|
|
|
|
$param['check_user_id'] = 1;// 临时测试需删除
|
|
|
|
|
unset($param['examineStatus']);
|
|
|
|
|
|
|
|
|
|
if (!$param['business_id']) {
|
|
|
|
@ -411,12 +410,12 @@ class Business extends ApiCommon
|
|
|
|
|
// 审核判断(是否有符合条件的审批流)
|
|
|
|
|
$examineFlowModel = new \app\admin\model\ExamineFlow();
|
|
|
|
|
if (!$examineFlowModel->checkExamine($userInfo['id'], 'crm_business')) {
|
|
|
|
|
return '暂无审批人,无法创建';
|
|
|
|
|
return resultArray(['error' => '暂无审批人,无法创建']);
|
|
|
|
|
}
|
|
|
|
|
//添加审批相关信息
|
|
|
|
|
$examineFlowData = $examineFlowModel->getFlowByTypes($userInfo['id'], 'crm_business');
|
|
|
|
|
if (!$examineFlowData) {
|
|
|
|
|
return '无可用审批流,请联系管理员';
|
|
|
|
|
return resultArray(['error' => '无可用审批流,请联系管理员']);
|
|
|
|
|
}
|
|
|
|
|
$data['flow_id'] = $examineFlowData['flow_id'];
|
|
|
|
|
//获取审批人信息
|
|
|
|
@ -430,7 +429,8 @@ class Business extends ApiCommon
|
|
|
|
|
$check_user_id = $param['check_user_id'] ? ',' . $param['check_user_id'] . ',' : '';
|
|
|
|
|
}
|
|
|
|
|
if (!$check_user_id) {
|
|
|
|
|
return '无可用审批人,请联系管理员';
|
|
|
|
|
|
|
|
|
|
return resultArray(['error' => '无可用审批人,请联系管理员']);
|
|
|
|
|
}
|
|
|
|
|
$data['check_user_id'] = is_array($check_user_id) ? ',' . implode(',', $check_user_id) . ',' : $check_user_id;
|
|
|
|
|
} else {
|
|
|
|
@ -456,7 +456,6 @@ class Business extends ApiCommon
|
|
|
|
|
$send_user_id
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 创建待办事项的关联数据
|
|
|
|
|
$checkUserIds = db('crm_business')->where('business_id', $param['business_id'])->value('check_user_id');
|
|
|
|
|
$checkUserIdArray = stringToArray($checkUserIds);
|
|
|
|
@ -703,8 +702,8 @@ class Business extends ApiCommon
|
|
|
|
|
}
|
|
|
|
|
//已审批人ID
|
|
|
|
|
$businessCheckData['flow_user_id'] = stringToArray($dataInfo['flow_user_id']) ? arrayToString(array_merge(stringToArray($dataInfo['flow_user_id']), [$user_id])) : arrayToString([$user_id]);
|
|
|
|
|
$resCustomerCheck = db('crm_business')->where(['business_id' => $param['id']])->update($businessCheckData);
|
|
|
|
|
if ($resCustomerCheck) {
|
|
|
|
|
$resBusiness = db('crm_business')->where(['business_id' => $param['id']])->update($businessCheckData);
|
|
|
|
|
if ($resBusiness) {
|
|
|
|
|
//审批记录
|
|
|
|
|
$resRecord = $examineRecordModel->createData($checkData);
|
|
|
|
|
//审核通过,修改相关信息
|
|
|
|
@ -726,10 +725,11 @@ class Business extends ApiCommon
|
|
|
|
|
$businessData['statusRemark'] = $dataInfo['submit_remark'];
|
|
|
|
|
|
|
|
|
|
$result = $this->advanceAfterCheck($businessData);
|
|
|
|
|
|
|
|
|
|
echo $result;
|
|
|
|
|
echo '\\n';
|
|
|
|
|
echo !empty($result);
|
|
|
|
|
if (!empty($result)) return resultArray(['error' => $result]);
|
|
|
|
|
|
|
|
|
|
return resultArray(['data' => '领取成功!']);
|
|
|
|
|
echo '12345';
|
|
|
|
|
} else {
|
|
|
|
|
if ($status) {
|
|
|
|
|
//发送站内信
|
|
|
|
@ -754,7 +754,8 @@ class Business extends ApiCommon
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return resultArray(['data' => '审批成功']);
|
|
|
|
|
echo '1234';
|
|
|
|
|
return resultArray(['success' => '审批成功']);
|
|
|
|
|
} else {
|
|
|
|
|
return resultArray(['error' => '审批失败,请重试!']);
|
|
|
|
|
}
|
|
|
|
@ -802,7 +803,7 @@ class Business extends ApiCommon
|
|
|
|
|
// }
|
|
|
|
|
$data['status_id'] = $status_id;
|
|
|
|
|
$data['status_time'] = time();
|
|
|
|
|
$data['submit_remark'] = $param['submit_remark'];
|
|
|
|
|
$data['remark'] = $param['submit_remark'];
|
|
|
|
|
$res = db('crm_business')->where(['business_id' => $param['business_id']])->update($data);
|
|
|
|
|
if (!$res) {
|
|
|
|
|
return resultArray(['error' => '推进失败,请重试']);
|
|
|
|
|