作者 周海龙

合并分支 'zhl' 到 'master'

添加通知和限制



查看合并请求 !1427
... ... @@ -11,6 +11,7 @@ use App\Models\Product\Keyword;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\RankData\RankData;
use App\Repositories\ToolRepository;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ... @@ -50,7 +51,7 @@ class SendKeyword extends Command
*/
public function handle()
{
$field = ['gl_project.id', 'gl_project.company', 'gl_project.main_lang_id', 'gl_project.is_upgrade', 'b.start_date', 'b.api_no', 'd.domain'];
$field = ['gl_project.id', 'gl_project.company', 'gl_project.main_lang_id', 'b.is_auto_keywords', 'b.start_date', 'b.api_no', 'd.domain'];
$projects = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
... ... @@ -65,6 +66,8 @@ class SendKeyword extends Command
$time = time();
$send_num = [30 => 1000, 60 => 3000, 90 => 6000];
foreach ($projects as $item) {
if (empty($item->is_auto_keywords))
continue;
if (empty($item->api_no)) {
$this->output('项目ID:' . $item->id . ', api_no为空;');
continue;
... ... @@ -96,6 +99,7 @@ class SendKeyword extends Command
DB::disconnect('custom_mysql');
// 数据成功后推送同志
if ($send) {
$item['day'] = $day;
$this->sendNotice($item);
}
}
... ... @@ -126,8 +130,10 @@ class SendKeyword extends Command
public function sendNotice($item)
{
$itme = $item->toArray();
try {
$query = http_build_query($item);
$url = 'http://api.quanqiusou.cn/google-rank/api/v6_add_extend_keywords.php';
app(ToolRepository::class)->curlRequest($url, $query);
// TODO 推送通知 待定
} catch (\Exception $e) {
$this->output('推送通知失败,项目ID:' . $item['id']);
... ...