From 23d38c406f3e414076a06ff85c05d7e1e635d630 Mon Sep 17 00:00:00 2001 From: toogee Date: Fri, 22 May 2020 21:10:01 +0800 Subject: [PATCH] cy check --- app/admin/controller/Set.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/app/admin/controller/Set.php b/app/admin/controller/Set.php index 3730204..4605f5d 100644 --- a/app/admin/controller/Set.php +++ b/app/admin/controller/Set.php @@ -10,6 +10,7 @@ use app\admin\model\MailServer; use think\facade\Config; use think\exception\ValidateException; use taoler\com\Files; +use taoler\com\Api; class Set extends AdminController { @@ -134,24 +135,12 @@ class Set extends AdminController public function check($url) { $url = $url.'?u='.Request::domain(); - $ch =curl_init (); - curl_setopt($ch,CURLOPT_URL, $url); - curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 20); - curl_setopt($ch,CURLOPT_POST, 1); - $data = curl_exec($ch); - $httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE); - curl_close($ch); - if($httpCode == '200'){ - $cy = json_decode($data); - if($cy->code != 0){ - $cylevel = $cy->level; - return $cylevel; - } else { - return 0; - } + $cy = Api::urlGet($url); + if($cy->code != 0){ + $cylevel = $cy->level; + return $cylevel; } else { - return 0; + return 0; } }