修改
This commit is contained in:
parent
6f1678b1d9
commit
a54769e075
|
|
@ -30,6 +30,7 @@ class Address
|
||||||
'addr' => $result['address'],
|
'addr' => $result['address'],
|
||||||
'name' => $result['name'],
|
'name' => $result['name'],
|
||||||
'mobile' => $result['phone'],
|
'mobile' => $result['phone'],
|
||||||
|
'ext' => $result['ext'],
|
||||||
'plan_time' => $result['datetime'],
|
'plan_time' => $result['datetime'],
|
||||||
];
|
];
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -39,6 +40,12 @@ class Address
|
||||||
} else {
|
} else {
|
||||||
$re['addr'] = $string;
|
$re['addr'] = $string;
|
||||||
}
|
}
|
||||||
|
$text = $re['mobile'];
|
||||||
|
preg_match('/.*?(\d{11})[^\d]{0,5}(\d{3,5})?/u', $text, $phoneMatches);
|
||||||
|
$phone = $phoneMatches[1] ?? null;
|
||||||
|
$ext = $phoneMatches[2] ?? null;
|
||||||
|
$re['mobile'] = $phone;
|
||||||
|
$re['ext'] = $ext;
|
||||||
$type = self::extractServiceTypes($string,$titles)[0] ?? '';
|
$type = self::extractServiceTypes($string,$titles)[0] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,6 +116,7 @@ class Address
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match('/\d{6}/', $string, $match);
|
preg_match('/\d{6}/', $string, $match);
|
||||||
|
// dd($match);
|
||||||
if ($match && $match[0]) {
|
if ($match && $match[0]) {
|
||||||
$compose['postcode'] = $match[0];
|
$compose['postcode'] = $match[0];
|
||||||
$string = str_replace($match[0], '', $string);
|
$string = str_replace($match[0], '', $string);
|
||||||
|
|
|
||||||
|
|
@ -34,18 +34,26 @@ class AppointmentParser
|
||||||
$timeRange = $this->match('/时间:([\d:]+)~[\d:]+/', $text);
|
$timeRange = $this->match('/时间:([\d:]+)~[\d:]+/', $text);
|
||||||
$datetime = $date && $timeRange ? "$date $timeRange" : null;
|
$datetime = $date && $timeRange ? "$date $timeRange" : null;
|
||||||
|
|
||||||
|
// 提取电话号码和分机号
|
||||||
|
$phoneMatches = [];
|
||||||
|
preg_match('/电话:.*?(\d{11})[^\d]{0,5}(\d{3,5})?/u', $text, $phoneMatches);
|
||||||
|
$phone = $phoneMatches[1] ?? null;
|
||||||
|
$ext = $phoneMatches[2] ?? null;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $this->match('/姓名:(.+)/u', $text),
|
'name' => $this->match('/姓名:(.+)/u', $text),
|
||||||
'phone' => $this->match('/电话:(\d{11})/', $text),
|
'phone' => $phone,
|
||||||
'address' => $this->match('/地址:(.+)/u', $text),
|
'ext' => $ext,
|
||||||
'date' => $date,
|
'address' => $this->match('/地址:(.+)/u', $text),
|
||||||
'time' => $timeRange,
|
'date' => $date,
|
||||||
|
'time' => $timeRange,
|
||||||
'datetime' => $datetime,
|
'datetime' => $datetime,
|
||||||
'project' => $this->match('/商品名称:(.+)/u', $text),
|
'project' => $this->match('/商品名称:(.+)/u', $text),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --- Format B ---
|
// --- Format B ---
|
||||||
private function isFormatB(string $text): bool
|
private function isFormatB(string $text): bool
|
||||||
{
|
{
|
||||||
|
|
@ -64,14 +72,21 @@ class AppointmentParser
|
||||||
$timeRange = $this->match('/预约时间:\d{4}-\d{2}-\d{2} ([\d:]+)-[\d:]+/', $text);
|
$timeRange = $this->match('/预约时间:\d{4}-\d{2}-\d{2} ([\d:]+)-[\d:]+/', $text);
|
||||||
$datetime = $date && $timeRange ? "$date $timeRange" : null;
|
$datetime = $date && $timeRange ? "$date $timeRange" : null;
|
||||||
|
|
||||||
|
// 提取电话号码和分机号
|
||||||
|
$phoneMatches = [];
|
||||||
|
preg_match('/联系电话:.*?(\d{11})(?:\D{0,5}(\d{3,5}))?/u', $text, $phoneMatches);
|
||||||
|
$phone = $phoneMatches[1] ?? null;
|
||||||
|
$ext = $phoneMatches[2] ?? null;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $this->match('/联系人:([^\n]+)/u', $text),
|
'name' => $this->match('/联系人:([^\n]+)/u', $text),
|
||||||
'phone' => $this->match('/联系电话:.*?(\d{11})/', $text),
|
'phone' => $phone,
|
||||||
'address' => $this->match('/预约地址:(.+)/u', $text),
|
'ext' => $ext,
|
||||||
'date' => $date,
|
'address' => $this->match('/预约地址:(.+)/u', $text),
|
||||||
'time' => $timeRange,
|
'date' => $date,
|
||||||
|
'time' => $timeRange,
|
||||||
'datetime' => $datetime,
|
'datetime' => $datetime,
|
||||||
'project' => $this->match('/预约项目:(.+)/u', $text),
|
'project' => $this->match('/预约项目:(.+)/u', $text),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -442,6 +442,7 @@ class Order extends Backend
|
||||||
$data['item']['item'] = $this->findElementByValue($this->itemsformattedTree, $data['item']['id'] ?? null);
|
$data['item']['item'] = $this->findElementByValue($this->itemsformattedTree, $data['item']['id'] ?? null);
|
||||||
}
|
}
|
||||||
preg_match('/\b(1[3-9]\d{9})\b/',$data['mobile'],$match);
|
preg_match('/\b(1[3-9]\d{9})\b/',$data['mobile'],$match);
|
||||||
|
// dd($data);
|
||||||
$data['mobile'] = $match[0] ?? $data['mobile'];
|
$data['mobile'] = $match[0] ?? $data['mobile'];
|
||||||
|
|
||||||
if ($data['addr'] && $data['addr']!=''){
|
if ($data['addr'] && $data['addr']!=''){
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
客户昵称: ${data.customer}
|
客户昵称: ${data.customer}
|
||||||
客户电话: ${data.tel}
|
客户电话: ${data.tel}
|
||||||
客户地址: ${data.address}
|
客户地址: ${data.address}
|
||||||
下单金额: ${data.receive_type === 1 ? '已收定金 ' + formatNumber(data.online_amount) : '已收全款 ' + formatNumber(data.online_amount)}
|
${data.receive_type === 1 ? '已收定金' : '已收全款'}
|
||||||
|
下单金额: ¥${formatNumber(data.online_amount)}
|
||||||
订单备注: ${data.remark || '无'}
|
订单备注: ${data.remark || '无'}
|
||||||
预约时间: ${data.plan_time || '无'}
|
预约时间: ${data.plan_time || '无'}
|
||||||
`;
|
`;
|
||||||
|
|
@ -45,7 +46,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
客户昵称: ${data.customer}
|
客户昵称: ${data.customer}
|
||||||
客户电话: ${data.tel}
|
客户电话: ${data.tel}
|
||||||
客户地址: ${data.address}
|
客户地址: ${data.address}
|
||||||
下单金额: ${data.receive_type === 1 ? '已收定金 ' + formatNumber(data.online_amount) : '已收全款 ' + formatNumber(data.online_amount)}
|
${data.receive_type === 1 ? '已收定金' : '已收全款'}
|
||||||
|
下单金额: ¥${formatNumber(data.online_amount)}
|
||||||
优惠活动: ${data.coupon?.description || '无'}
|
优惠活动: ${data.coupon?.description || '无'}
|
||||||
订单备注: ${data.remark ||'无'}
|
订单备注: ${data.remark ||'无'}
|
||||||
预约时间: ${data.plan_time || '无'}
|
预约时间: ${data.plan_time || '无'}
|
||||||
|
|
@ -550,9 +552,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
if (data.mobile !== '') {
|
if (data.mobile !== '') {
|
||||||
$('#c-tel').val(data.mobile);
|
$('#c-tel').val(data.mobile);
|
||||||
}
|
}
|
||||||
if (data.name !== '') {
|
// if (data.name !== '') {
|
||||||
$('#c-customer').val(data.name);
|
// $('#c-customer').val(data.name);
|
||||||
}
|
// }
|
||||||
if (data.item.id !== 0) {
|
if (data.item.id !== 0) {
|
||||||
$('#item_id_value').val(data.item.id);
|
$('#item_id_value').val(data.item.id);
|
||||||
$('#item_id').val(data.item.item);
|
$('#item_id').val(data.item.item);
|
||||||
|
|
@ -560,11 +562,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
if (data.idn) {
|
if (data.idn) {
|
||||||
$('#c-source-id').val(data.idn);
|
$('#c-source-id').val(data.idn);
|
||||||
}
|
}
|
||||||
// $city.citypicker({
|
|
||||||
// province: data.province,
|
|
||||||
// city: data.city,
|
|
||||||
// district: data.region
|
|
||||||
// });
|
|
||||||
if (data.area_id) {
|
if (data.area_id) {
|
||||||
$("#area_id").val(data.area_id);
|
$("#area_id").val(data.area_id);
|
||||||
}
|
}
|
||||||
|
|
@ -584,7 +581,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
$("#c-address").val(data.addr);
|
$("#c-address").val(data.addr);
|
||||||
$("#area_name").val(data.addr);
|
$("#area_name").val(data.addr);
|
||||||
}
|
}
|
||||||
Toastr.info('识别成功');
|
if (data.ext){
|
||||||
|
Toastr.error('该客户电话为分机号,请输入客户真实号码!');
|
||||||
|
|
||||||
|
}else {
|
||||||
|
Toastr.info('识别成功');
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user