|
|
|
@ -423,20 +423,22 @@ class Customer extends ApiCommon
|
|
|
|
|
# 消息数据
|
|
|
|
|
$message = [];
|
|
|
|
|
|
|
|
|
|
# 获取公海规则数据
|
|
|
|
|
$customerPoolData = db('crm_customer_pool')->where('pool_id=' . $poolId)->column(['customer_type']);
|
|
|
|
|
$customerTypeArray = explode(',', $customerPoolData[0]);
|
|
|
|
|
|
|
|
|
|
# 获取客户数据
|
|
|
|
|
$customerData = [];
|
|
|
|
|
$customerList = db('crm_customer')->field(['customer_id', 'owner_user_id', 'name', 'crm_lthugd'])->whereIn('customer_id', $customerIds)->select();
|
|
|
|
|
foreach ($customerList as $key => $value) {
|
|
|
|
|
$customerData[$value['customer_id']] = $value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 获取公海规则数据
|
|
|
|
|
$customerPoolData = db('crm_customer_pool')->field(['customer_type'])->where('pool_id=' . $poolId)->find();
|
|
|
|
|
|
|
|
|
|
# 判断客户类型是否符合公海池客户类型
|
|
|
|
|
if (!in_array($customerData['crm_lthugd'], $customerPoolData)) {
|
|
|
|
|
$message[] = '客户类型与公海池类型不匹配!';
|
|
|
|
|
return resultArray(['error' => $message]);
|
|
|
|
|
foreach ($customerList as $key => $value) {
|
|
|
|
|
# 判断客户类型是否符合公海池客户类型
|
|
|
|
|
if (!in_array($value['crm_lthugd'], $customerTypeArray)) {
|
|
|
|
|
$message[] = '客户类型与公海池类型不匹配!';
|
|
|
|
|
return resultArray(['error' => $message]);
|
|
|
|
|
}
|
|
|
|
|
$customerData[$value['customer_id']] = $value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|