|
@@ -149,7 +149,7 @@ class InquiryForwardLogic extends BaseLogic |
|
@@ -149,7 +149,7 @@ class InquiryForwardLogic extends BaseLogic |
|
149
|
|
149
|
|
|
150
|
//获取国家
|
150
|
//获取国家
|
|
151
|
$country = $this->param['country'] ?? '';
|
151
|
$country = $this->param['country'] ?? '';
|
|
152
|
- if(!$country){
|
152
|
+ if (!$country) {
|
|
153
|
$country = file_get_contents("http://ip.globalso.com?ip=" . $this->param['ip']);
|
153
|
$country = file_get_contents("http://ip.globalso.com?ip=" . $this->param['ip']);
|
|
154
|
}
|
154
|
}
|
|
155
|
|
155
|
|
|
@@ -413,4 +413,49 @@ class InquiryForwardLogic extends BaseLogic |
|
@@ -413,4 +413,49 @@ class InquiryForwardLogic extends BaseLogic |
|
413
|
}
|
413
|
}
|
|
414
|
return $this->success();
|
414
|
return $this->success();
|
|
415
|
}
|
415
|
}
|
|
|
|
416
|
+
|
|
|
|
417
|
+ /**
|
|
|
|
418
|
+ * 获取询盘统计数据
|
|
|
|
419
|
+ * @return array
|
|
|
|
420
|
+ * @author Akun
|
|
|
|
421
|
+ * @date 2025/04/14 11:42
|
|
|
|
422
|
+ */
|
|
|
|
423
|
+ public function inquiryCount()
|
|
|
|
424
|
+ {
|
|
|
|
425
|
+ $start_date = isset($this->param['start_date']) && $this->param['start_date'] ? $this->param['start_date'] : date('Y-m-d', strtotime('-3 month'));
|
|
|
|
426
|
+ $end_date = isset($this->param['end_date']) && $this->param['end_date'] ? $this->param['end_date'] : date('Y-m-d');
|
|
|
|
427
|
+
|
|
|
|
428
|
+ //选择的时间跨度大于三个月,以开始时间为基准,只查询三个月的数据
|
|
|
|
429
|
+ $start_date_3_moth = date('Y-m-d', strtotime($start_date . ' + 3 month'));
|
|
|
|
430
|
+ if ($end_date > $start_date_3_moth) {
|
|
|
|
431
|
+ $end_date = $start_date_3_moth;
|
|
|
|
432
|
+ }
|
|
|
|
433
|
+
|
|
|
|
434
|
+ //构建初始化数据
|
|
|
|
435
|
+ $data = [];
|
|
|
|
436
|
+ while ($start_date <= $end_date) {
|
|
|
|
437
|
+ $data[$start_date] = [
|
|
|
|
438
|
+ 'total' => 0,
|
|
|
|
439
|
+ 'invalid' => 0,
|
|
|
|
440
|
+ 'init' => 0
|
|
|
|
441
|
+ ];
|
|
|
|
442
|
+ }
|
|
|
|
443
|
+
|
|
|
|
444
|
+ //统计数据赋值
|
|
|
|
445
|
+ $result = $this->model->list(['inquiry_date' => ['between', [$start_date, $end_date]]], 'id', ['status', 'inquiry_date'], 'asc');
|
|
|
|
446
|
+ foreach ($result as $value) {
|
|
|
|
447
|
+ $inquiry_date = substr($value['inquiry_date'], 0, 10);
|
|
|
|
448
|
+ $data[$inquiry_date]['total'] += 1;
|
|
|
|
449
|
+
|
|
|
|
450
|
+ if ($value['status'] == InquiryInfo::STATUS_INVALID) {
|
|
|
|
451
|
+ $data[$inquiry_date]['invalid'] += 1;
|
|
|
|
452
|
+ }
|
|
|
|
453
|
+
|
|
|
|
454
|
+ if ($value['status'] == InquiryInfo::STATUS_INIT) {
|
|
|
|
455
|
+ $data[$inquiry_date]['init'] += 1;
|
|
|
|
456
|
+ }
|
|
|
|
457
|
+ }
|
|
|
|
458
|
+
|
|
|
|
459
|
+ return $this->success($data);
|
|
|
|
460
|
+ }
|
|
416
|
} |
461
|
} |