作者 周海龙

合并分支 'zhl' 到 'master'

添加通知和限制



查看合并请求 !1427
@@ -11,6 +11,7 @@ use App\Models\Product\Keyword; @@ -11,6 +11,7 @@ use App\Models\Product\Keyword;
11 use App\Models\Project\OnlineCheck; 11 use App\Models\Project\OnlineCheck;
12 use App\Models\Project\Project; 12 use App\Models\Project\Project;
13 use App\Models\RankData\RankData; 13 use App\Models\RankData\RankData;
  14 +use App\Repositories\ToolRepository;
14 use App\Services\ProjectServer; 15 use App\Services\ProjectServer;
15 use Illuminate\Console\Command; 16 use Illuminate\Console\Command;
16 use Illuminate\Support\Facades\DB; 17 use Illuminate\Support\Facades\DB;
@@ -50,7 +51,7 @@ class SendKeyword extends Command @@ -50,7 +51,7 @@ class SendKeyword extends Command
50 */ 51 */
51 public function handle() 52 public function handle()
52 { 53 {
53 - $field = ['gl_project.id', 'gl_project.company', 'gl_project.main_lang_id', 'gl_project.is_upgrade', 'b.start_date', 'b.api_no', 'd.domain']; 54 + $field = ['gl_project.id', 'gl_project.company', 'gl_project.main_lang_id', 'b.is_auto_keywords', 'b.start_date', 'b.api_no', 'd.domain'];
54 $projects = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') 55 $projects = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
55 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') 56 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
56 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') 57 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
@@ -65,6 +66,8 @@ class SendKeyword extends Command @@ -65,6 +66,8 @@ class SendKeyword extends Command
65 $time = time(); 66 $time = time();
66 $send_num = [30 => 1000, 60 => 3000, 90 => 6000]; 67 $send_num = [30 => 1000, 60 => 3000, 90 => 6000];
67 foreach ($projects as $item) { 68 foreach ($projects as $item) {
  69 + if (empty($item->is_auto_keywords))
  70 + continue;
68 if (empty($item->api_no)) { 71 if (empty($item->api_no)) {
69 $this->output('项目ID:' . $item->id . ', api_no为空;'); 72 $this->output('项目ID:' . $item->id . ', api_no为空;');
70 continue; 73 continue;
@@ -96,6 +99,7 @@ class SendKeyword extends Command @@ -96,6 +99,7 @@ class SendKeyword extends Command
96 DB::disconnect('custom_mysql'); 99 DB::disconnect('custom_mysql');
97 // 数据成功后推送同志 100 // 数据成功后推送同志
98 if ($send) { 101 if ($send) {
  102 + $item['day'] = $day;
99 $this->sendNotice($item); 103 $this->sendNotice($item);
100 } 104 }
101 } 105 }
@@ -126,8 +130,10 @@ class SendKeyword extends Command @@ -126,8 +130,10 @@ class SendKeyword extends Command
126 130
127 public function sendNotice($item) 131 public function sendNotice($item)
128 { 132 {
129 - $itme = $item->toArray();  
130 try { 133 try {
  134 + $query = http_build_query($item);
  135 + $url = 'http://api.quanqiusou.cn/google-rank/api/v6_add_extend_keywords.php';
  136 + app(ToolRepository::class)->curlRequest($url, $query);
131 // TODO 推送通知 待定 137 // TODO 推送通知 待定
132 } catch (\Exception $e) { 138 } catch (\Exception $e) {
133 $this->output('推送通知失败,项目ID:' . $item['id']); 139 $this->output('推送通知失败,项目ID:' . $item['id']);