作者 lyh

变更数据

@@ -11,6 +11,7 @@ namespace App\Console\Commands\Geo; @@ -11,6 +11,7 @@ namespace App\Console\Commands\Geo;
11 11
12 use App\Models\Geo\GeoQuestionLog; 12 use App\Models\Geo\GeoQuestionLog;
13 use App\Models\Geo\GeoQuestionResult; 13 use App\Models\Geo\GeoQuestionResult;
  14 +use App\Models\Project\Project;
14 use Illuminate\Console\Command; 15 use Illuminate\Console\Command;
15 use Illuminate\Support\Carbon; 16 use Illuminate\Support\Carbon;
16 use App\Models\Geo\GeoCount as GeoCountModel; 17 use App\Models\Geo\GeoCount as GeoCountModel;
@@ -61,18 +62,24 @@ class GeoCount extends Command @@ -61,18 +62,24 @@ class GeoCount extends Command
61 if(empty($project_id)){ 62 if(empty($project_id)){
62 return true; 63 return true;
63 } 64 }
  65 + $projectModel = new Project();
  66 + $geo_qualify_day = $projectModel->getValue(['id'=>$project_id],['geo_qualify_day']);
64 $geoQuestionResModel = new GeoQuestionResult(); 67 $geoQuestionResModel = new GeoQuestionResult();
65 $platforms = ['gemini','openai','deepseek','poe','perplexity','google_ai_overview','openai-not-network','claude']; 68 $platforms = ['gemini','openai','deepseek','poe','perplexity','google_ai_overview','openai-not-network','claude'];
66 foreach ($project_id as $item){ 69 foreach ($project_id as $item){
67 $this->output('执行的项目ID----'.$item); 70 $this->output('执行的项目ID----'.$item);
68 //收录总数 71 //收录总数
69 $total = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]); 72 $total = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]);
  73 + if($total > $geo_qualify_day){
  74 + $is_qualify = 1;
  75 + }
70 $data = [ 76 $data = [
71 'project_id' => $item, 77 'project_id' => $item,
72 'date' => $date, 78 'date' => $date,
73 'created_at' => Carbon::now()->format('Y-m-d H:i:s'), 79 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
74 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'), 80 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
75 'total'=>$total,//收录总数 81 'total'=>$total,//收录总数
  82 + 'is_qualify'=>$is_qualify,
76 ]; 83 ];
77 foreach ($platforms as $platform){ 84 foreach ($platforms as $platform){
78 if($platform == 'openai-not-network'){ 85 if($platform == 'openai-not-network'){
@@ -11,6 +11,7 @@ namespace App\Console\Commands\Geo; @@ -11,6 +11,7 @@ namespace App\Console\Commands\Geo;
11 11
12 use App\Models\Geo\GeoQuestionLog; 12 use App\Models\Geo\GeoQuestionLog;
13 use App\Models\Geo\GeoQuestionResult; 13 use App\Models\Geo\GeoQuestionResult;
  14 +use App\Models\Project\Project;
14 use Illuminate\Console\Command; 15 use Illuminate\Console\Command;
15 use Illuminate\Support\Carbon; 16 use Illuminate\Support\Carbon;
16 use App\Models\Geo\GeoCount as GeoCountModel; 17 use App\Models\Geo\GeoCount as GeoCountModel;
@@ -65,18 +66,24 @@ class GeoCountAll extends Command @@ -65,18 +66,24 @@ class GeoCountAll extends Command
65 if(empty($project_id)){ 66 if(empty($project_id)){
66 return true; 67 return true;
67 } 68 }
  69 + $projectModel = new Project();
  70 + $geo_qualify_day = $projectModel->getValue(['id'=>$project_id],['geo_qualify_day']);
68 $geoQuestionResModel = new GeoQuestionLog(); 71 $geoQuestionResModel = new GeoQuestionLog();
69 $platforms = ['gemini','openai','deepseek','poe','perplexity','google_ai_overview','openai-not-network','claude']; 72 $platforms = ['gemini','openai','deepseek','poe','perplexity','google_ai_overview','openai-not-network','claude'];
70 foreach ($project_id as $item){ 73 foreach ($project_id as $item){
71 $this->output('执行的项目ID----'.$item); 74 $this->output('执行的项目ID----'.$item);
72 //收录总数 75 //收录总数
73 $total = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]); 76 $total = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]);
  77 + if($total > $geo_qualify_day){
  78 + $is_qualify = 1;
  79 + }
74 $data = [ 80 $data = [
75 'project_id' => $item, 81 'project_id' => $item,
76 'date' => $date, 82 'date' => $date,
77 'created_at' => Carbon::now()->format('Y-m-d H:i:s'), 83 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
78 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'), 84 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
79 'total'=>$total,//收录总数 85 'total'=>$total,//收录总数
  86 + 'is_qualify'=>$is_qualify,
80 ]; 87 ];
81 foreach ($platforms as $platform){ 88 foreach ($platforms as $platform){
82 if($platform == 'openai-not-network'){ 89 if($platform == 'openai-not-network'){
@@ -123,10 +123,6 @@ class ProjectLogic extends BaseLogic @@ -123,10 +123,6 @@ class ProjectLogic extends BaseLogic
123 $info['collect_test_domain'] = $info['is_upgrade'] ? CollectLog::getCollectTestDomain($id) : ''; 123 $info['collect_test_domain'] = $info['is_upgrade'] ? CollectLog::getCollectTestDomain($id) : '';
124 //获取项目所属行业 124 //获取项目所属行业
125 $info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray(); 125 $info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
126 - $questionModel = new GeoQuestionResult();  
127 - $info['question_qualify_count'] = $questionModel->where('project_id', $id)  
128 - ->where('hit','!=',0)->whereIn('platform',['openai', 'gemini','google_ai_overview'])  
129 - ->count();  
130 return $this->success($info); 126 return $this->success($info);
131 } 127 }
132 128
@@ -101,6 +101,7 @@ class CountLogic extends BaseLogic @@ -101,6 +101,7 @@ class CountLogic extends BaseLogic
101 * @time :2023/5/24 14:03 101 * @time :2023/5/24 14:03
102 */ 102 */
103 public function keyword_data_count(){ 103 public function keyword_data_count(){
  104 + $version = $this->project['version'] ?? '';
104 $yesterday = date('Y-m-d'); 105 $yesterday = date('Y-m-d');
105 $rankDataModel = new RankDataModel(); 106 $rankDataModel = new RankDataModel();
106 $param = [ 107 $param = [