|
...
|
...
|
@@ -149,7 +149,7 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
|
|
|
|
//获取国家
|
|
|
|
$country = $this->param['country'] ?? '';
|
|
|
|
if(!$country){
|
|
|
|
if (!$country) {
|
|
|
|
$country = file_get_contents("http://ip.globalso.com?ip=" . $this->param['ip']);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -413,4 +413,49 @@ class InquiryForwardLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取询盘统计数据
|
|
|
|
* @return array
|
|
|
|
* @author Akun
|
|
|
|
* @date 2025/04/14 11:42
|
|
|
|
*/
|
|
|
|
public function inquiryCount()
|
|
|
|
{
|
|
|
|
$start_date = isset($this->param['start_date']) && $this->param['start_date'] ? $this->param['start_date'] : date('Y-m-d', strtotime('-3 month'));
|
|
|
|
$end_date = isset($this->param['end_date']) && $this->param['end_date'] ? $this->param['end_date'] : date('Y-m-d');
|
|
|
|
|
|
|
|
//选择的时间跨度大于三个月,以开始时间为基准,只查询三个月的数据
|
|
|
|
$start_date_3_moth = date('Y-m-d', strtotime($start_date . ' + 3 month'));
|
|
|
|
if ($end_date > $start_date_3_moth) {
|
|
|
|
$end_date = $start_date_3_moth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//构建初始化数据
|
|
|
|
$data = [];
|
|
|
|
while ($start_date <= $end_date) {
|
|
|
|
$data[$start_date] = [
|
|
|
|
'total' => 0,
|
|
|
|
'invalid' => 0,
|
|
|
|
'init' => 0
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
//统计数据赋值
|
|
|
|
$result = $this->model->list(['inquiry_date' => ['between', [$start_date, $end_date]]], 'id', ['status', 'inquiry_date'], 'asc');
|
|
|
|
foreach ($result as $value) {
|
|
|
|
$inquiry_date = substr($value['inquiry_date'], 0, 10);
|
|
|
|
$data[$inquiry_date]['total'] += 1;
|
|
|
|
|
|
|
|
if ($value['status'] == InquiryInfo::STATUS_INVALID) {
|
|
|
|
$data[$inquiry_date]['invalid'] += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($value['status'] == InquiryInfo::STATUS_INIT) {
|
|
|
|
$data[$inquiry_date]['init'] += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|