Merge branch 'develop' into feature/stock_next

This commit is contained in:
2025-09-02 09:47:12 +08:00
3 changed files with 26 additions and 17 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class CrmCustomer extends Model
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'sn', 'corp_abbr', 'user_id', 'user_sn', 'type', 'grade', 'sex', 'channel_id', 'country_id', 'car_type_id', 'magnitude', 'email', 'phone', 'WhatsApp', 'contacts', 'describe', 'desc_collect', 'address', 'lat', 'lng', 'follow_last', 'follow_next', 'warn', 'follow_remark', 'enter_user_id', 'created_at', 'updated_at', 'deleted_at'];
protected $fillable = ['id', 'sn', 'corp_id', 'user_id', 'user_sn', 'type', 'grade', 'sex', 'channel_id', 'country_id', 'car_type_id', 'magnitude', 'email', 'phone', 'WhatsApp', 'contacts', 'describe', 'desc_collect', 'address', 'lat', 'lng', 'follow_last', 'follow_next', 'warn', 'follow_remark', 'enter_user_id', 'created_at', 'updated_at', 'deleted_at'];
/**
* 不允许自动填充模型字段
+21 -15
View File
@@ -480,7 +480,7 @@ class Emails
// 同步客户
$crmCustomer = new CrmCustomer();
$crmCustomer->sn = $inquiryLogResult->order_no;
$crmCustomer->corp_abbr = $recipientInfo->corp_id;
$crmCustomer->corp_id = $recipientInfo->corp_id;
$crmCustomer->user_id = $assignedUid;
$crmCustomer->type = 1;
$crmCustomer->channel_id = $inquiryLogResult->channel;
@@ -497,22 +497,28 @@ class Emails
}
// 邮件模板
// $data = [
// 'order_no' => $inquiryLogResult->order_no,
// 'enter_user_id' => $enterUser->name,
// 'recipient' => $recipientInfo->name,
// 'quality' => (new \app\inquiry\service\InquiryLogService())->qualityName($inquiryLogResult->quality),
// 'channel' => $channelInfo->name,
// 'email' => $inquiryLogResult->email && $inquiryLogResult->email != '' ? $inquiryLogResult->email : ' - ',
// 'tel' => $inquiryLogResult->tel && $inquiryLogResult->tel != '' ? $inquiryLogResult->tel : ' - ',
// 'whatsapp' => $inquiryLogResult->whatsapp && $inquiryLogResult->whatsapp != '' ? $inquiryLogResult->whatsapp : ' - ',
// 'country' => $countryName,
// 'contacts' => $inquiryLogResult->contacts && $inquiryLogResult->contacts != '' ? $inquiryLogResult->contacts : ' - ',
// 'content' => $inquiryLogResult->content && $inquiryLogResult->content != '' ? $inquiryLogResult->content : ' - ',
// 'r_time' => $inquiryLogResult->r_time ? date('Y-m-d H:i:s', $inquiryLogResult->r_time) : ' - ',
// 't_time' => $inquiryLogResult->t_time ? date('Y-m-d H:i:s', $inquiryLogResult->t_time) : ' - '
// ];
// \app\common\utils\email\MailSend::send($recipientInfo->email, '【XYH】新的客户线索', replaceTpl($data));
// 9.2 修改消息发送
$data = [
'order_no' => $inquiryLogResult->order_no,
'enter_user_id' => $enterUser->name,
'recipient' => $recipientInfo->name,
'quality' => (new \app\inquiry\service\InquiryLogService())->qualityName($inquiryLogResult->quality),
'channel' => $channelInfo->name,
'email' => $inquiryLogResult->email && $inquiryLogResult->email != '' ? $inquiryLogResult->email : ' - ',
'tel' => $inquiryLogResult->tel && $inquiryLogResult->tel != '' ? $inquiryLogResult->tel : ' - ',
'whatsapp' => $inquiryLogResult->whatsapp && $inquiryLogResult->whatsapp != '' ? $inquiryLogResult->whatsapp : ' - ',
'country' => $countryName,
'contacts' => $inquiryLogResult->contacts && $inquiryLogResult->contacts != '' ? $inquiryLogResult->contacts : ' - ',
'content' => $inquiryLogResult->content && $inquiryLogResult->content != '' ? $inquiryLogResult->content : ' - ',
'r_time' => $inquiryLogResult->r_time ? date('Y-m-d H:i:s', $inquiryLogResult->r_time) : ' - ',
't_time' => $inquiryLogResult->t_time ? date('Y-m-d H:i:s', $inquiryLogResult->t_time) : ' - '
'id' => $inquiryLogResult->id
];
\app\common\utils\email\MailSend::send($recipientInfo->email, '【XYH】新的客户线索', replaceTpl($data));
\Webman\RedisQueue\Redis::send('inquiry-to-crm-new', $data);
// 更新状态
$record->update(['status' => 1]);
+4 -1
View File
@@ -358,7 +358,10 @@ class CustomerService
* 查询客户关系是否重复
*/
public function distinct($params,$corpId){
// 9.1 add 报重修正
if (!$params['email'] && !$params['phone'] && !$params['whatsApp']) {
return false;
}
$customer = Customer::where('corp_id',$corpId)
->where((function (Builder $query) use ($params) {
if(!empty($params['email']))