|
|
@ -49,6 +49,7 @@ class Business extends Common
|
|
|
|
$businessTypeId = $request['typesId']; // 针对mobile
|
|
|
|
$businessTypeId = $request['typesId']; // 针对mobile
|
|
|
|
$businessStatusId = $request['statusId']; // 针对mobile
|
|
|
|
$businessStatusId = $request['statusId']; // 针对mobile
|
|
|
|
$overdue = $request['overdue']; // 待办事项下需联系商机(逾期)
|
|
|
|
$overdue = $request['overdue']; // 待办事项下需联系商机(逾期)
|
|
|
|
|
|
|
|
$isMessage = !empty($request['isMessage']);
|
|
|
|
unset($request['scene_id']);
|
|
|
|
unset($request['scene_id']);
|
|
|
|
unset($request['search']);
|
|
|
|
unset($request['search']);
|
|
|
|
unset($request['user_id']);
|
|
|
|
unset($request['user_id']);
|
|
|
@ -60,6 +61,7 @@ class Business extends Common
|
|
|
|
unset($request['typesId']);
|
|
|
|
unset($request['typesId']);
|
|
|
|
unset($request['statusId']);
|
|
|
|
unset($request['statusId']);
|
|
|
|
unset($request['overdue']);
|
|
|
|
unset($request['overdue']);
|
|
|
|
|
|
|
|
unset($request['isMessage']);
|
|
|
|
$request = $this->fmtRequest($request);
|
|
|
|
$request = $this->fmtRequest($request);
|
|
|
|
$requestMap = $request['map'] ?: [];
|
|
|
|
$requestMap = $request['map'] ?: [];
|
|
|
|
$sceneModel = new \app\admin\model\Scene();
|
|
|
|
$sceneModel = new \app\admin\model\Scene();
|
|
|
@ -126,6 +128,7 @@ class Business extends Common
|
|
|
|
$auth_user_ids = array_merge(array_unique(array_filter($auth_user_ids))) ?: ['-1'];
|
|
|
|
$auth_user_ids = array_merge(array_unique(array_filter($auth_user_ids))) ?: ['-1'];
|
|
|
|
$authMap['business.owner_user_id'] = array('in', $auth_user_ids);
|
|
|
|
$authMap['business.owner_user_id'] = array('in', $auth_user_ids);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (!$isMessage) {
|
|
|
|
$authMapData = [];
|
|
|
|
$authMapData = [];
|
|
|
|
$authMapData['auth_user_ids'] = $auth_user_ids;
|
|
|
|
$authMapData['auth_user_ids'] = $auth_user_ids;
|
|
|
|
$authMapData['user_id'] = $user_id;
|
|
|
|
$authMapData['user_id'] = $user_id;
|
|
|
@ -135,6 +138,7 @@ class Business extends Common
|
|
|
|
->whereOr('business.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%'));
|
|
|
|
->whereOr('business.rw_user_id', array('like', '%,' . $authMapData['user_id'] . ',%'));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//联系人商机
|
|
|
|
//联系人商机
|
|
|
|
if ($contacts_id) {
|
|
|
|
if ($contacts_id) {
|
|
|
@ -310,14 +314,14 @@ class Business extends Common
|
|
|
|
// 处理日期(date)类型
|
|
|
|
// 处理日期(date)类型
|
|
|
|
$dateField = $fieldModel->getFieldByFormType('crm_business', 'date');
|
|
|
|
$dateField = $fieldModel->getFieldByFormType('crm_business', 'date');
|
|
|
|
if (!empty($dateField)) {
|
|
|
|
if (!empty($dateField)) {
|
|
|
|
foreach ($param AS $key => $value) {
|
|
|
|
foreach ($param as $key => $value) {
|
|
|
|
if (in_array($key, $dateField) && empty($value)) $param[$key] = null;
|
|
|
|
if (in_array($key, $dateField) && empty($value)) $param[$key] = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 处理手写签名类型
|
|
|
|
// 处理手写签名类型
|
|
|
|
$handwritingField = $fieldModel->getFieldByFormType('crm_business', 'handwriting_sign');
|
|
|
|
$handwritingField = $fieldModel->getFieldByFormType('crm_business', 'handwriting_sign');
|
|
|
|
if (!empty($handwritingField)) {
|
|
|
|
if (!empty($handwritingField)) {
|
|
|
|
foreach ($param AS $key => $value) {
|
|
|
|
foreach ($param as $key => $value) {
|
|
|
|
if (in_array($key, $handwritingField)) {
|
|
|
|
if (in_array($key, $handwritingField)) {
|
|
|
|
$param[$key] = !empty($value['file_id']) ? $value['file_id'] : '';
|
|
|
|
$param[$key] = !empty($value['file_id']) ? $value['file_id'] : '';
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -328,7 +332,7 @@ class Business extends Common
|
|
|
|
$locationField = $fieldModel->getFieldByFormType($this->name, 'location');
|
|
|
|
$locationField = $fieldModel->getFieldByFormType($this->name, 'location');
|
|
|
|
$dateIntervalField = $fieldModel->getFieldByFormType($this->name, 'date_interval');
|
|
|
|
$dateIntervalField = $fieldModel->getFieldByFormType($this->name, 'date_interval');
|
|
|
|
$detailTableField = $fieldModel->getFieldByFormType($this->name, 'detail_table');
|
|
|
|
$detailTableField = $fieldModel->getFieldByFormType($this->name, 'detail_table');
|
|
|
|
foreach ($param AS $key => $value) {
|
|
|
|
foreach ($param as $key => $value) {
|
|
|
|
// 处理地址类型字段数据
|
|
|
|
// 处理地址类型字段数据
|
|
|
|
if (in_array($key, $positionField)) {
|
|
|
|
if (in_array($key, $positionField)) {
|
|
|
|
if (!empty($value)) {
|
|
|
|
if (!empty($value)) {
|
|
|
@ -480,14 +484,14 @@ class Business extends Common
|
|
|
|
// 处理日期(date)类型
|
|
|
|
// 处理日期(date)类型
|
|
|
|
$dateField = $fieldModel->getFieldByFormType('crm_business', 'date');
|
|
|
|
$dateField = $fieldModel->getFieldByFormType('crm_business', 'date');
|
|
|
|
if (!empty($dateField)) {
|
|
|
|
if (!empty($dateField)) {
|
|
|
|
foreach ($param AS $key => $value) {
|
|
|
|
foreach ($param as $key => $value) {
|
|
|
|
if (in_array($key, $dateField) && empty($value)) $param[$key] = null;
|
|
|
|
if (in_array($key, $dateField) && empty($value)) $param[$key] = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 处理手写签名类型
|
|
|
|
// 处理手写签名类型
|
|
|
|
$handwritingField = $fieldModel->getFieldByFormType('crm_business', 'handwriting_sign');
|
|
|
|
$handwritingField = $fieldModel->getFieldByFormType('crm_business', 'handwriting_sign');
|
|
|
|
if (!empty($handwritingField)) {
|
|
|
|
if (!empty($handwritingField)) {
|
|
|
|
foreach ($param AS $key => $value) {
|
|
|
|
foreach ($param as $key => $value) {
|
|
|
|
if (in_array($key, $handwritingField)) {
|
|
|
|
if (in_array($key, $handwritingField)) {
|
|
|
|
$param[$key] = !empty($value['file_id']) ? $value['file_id'] : '';
|
|
|
|
$param[$key] = !empty($value['file_id']) ? $value['file_id'] : '';
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -498,7 +502,7 @@ class Business extends Common
|
|
|
|
$locationField = $fieldModel->getFieldByFormType($this->name, 'location');
|
|
|
|
$locationField = $fieldModel->getFieldByFormType($this->name, 'location');
|
|
|
|
$dateIntervalField = $fieldModel->getFieldByFormType($this->name, 'date_interval');
|
|
|
|
$dateIntervalField = $fieldModel->getFieldByFormType($this->name, 'date_interval');
|
|
|
|
$detailTableField = $fieldModel->getFieldByFormType($this->name, 'detail_table');
|
|
|
|
$detailTableField = $fieldModel->getFieldByFormType($this->name, 'detail_table');
|
|
|
|
foreach ($param AS $key => $value) {
|
|
|
|
foreach ($param as $key => $value) {
|
|
|
|
// 处理地址类型字段数据
|
|
|
|
// 处理地址类型字段数据
|
|
|
|
if (in_array($key, $positionField)) {
|
|
|
|
if (in_array($key, $positionField)) {
|
|
|
|
if (!empty($value)) {
|
|
|
|
if (!empty($value)) {
|
|
|
@ -616,7 +620,7 @@ class Business extends Common
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($fieldGrant AS $key => $val){
|
|
|
|
foreach ($fieldGrant as $key => $val) {
|
|
|
|
//掩码相关类型字段
|
|
|
|
//掩码相关类型字段
|
|
|
|
if ($val['maskType'] != 0 && $val['form_type'] == 'mobile') {
|
|
|
|
if ($val['maskType'] != 0 && $val['form_type'] == 'mobile') {
|
|
|
|
$pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i";
|
|
|
|
$pattern = "/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i";
|
|
|
@ -665,7 +669,7 @@ class Business extends Common
|
|
|
|
if (!empty($userId)) {
|
|
|
|
if (!empty($userId)) {
|
|
|
|
$grantData = getFieldGrantData($userId);
|
|
|
|
$grantData = getFieldGrantData($userId);
|
|
|
|
$userLevel = isSuperAdministrators($userId);
|
|
|
|
$userLevel = isSuperAdministrators($userId);
|
|
|
|
foreach ($dataInfo AS $key => $value) {
|
|
|
|
foreach ($dataInfo as $key => $value) {
|
|
|
|
if (!$userLevel && !empty($grantData['crm_business'])) {
|
|
|
|
if (!$userLevel && !empty($grantData['crm_business'])) {
|
|
|
|
$status = getFieldGrantStatus($key, $grantData['crm_business']);
|
|
|
|
$status = getFieldGrantStatus($key, $grantData['crm_business']);
|
|
|
|
|
|
|
|
|
|
|
|