|
|
|
@ -51,7 +51,7 @@ class CustomerResources extends BaseApiService |
|
|
|
{ |
|
|
|
|
|
|
|
$date = date('Y-m-d'); |
|
|
|
|
|
|
|
$param = $request->param(); |
|
|
|
$promised_visit_time = $request->param('promised_visit_time', ''); |
|
|
|
if ($promised_visit_time) { |
|
|
|
$promised_visit_time = date('Y-m-d H:i:s', strtotime($promised_visit_time)); |
|
|
|
@ -67,24 +67,24 @@ class CustomerResources extends BaseApiService |
|
|
|
->join(['school_campus_person_role' => 'b'], 'a.id = b.person_id', 'left') |
|
|
|
->where(['a.id' => $request->param('consultant', '')]) |
|
|
|
->value('b.role_id'); |
|
|
|
|
|
|
|
$customer_resources_data = [ |
|
|
|
"create_year_month" => date('Y-m'), |
|
|
|
"create_date" => $date, |
|
|
|
"source_channel" => $request->param('source_channel', ''), |
|
|
|
"source" => $request->param('source', ''), |
|
|
|
"consultant" => $request->param('consultant', ''), |
|
|
|
"name" => $request->param('name', ''), |
|
|
|
"age" => $request->param('age', ''), |
|
|
|
"gender" => $request->param('gender', ''), |
|
|
|
"phone_number" => $request->param('phone_number', ''), |
|
|
|
"demand" => $request->param('demand', ''), |
|
|
|
"decision_maker" => $request->param('decision_maker', ''), |
|
|
|
"initial_intent" => $request->param('initial_intent', ''), |
|
|
|
"status" => $request->param('status', ''), |
|
|
|
"purchasing_power" => $request->param('purchasing_power', ''), |
|
|
|
"cognitive_idea" => $request->param('cognitive_idea', ''), |
|
|
|
"source_channel" => $param['source_channel'] ?? '', |
|
|
|
"source" => $param['source'] ?? '', |
|
|
|
"consultant" => $param['consultant'] ?? 0, |
|
|
|
"name" => $param['name'] ?? '', |
|
|
|
"gender" => $param['gender'] ?? 'other',//性别 |
|
|
|
"phone_number" => $param['phone_number'] ?? '', |
|
|
|
"demand" => $param['demand'] ?? '', |
|
|
|
"decision_maker" => $param['decision_maker'] ?? 0, |
|
|
|
"initial_intent" => $param['initial_intent'] ?? 'low',//客户初步意向度 |
|
|
|
"status" => $param['status'] ?? 'pending',//客户状态 |
|
|
|
"purchasing_power" => $param['purchasing_power'], |
|
|
|
"cognitive_idea" => $param['cognitive_idea'], |
|
|
|
"optional_class_time" => $optional_class_time, |
|
|
|
"distance" => $request->param('distance', ''), |
|
|
|
"distance" => $param['distance'], |
|
|
|
// 新资源有2节体验课 |
|
|
|
"trial_class_count" => 2, |
|
|
|
"rf_type" => get_role_type($role_id), |
|
|
|
@ -104,19 +104,12 @@ class CustomerResources extends BaseApiService |
|
|
|
return fail("联系电话不能超过12位"); |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($six_speed_data as $k => $v) { |
|
|
|
if (!isset($v) || $v === '') { |
|
|
|
return fail("缺少必填项{$k}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//验证手机号是否存在 |
|
|
|
$info = (new CustomerResourcesService())->getInfo(['phone_number' => $customer_resources_data['phone_number']]); |
|
|
|
if (!empty($info['data']['id'])) { |
|
|
|
return fail("手机号已存在"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$res = (new CustomerResourcesService())->addData($customer_resources_data, $six_speed_data); |
|
|
|
if (!$res['code']) { |
|
|
|
return fail($res['msg']); |
|
|
|
@ -158,12 +151,12 @@ class CustomerResources extends BaseApiService |
|
|
|
"source" => $request->param('source', ''),//来源 |
|
|
|
"name" => $request->param('name', ''),//姓名 |
|
|
|
"age" => $request->param('age', ''),//年龄 |
|
|
|
"gender" => $request->param('gender', ''),//性别 |
|
|
|
"gender" => $request->param('gender', 'other'),//性别 |
|
|
|
"phone_number" => $request->param('phone_number', ''),//联系电话 |
|
|
|
"demand" => $request->param('demand', ''),//需求 |
|
|
|
"decision_maker" => $request->param('decision_maker', ''),//决策人 |
|
|
|
"initial_intent" => $request->param('initial_intent', ''),//客户初步意向度 |
|
|
|
"status" => $request->param('status', ''),//客户状态 |
|
|
|
"initial_intent" => $request->param('initial_intent', 'low'),//客户初步意向度 |
|
|
|
"status" => $request->param('status', 'pending'),//客户状态 |
|
|
|
"purchasing_power" => $request->param('purchasing_power', ''),//购买力 |
|
|
|
"cognitive_idea" => $request->param('cognitive_idea', ''),//认知理念 |
|
|
|
"optional_class_time" => $optional_class_time,//可选上课时间 |
|
|
|
@ -184,11 +177,6 @@ class CustomerResources extends BaseApiService |
|
|
|
"second_visit_status" => $request->param('second_visit_status', null),//二访情况 |
|
|
|
]; |
|
|
|
|
|
|
|
foreach ($customer_resources_data as $k => $v) { |
|
|
|
if (!isset($v) || $v === '') { |
|
|
|
return fail("缺少必填项{$k}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (strlen($customer_resources_data['phone_number']) > 12) { |
|
|
|
return fail("联系电话不能超过12位"); |
|
|
|
@ -204,9 +192,6 @@ class CustomerResources extends BaseApiService |
|
|
|
if (in_array($k, ['first_visit_status', 'second_visit_status'])) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (!isset($v) || $v === '') { |
|
|
|
return fail("缺少必填项{$k}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|