|
...
|
...
|
@@ -14,6 +14,7 @@ use App\Models\Inquiry\InquiryProjectRoute; |
|
|
|
use App\Models\Inquiry\InquiryRelayAi;
|
|
|
|
use App\Models\Inquiry\InquiryRelayDetail;
|
|
|
|
use App\Models\Inquiry\InquiryRelayDetailLog;
|
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use Illuminate\Support\Arr;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Str;
|
|
...
|
...
|
@@ -139,16 +140,28 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
$this->fail('当前询盘状态无法转发');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_array($this->param['message'])) {
|
|
|
|
$message_list = $this->param['message'];
|
|
|
|
} else {
|
|
|
|
$message_list = [$this->param['message']];
|
|
|
|
}
|
|
|
|
$message_count = count($message_list);
|
|
|
|
if ($message_count == 0) {
|
|
|
|
$this->fail('内容不能为空');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_array($this->param['forward_url'])) {
|
|
|
|
$forward_url = $this->param['forward_url'];
|
|
|
|
} else {
|
|
|
|
$forward_url = explode(',', $this->param['forward_url']);
|
|
|
|
}
|
|
|
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
$num = 0;
|
|
|
|
$now = date('Y-m-d H:i:s');
|
|
|
|
if (is_array($this->param['forward_url'])) {
|
|
|
|
$forward_url = $this->param['forward_url'];
|
|
|
|
} else {
|
|
|
|
$forward_url = explode(',', $this->param['forward_url']);
|
|
|
|
}
|
|
|
|
foreach ($forward_url as $url) {
|
|
|
|
|
|
|
|
foreach ($forward_url as $key => $url) {
|
|
|
|
$url = trim($url);
|
|
|
|
$domain_array = parse_url($url);
|
|
|
|
$website = $domain_array['host'] ?? '';
|
|
...
|
...
|
@@ -217,7 +230,10 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
$start_at = $now;
|
|
|
|
}
|
|
|
|
|
|
|
|
InquiryRelayDetail::createInquiry($info['id'], $website, $country, $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $this->param['message'], $is_v6, json_encode([$url]), $start_at);
|
|
|
|
//获取询盘内容
|
|
|
|
$message = $message_list[$key % $message_count] ?? $message_list[0];
|
|
|
|
|
|
|
|
InquiryRelayDetail::createInquiry($info['id'], $website, $country, $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $message, $is_v6, json_encode([$url]), $start_at);
|
|
|
|
|
|
|
|
$num += 1;
|
|
|
|
}
|
|
...
|
...
|
@@ -315,7 +331,8 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
'route' => $vp->domain . $route,
|
|
|
|
'recent_inquiry' => $vp->recent_inquiry,
|
|
|
|
'remark' => $vp->remark ?: '',
|
|
|
|
'version' => $vp->version
|
|
|
|
'version' => $vp->version,
|
|
|
|
'type' => $type
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -421,6 +438,23 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
{
|
|
|
|
$model = new InquiryRelayDetail();
|
|
|
|
$lists = $model->listsWith($map, $page, $row, $order, $filed, 'desc', ['detailLog']);
|
|
|
|
|
|
|
|
//获取操作人
|
|
|
|
$inquiry_info_model = new InquiryInfo();
|
|
|
|
$manage_model = new Manage();
|
|
|
|
foreach ($lists['list'] as $k => $v) {
|
|
|
|
$operator_name = '';
|
|
|
|
$inquiry_info = $inquiry_info_model->read(['id' => $v['form_id']], ['operator_id']);
|
|
|
|
if ($inquiry_info) {
|
|
|
|
$manage_info = $manage_model->read(['id' => $inquiry_info['operator_id']], ['name']);
|
|
|
|
if ($manage_info) {
|
|
|
|
$operator_name = $manage_info['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$lists['list'][$k]['operator_name'] = $operator_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success($lists);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -467,7 +501,8 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
$data[$s_date] = [
|
|
|
|
'total' => 0,
|
|
|
|
'invalid' => 0,
|
|
|
|
'init' => 0
|
|
|
|
'init' => 0,
|
|
|
|
'finish' => 0
|
|
|
|
];
|
|
|
|
$s_date = date('Y-m-d', strtotime($s_date . ' + 1 day'));
|
|
|
|
}
|
|
...
|
...
|
@@ -480,10 +515,10 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
|
|
|
|
if ($value['status'] == InquiryInfo::STATUS_INVALID) {
|
|
|
|
$data[$inquiry_date]['invalid'] += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($value['status'] == InquiryInfo::STATUS_INIT) {
|
|
|
|
} elseif ($value['status'] == InquiryInfo::STATUS_INIT) {
|
|
|
|
$data[$inquiry_date]['init'] += 1;
|
|
|
|
} else {
|
|
|
|
$data[$inquiry_date]['finish'] += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|