作者 lyh

变更数据

... ... @@ -11,6 +11,7 @@ namespace App\Console\Commands\LyhTest;
use App\Helper\OaGlobalsoApi;
use App\Models\Ai\AiBlog;
use App\Models\Geo\GeoLink;
use App\Models\News\News;
use App\Models\Product\Category;
use App\Models\Project\AggregateKeywordAffix;
... ... @@ -35,6 +36,7 @@ use App\Services\Geo\GeoService;
use App\Services\MidJourneyService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class lyhDemo extends Command
... ... @@ -57,6 +59,35 @@ class lyhDemo extends Command
return $this->translate_action();
}
public function _actionDa()
{
$geoLinkModel = new GeoLink();
$lists = $geoLinkModel->list(['da'=>0,'time'=>null]);
$geoService = new GeoService();
foreach ($lists as $info){
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{
return $this->success($info);
}
}else{
$host = $this->getDomainWithWWW($info['url']);
$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']]);
}
}
/**
* @remark :查看路由是否为空
* @name :_actionRoute
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Logic\Aside\Geo;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoLink;
use App\Services\Geo\GeoService;
use Illuminate\Support\Carbon;
/**
* @remark :geo权威新闻(链接数据)
... ... @@ -118,9 +119,9 @@ class GeoLinkLogic extends BaseLogic
}
$geoService = new GeoService();
if(!empty($info['time'])){
$date1 = new DateTime($info['time']);
$date2 = new DateTime(date('Y-m-d'));
$diff = $date1->diff($date2);
$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);
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Logic\Bside\SeoSetting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\SeoSetting\LinkData;
use App\Services\Geo\GeoService;
use Nette\Utils\DateTime;
/**
* @remark :获取外链数据
... ...