|
...
|
...
|
@@ -73,7 +73,7 @@ class lyhDemo extends Command |
|
|
|
$host = $this->getDomainWithWWW($info['url']);
|
|
|
|
$result = $geoService->daResult($host);
|
|
|
|
}else{
|
|
|
|
return $this->success($info);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$host = $this->getDomainWithWWW($info['url']);
|
|
...
|
...
|
@@ -81,13 +81,29 @@ class lyhDemo extends Command |
|
|
|
}
|
|
|
|
if(!isset($result['data']) || empty($result['data'])){
|
|
|
|
$this->model->edit(['time'=>date('Y-m-d')], ['id'=>$info['id']]);
|
|
|
|
return $this->success($info);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值
|
|
|
|
$this->model->edit(['time'=>date('Y-m-d'),'da'=>$info['da']], ['id'=>$info['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDomainWithWWW($url) {
|
|
|
|
// 获取 host
|
|
|
|
$host = parse_url($url, PHP_URL_HOST);
|
|
|
|
// 去掉端口号等情况
|
|
|
|
$host = preg_replace('/:\d+$/', '', $host);
|
|
|
|
// 分割域名
|
|
|
|
$parts = explode('.', $host);
|
|
|
|
// 判断是几段
|
|
|
|
$count = count($parts);
|
|
|
|
// 如果只有两段,比如 fox8.com、theamericawatch.com,就拼接 www.
|
|
|
|
if ($count === 2) {
|
|
|
|
return 'www.' . $host;
|
|
|
|
}
|
|
|
|
return $host;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看路由是否为空
|
|
|
|
* @name :_actionRoute
|
...
|
...
|
|