合并分支 'akun' 到 'master'
Akun 查看合并请求 !3364
正在显示
1 个修改的文件
包含
43 行增加
和
0 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\Domain; | ||
| 4 | + | ||
| 5 | +use App\Models\Project\DeployOptimize; | ||
| 6 | +use Illuminate\Console\Command; | ||
| 7 | +use Illuminate\Support\Facades\Http; | ||
| 8 | + | ||
| 9 | +class ApiNoChecking extends Command | ||
| 10 | +{ | ||
| 11 | + /** | ||
| 12 | + * The name and signature of the console command. | ||
| 13 | + * | ||
| 14 | + * @var string | ||
| 15 | + */ | ||
| 16 | + protected $signature = 'api_no_checking'; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * The console command description. | ||
| 20 | + * | ||
| 21 | + * @var string | ||
| 22 | + */ | ||
| 23 | + protected $description = '每日检查项目api编号是否正在监控'; | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + public function handle() | ||
| 27 | + { | ||
| 28 | + $api_url = 'http://api.quanqiusou.cn/api/index/weblist?key=289c1fc81c89d79c04ed4fd72822948e'; | ||
| 29 | + | ||
| 30 | + $data = Http::timeout(60)->get($api_url)->json(); | ||
| 31 | + | ||
| 32 | + if (is_array($data) && $data) { | ||
| 33 | + $api_no_list = array_keys($data); | ||
| 34 | + if ($api_no_list) { | ||
| 35 | + DeployOptimize::update(['api_no_checking', 0]); | ||
| 36 | + | ||
| 37 | + DeployOptimize::whereIn('api_no', $api_no_list)->update(['api_no_checking', 1]); | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + return true; | ||
| 42 | + } | ||
| 43 | +} |
-
请 注册 或 登录 后发表评论