作者 赵彬吉
@@ -13,6 +13,7 @@ use App\Models\Geo\GeoQuestionLog; @@ -13,6 +13,7 @@ use App\Models\Geo\GeoQuestionLog;
13 use App\Models\Geo\GeoQuestionResult; 13 use App\Models\Geo\GeoQuestionResult;
14 use Illuminate\Console\Command; 14 use Illuminate\Console\Command;
15 use Illuminate\Support\Carbon; 15 use Illuminate\Support\Carbon;
  16 +use App\Models\Geo\GeoCount as GeoCountModel;
16 17
17 class GeoCount extends Command 18 class GeoCount extends Command
18 { 19 {
@@ -50,6 +51,7 @@ class GeoCount extends Command @@ -50,6 +51,7 @@ class GeoCount extends Command
50 */ 51 */
51 public function _action() 52 public function _action()
52 { 53 {
  54 + $geoCountModel = new GeoCountModel();
53 //获取前一天的项目id 55 //获取前一天的项目id
54 $date = Carbon::yesterday()->format('Y-m-d'); 56 $date = Carbon::yesterday()->format('Y-m-d');
55 $start = $date.' 00:00:00'; 57 $start = $date.' 00:00:00';
@@ -73,10 +75,14 @@ class GeoCount extends Command @@ -73,10 +75,14 @@ class GeoCount extends Command
73 'total'=>$total,//收录总数 75 'total'=>$total,//收录总数
74 ]; 76 ];
75 foreach ($platforms as $platform){ 77 foreach ($platforms as $platform){
76 - $data[$platform] = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'platform'=>$platform,'created_at' => ['between',[$start,$end]]]); 78 + if($item == 'openai-not-network'){
  79 + $data['openai_not_network'] = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'platform'=>$platform,'created_at' => ['between',[$start,$end]]]);
  80 + }else{
  81 + $data[$platform] = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'platform'=>$platform,'created_at' => ['between',[$start,$end]]]);
  82 + }
77 } 83 }
78 //新增一条数据 84 //新增一条数据
79 - $geoQuestionResModel->addReturnId($data); 85 + $geoCountModel->addReturnId($data);
80 } 86 }
81 return true; 87 return true;
82 } 88 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoCount.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/10/14 10:23
  8 + */
  9 +
  10 +namespace App\Models\Geo;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class GeoCount extends Base
  15 +{
  16 + protected $table = 'gl_geo_count';
  17 +}