Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
4 个修改的文件
包含
65 行增加
和
2 行删除
| @@ -80,8 +80,11 @@ class UpdateRoute extends Command | @@ -80,8 +80,11 @@ class UpdateRoute extends Command | ||
| 80 | } | 80 | } |
| 81 | echo date('Y-m-d H:i:s').' 执行的项目id:'.$v.PHP_EOL; | 81 | echo date('Y-m-d H:i:s').' 执行的项目id:'.$v.PHP_EOL; |
| 82 | ProjectServer::useProject($v); | 82 | ProjectServer::useProject($v); |
| 83 | - $keywordModel = new Keyword(); | ||
| 84 | $bak_lists = DB::connection('custom_mysql')->table('gl_product_keyword_bak')->where('status',1)->get()->toArray(); | 83 | $bak_lists = DB::connection('custom_mysql')->table('gl_product_keyword_bak')->where('status',1)->get()->toArray(); |
| 84 | + $keywordModel = new Keyword(); | ||
| 85 | + $keywordModel->truncate(); | ||
| 86 | + $routeMapModel = new RouteMap(); | ||
| 87 | + $routeMapModel->del(['source'=>'product_keyword']); | ||
| 85 | foreach ($bak_lists as $bakV){ | 88 | foreach ($bak_lists as $bakV){ |
| 86 | $info = $keywordModel->read(['title'=>$bakV['title']],['id']); | 89 | $info = $keywordModel->read(['title'=>$bakV['title']],['id']); |
| 87 | if($info !== false){ | 90 | if($info !== false){ |
| @@ -235,4 +235,16 @@ class InquiryForwardController extends BaseController | @@ -235,4 +235,16 @@ class InquiryForwardController extends BaseController | ||
| 235 | 235 | ||
| 236 | $this->response('success'); | 236 | $this->response('success'); |
| 237 | } | 237 | } |
| 238 | + | ||
| 239 | + /** | ||
| 240 | + * 获取询盘统计 | ||
| 241 | + * @param InquiryForwardLogic $inquiryForwardLogic | ||
| 242 | + * @author Akun | ||
| 243 | + * @date 2025/04/14 11:41 | ||
| 244 | + */ | ||
| 245 | + public function getInquiryCount(InquiryForwardLogic $inquiryForwardLogic) | ||
| 246 | + { | ||
| 247 | + $data = $inquiryForwardLogic->inquiryCount(); | ||
| 248 | + $this->response('success', Code::SUCCESS, $data); | ||
| 249 | + } | ||
| 238 | } | 250 | } |
| @@ -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,51 @@ class InquiryForwardLogic extends BaseLogic | @@ -413,4 +413,51 @@ 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 | + $s_date = $start_date; | ||
| 437 | + while ($s_date <= $end_date) { | ||
| 438 | + $data[$s_date] = [ | ||
| 439 | + 'total' => 0, | ||
| 440 | + 'invalid' => 0, | ||
| 441 | + 'init' => 0 | ||
| 442 | + ]; | ||
| 443 | + $s_date = date('Y-m-d', strtotime($s_date . ' + 1 day')); | ||
| 444 | + } | ||
| 445 | + | ||
| 446 | + //统计数据赋值 | ||
| 447 | + $result = $this->model->list(['inquiry_date' => ['between', [$start_date, $end_date]]], 'id', ['status', 'inquiry_date'], 'asc'); | ||
| 448 | + foreach ($result as $value) { | ||
| 449 | + $inquiry_date = substr($value['inquiry_date'], 0, 10); | ||
| 450 | + $data[$inquiry_date]['total'] += 1; | ||
| 451 | + | ||
| 452 | + if ($value['status'] == InquiryInfo::STATUS_INVALID) { | ||
| 453 | + $data[$inquiry_date]['invalid'] += 1; | ||
| 454 | + } | ||
| 455 | + | ||
| 456 | + if ($value['status'] == InquiryInfo::STATUS_INIT) { | ||
| 457 | + $data[$inquiry_date]['init'] += 1; | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + return $this->success($data); | ||
| 462 | + } | ||
| 416 | } | 463 | } |
| @@ -370,6 +370,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -370,6 +370,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 370 | Route::any('/setInquiryExpired', [Aside\Optimize\InquiryForwardController::class, 'setInquiryExpired'])->name('admin.inquiry_forward_setInquiryExpired'); | 370 | Route::any('/setInquiryExpired', [Aside\Optimize\InquiryForwardController::class, 'setInquiryExpired'])->name('admin.inquiry_forward_setInquiryExpired'); |
| 371 | Route::any('/getInquiryDetailList', [Aside\Optimize\InquiryForwardController::class, 'getInquiryDetailList'])->name('admin.inquiry_forward_getInquiryDetailList'); | 371 | Route::any('/getInquiryDetailList', [Aside\Optimize\InquiryForwardController::class, 'getInquiryDetailList'])->name('admin.inquiry_forward_getInquiryDetailList'); |
| 372 | Route::any('/stopForwardInquiry', [Aside\Optimize\InquiryForwardController::class, 'stopForwardInquiry'])->name('admin.inquiry_forward_stopForwardInquiry'); | 372 | Route::any('/stopForwardInquiry', [Aside\Optimize\InquiryForwardController::class, 'stopForwardInquiry'])->name('admin.inquiry_forward_stopForwardInquiry'); |
| 373 | + Route::any('/getInquiryCount', [Aside\Optimize\InquiryForwardController::class, 'getInquiryCount'])->name('admin.inquiry_forward_getInquiryCount'); | ||
| 373 | }); | 374 | }); |
| 374 | 375 | ||
| 375 | Route::prefix('custom_module')->group(function () { | 376 | Route::prefix('custom_module')->group(function () { |
-
请 注册 或 登录 后发表评论