|
|
@ -116,6 +116,26 @@ class CustomerResources extends BaseModel |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取字典数据的辅助方法 |
|
|
|
|
|
* @param string $key |
|
|
|
|
|
* @return array |
|
|
|
|
|
*/ |
|
|
|
|
|
private function getDictionaryData($key) |
|
|
|
|
|
{ |
|
|
|
|
|
$dict = \think\facade\Db::table('school_sys_dict')->where('key', $key)->find(); |
|
|
|
|
|
$dictionary = []; |
|
|
|
|
|
if ($dict && !empty($dict['dictionary'])) { |
|
|
|
|
|
// 数据库中的字段是双层JSON编码,需要两次解码 |
|
|
|
|
|
$jsonString = json_decode($dict['dictionary'], true); |
|
|
|
|
|
if (is_string($jsonString)) { |
|
|
|
|
|
$dictionary = json_decode($jsonString, true) ?: []; |
|
|
|
|
|
} else { |
|
|
|
|
|
$dictionary = $jsonString ?: []; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return $dictionary; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 搜索器:客户资源联系电话 |
|
|
* 搜索器:客户资源联系电话 |
|
|
@ -184,8 +204,7 @@ class CustomerResources extends BaseModel |
|
|
$key = 'preliminarycustomerintention'; |
|
|
$key = 'preliminarycustomerintention'; |
|
|
$val = (String)$data['initial_intent']; |
|
|
$val = (String)$data['initial_intent']; |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
$dict = Dict::where('key',$key)->find(); |
|
|
$dictionary = $this->getDictionaryData($key); |
|
|
$dictionary = $dict['dictionary'] ?? []; |
|
|
|
|
|
// 查找匹配的 name |
|
|
// 查找匹配的 name |
|
|
$res = ''; |
|
|
$res = ''; |
|
|
foreach ($dictionary as $item) { |
|
|
foreach ($dictionary as $item) { |
|
|
@ -211,8 +230,18 @@ class CustomerResources extends BaseModel |
|
|
$key = 'SourceChannel'; |
|
|
$key = 'SourceChannel'; |
|
|
$val = (String)$data['source_channel']; |
|
|
$val = (String)$data['source_channel']; |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
$dict = Dict::where('key',$key)->find(); |
|
|
// 直接查询正确的表名 |
|
|
$dictionary = $dict['dictionary'] ?? []; |
|
|
$dict = \think\facade\Db::table('school_sys_dict')->where('key', $key)->find(); |
|
|
|
|
|
$dictionary = []; |
|
|
|
|
|
if ($dict && !empty($dict['dictionary'])) { |
|
|
|
|
|
// 数据库中的字段是双层JSON编码,需要两次解码 |
|
|
|
|
|
$jsonString = json_decode($dict['dictionary'], true); |
|
|
|
|
|
if (is_string($jsonString)) { |
|
|
|
|
|
$dictionary = json_decode($jsonString, true) ?: []; |
|
|
|
|
|
} else { |
|
|
|
|
|
$dictionary = $jsonString ?: []; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// 查找匹配的 name |
|
|
// 查找匹配的 name |
|
|
$res = ''; |
|
|
$res = ''; |
|
|
$arr = [ |
|
|
$arr = [ |
|
|
@ -245,8 +274,18 @@ class CustomerResources extends BaseModel |
|
|
$key = 'source'; |
|
|
$key = 'source'; |
|
|
$val = (String)$data['source']; |
|
|
$val = (String)$data['source']; |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
$dict = Dict::where('key',$key)->find(); |
|
|
// 直接查询正确的表名 |
|
|
$dictionary = $dict['dictionary'] ?? []; |
|
|
$dict = \think\facade\Db::table('school_sys_dict')->where('key', $key)->find(); |
|
|
|
|
|
$dictionary = []; |
|
|
|
|
|
if ($dict && !empty($dict['dictionary'])) { |
|
|
|
|
|
// 数据库中的字段是双层JSON编码,需要两次解码 |
|
|
|
|
|
$jsonString = json_decode($dict['dictionary'], true); |
|
|
|
|
|
if (is_string($jsonString)) { |
|
|
|
|
|
$dictionary = json_decode($jsonString, true) ?: []; |
|
|
|
|
|
} else { |
|
|
|
|
|
$dictionary = $jsonString ?: []; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// 查找匹配的 name |
|
|
// 查找匹配的 name |
|
|
$res = ''; |
|
|
$res = ''; |
|
|
foreach ($dictionary as $item) { |
|
|
foreach ($dictionary as $item) { |
|
|
@ -272,8 +311,7 @@ class CustomerResources extends BaseModel |
|
|
$key = 'zy_sex'; |
|
|
$key = 'zy_sex'; |
|
|
$val = (String)$data['gender']; |
|
|
$val = (String)$data['gender']; |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
$dict = Dict::where('key',$key)->find(); |
|
|
$dictionary = $this->getDictionaryData($key); |
|
|
$dictionary = $dict['dictionary'] ?? []; |
|
|
|
|
|
// 查找匹配的 name |
|
|
// 查找匹配的 name |
|
|
$res = ''; |
|
|
$res = ''; |
|
|
foreach ($dictionary as $item) { |
|
|
foreach ($dictionary as $item) { |
|
|
@ -299,8 +337,7 @@ class CustomerResources extends BaseModel |
|
|
$key = 'customer_purchasing_power'; |
|
|
$key = 'customer_purchasing_power'; |
|
|
$val = (String)$data['purchasing_power']; |
|
|
$val = (String)$data['purchasing_power']; |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
$dict = Dict::where('key',$key)->find(); |
|
|
$dictionary = $this->getDictionaryData($key); |
|
|
$dictionary = $dict['dictionary'] ?? []; |
|
|
|
|
|
// 查找匹配的 name |
|
|
// 查找匹配的 name |
|
|
$res = ''; |
|
|
$res = ''; |
|
|
foreach ($dictionary as $item) { |
|
|
foreach ($dictionary as $item) { |
|
|
@ -326,8 +363,7 @@ class CustomerResources extends BaseModel |
|
|
$key = 'kh_status'; |
|
|
$key = 'kh_status'; |
|
|
$val = (String)$data['status']; |
|
|
$val = (String)$data['status']; |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
$dict = Dict::where('key',$key)->find(); |
|
|
$dictionary = $this->getDictionaryData($key); |
|
|
$dictionary = $dict['dictionary'] ?? []; |
|
|
|
|
|
// 查找匹配的 name |
|
|
// 查找匹配的 name |
|
|
$res = ''; |
|
|
$res = ''; |
|
|
foreach ($dictionary as $item) { |
|
|
foreach ($dictionary as $item) { |
|
|
@ -353,8 +389,7 @@ class CustomerResources extends BaseModel |
|
|
$key = 'decision_maker'; |
|
|
$key = 'decision_maker'; |
|
|
$val = (String)$data['decision_maker'] ?? ''; |
|
|
$val = (String)$data['decision_maker'] ?? ''; |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
if ((!empty($val) || isset($val)) && $val !== '') { |
|
|
$dict = Dict::where('key',$key)->find(); |
|
|
$dictionary = $this->getDictionaryData($key); |
|
|
$dictionary = $dict['dictionary'] ?? []; |
|
|
|
|
|
// 查找匹配的 name |
|
|
// 查找匹配的 name |
|
|
$res = $val; |
|
|
$res = $val; |
|
|
foreach ($dictionary as $item) { |
|
|
foreach ($dictionary as $item) { |
|
|
|