|
...
|
...
|
@@ -10,6 +10,7 @@ |
|
|
|
namespace App\Http\Logic\Bside\SeoSetting;
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Geo\DomainDa;
|
|
|
|
use App\Models\SeoSetting\LinkData;
|
|
|
|
use App\Services\Geo\GeoService;
|
|
|
|
use Illuminate\Support\Carbon;
|
|
...
|
...
|
@@ -67,28 +68,24 @@ class LinkDataLogic extends BaseLogic |
|
|
|
if($info === false){
|
|
|
|
$this->fail('当前数据不存在或者已被删除');
|
|
|
|
}
|
|
|
|
$geoService = new GeoService();
|
|
|
|
if(!empty($info['time'])){
|
|
|
|
$start = Carbon::parse($info['time']);
|
|
|
|
$end = Carbon::parse(date('Y-m-d'));
|
|
|
|
$diff = $start->diffInDays($end);
|
|
|
|
if($diff >= 60){
|
|
|
|
$host = $this->getDomainWithWWW($info['da_values']);
|
|
|
|
$result = $geoService->daResult($host);
|
|
|
|
}else{
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$host = $this->getDomainWithWWW($info['da_values']);
|
|
|
|
$result = $geoService->daResult($host);
|
|
|
|
$host = $this->getDomainWithWWW($info['url']);
|
|
|
|
$domainDaModel = new DomainDa();
|
|
|
|
$daInfo = $domainDaModel->read(['domain'=>$host]);
|
|
|
|
if($daInfo !== false){
|
|
|
|
$info['da'] = $daInfo['da'];
|
|
|
|
$this->model->edit(['da'=>$daInfo['da']], ['id'=>$info['id']]);
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
$geoService = new GeoService();
|
|
|
|
$result = $geoService->daResult($host);
|
|
|
|
if(!isset($result['data']) || empty($result['data'])){
|
|
|
|
$this->model->edit(['time'=>date('Y-m-d')], ['id'=>$info['id']]);
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
$info['da_values'] = (int)$result['data']['mozDA'];//获取数据中的da值
|
|
|
|
$this->model->edit(['time'=>date('Y-m-d'),'da_values'=>$info['da_values']], ['id'=>$info['id']]);
|
|
|
|
return $this->success($result);
|
|
|
|
$info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值
|
|
|
|
//保存数据
|
|
|
|
$domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]);
|
|
|
|
$this->model->edit(['da'=>$info['da']], ['id'=>$info['id']]);
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|