作者 李宇航

合并分支 'lyh-server' 到 'master'

变更数据



查看合并请求 !2928
... ... @@ -10,6 +10,7 @@
namespace App\Http\Logic\Aside\Geo;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\DomainDa;
use App\Models\Geo\GeoLink;
use App\Services\Geo\GeoService;
use Illuminate\Support\Carbon;
... ... @@ -117,27 +118,23 @@ class GeoLinkLogic 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['url']);
$result = $geoService->daResult($host);
}else{
$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);
}
}else{
$host = $this->getDomainWithWWW($info['url']);
$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'] = (int)$result['data']['mozDA'];//获取数据中的da值
$this->model->edit(['time'=>date('Y-m-d'),'da'=>$info['da']], ['id'=>$info['id']]);
//保存数据
$domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]);
$this->model->edit(['da'=>$info['da']], ['id'=>$info['id']]);
return $this->success($result);
}
... ...
<?php
/**
* @remark :
* @name :DomainDa.php
* @author :lyh
* @method :post
* @time :2025/10/11 10:18
*/
namespace App\Models\Geo;
use App\Models\Base;
class DomainDa extends Base
{
protected $table = 'gl_domain_da';
}
... ...