合并分支 'lyh-server' 到 'master'
Lyh server 查看合并请求 !2917
正在显示
3 个修改的文件
包含
40 行增加
和
6 行删除
| @@ -11,6 +11,7 @@ namespace App\Console\Commands\LyhTest; | @@ -11,6 +11,7 @@ namespace App\Console\Commands\LyhTest; | ||
| 11 | 11 | ||
| 12 | use App\Helper\OaGlobalsoApi; | 12 | use App\Helper\OaGlobalsoApi; |
| 13 | use App\Models\Ai\AiBlog; | 13 | use App\Models\Ai\AiBlog; |
| 14 | +use App\Models\Geo\GeoLink; | ||
| 14 | use App\Models\News\News; | 15 | use App\Models\News\News; |
| 15 | use App\Models\Product\Category; | 16 | use App\Models\Product\Category; |
| 16 | use App\Models\Project\AggregateKeywordAffix; | 17 | use App\Models\Project\AggregateKeywordAffix; |
| @@ -35,6 +36,7 @@ use App\Services\Geo\GeoService; | @@ -35,6 +36,7 @@ use App\Services\Geo\GeoService; | ||
| 35 | use App\Services\MidJourneyService; | 36 | use App\Services\MidJourneyService; |
| 36 | use App\Services\ProjectServer; | 37 | use App\Services\ProjectServer; |
| 37 | use Illuminate\Console\Command; | 38 | use Illuminate\Console\Command; |
| 39 | +use Illuminate\Support\Carbon; | ||
| 38 | use Illuminate\Support\Facades\DB; | 40 | use Illuminate\Support\Facades\DB; |
| 39 | 41 | ||
| 40 | class lyhDemo extends Command | 42 | class lyhDemo extends Command |
| @@ -57,6 +59,35 @@ class lyhDemo extends Command | @@ -57,6 +59,35 @@ class lyhDemo extends Command | ||
| 57 | return $this->translate_action(); | 59 | return $this->translate_action(); |
| 58 | } | 60 | } |
| 59 | 61 | ||
| 62 | + public function _actionDa() | ||
| 63 | + { | ||
| 64 | + $geoLinkModel = new GeoLink(); | ||
| 65 | + $lists = $geoLinkModel->list(['da'=>0,'time'=>null]); | ||
| 66 | + $geoService = new GeoService(); | ||
| 67 | + foreach ($lists as $info){ | ||
| 68 | + if(!empty($info['time'])){ | ||
| 69 | + $start = Carbon::parse($info['time']); | ||
| 70 | + $end = Carbon::parse(date('Y-m-d')); | ||
| 71 | + $diff = $start->diffInDays($end); | ||
| 72 | + if($diff >= 60){ | ||
| 73 | + $host = $this->getDomainWithWWW($info['url']); | ||
| 74 | + $result = $geoService->daResult($host); | ||
| 75 | + }else{ | ||
| 76 | + return $this->success($info); | ||
| 77 | + } | ||
| 78 | + }else{ | ||
| 79 | + $host = $this->getDomainWithWWW($info['url']); | ||
| 80 | + $result = $geoService->daResult($host); | ||
| 81 | + } | ||
| 82 | + if(!isset($result['data']) || empty($result['data'])){ | ||
| 83 | + $this->model->edit(['time'=>date('Y-m-d')], ['id'=>$info['id']]); | ||
| 84 | + return $this->success($info); | ||
| 85 | + } | ||
| 86 | + $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 | ||
| 87 | + $this->model->edit(['time'=>date('Y-m-d'),'da'=>$info['da']], ['id'=>$info['id']]); | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 60 | /** | 91 | /** |
| 61 | * @remark :查看路由是否为空 | 92 | * @remark :查看路由是否为空 |
| 62 | * @name :_actionRoute | 93 | * @name :_actionRoute |
| @@ -12,6 +12,7 @@ namespace App\Http\Logic\Aside\Geo; | @@ -12,6 +12,7 @@ namespace App\Http\Logic\Aside\Geo; | ||
| 12 | use App\Http\Logic\Aside\BaseLogic; | 12 | use App\Http\Logic\Aside\BaseLogic; |
| 13 | use App\Models\Geo\GeoLink; | 13 | use App\Models\Geo\GeoLink; |
| 14 | use App\Services\Geo\GeoService; | 14 | use App\Services\Geo\GeoService; |
| 15 | +use Illuminate\Support\Carbon; | ||
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| 17 | * @remark :geo权威新闻(链接数据) | 18 | * @remark :geo权威新闻(链接数据) |
| @@ -118,9 +119,9 @@ class GeoLinkLogic extends BaseLogic | @@ -118,9 +119,9 @@ class GeoLinkLogic extends BaseLogic | ||
| 118 | } | 119 | } |
| 119 | $geoService = new GeoService(); | 120 | $geoService = new GeoService(); |
| 120 | if(!empty($info['time'])){ | 121 | if(!empty($info['time'])){ |
| 121 | - $date1 = new DateTime($info['time']); | ||
| 122 | - $date2 = new DateTime(date('Y-m-d')); | ||
| 123 | - $diff = $date1->diff($date2); | 122 | + $start = Carbon::parse($info['time']); |
| 123 | + $end = Carbon::parse(date('Y-m-d')); | ||
| 124 | + $diff = $start->diffInDays($end); | ||
| 124 | if($diff >= 60){ | 125 | if($diff >= 60){ |
| 125 | $host = $this->getDomainWithWWW($info['url']); | 126 | $host = $this->getDomainWithWWW($info['url']); |
| 126 | $result = $geoService->daResult($host); | 127 | $result = $geoService->daResult($host); |
| @@ -12,6 +12,8 @@ namespace App\Http\Logic\Bside\SeoSetting; | @@ -12,6 +12,8 @@ namespace App\Http\Logic\Bside\SeoSetting; | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\SeoSetting\LinkData; | 13 | use App\Models\SeoSetting\LinkData; |
| 14 | use App\Services\Geo\GeoService; | 14 | use App\Services\Geo\GeoService; |
| 15 | +use Illuminate\Support\Carbon; | ||
| 16 | +use Nette\Utils\DateTime; | ||
| 15 | 17 | ||
| 16 | /** | 18 | /** |
| 17 | * @remark :获取外链数据 | 19 | * @remark :获取外链数据 |
| @@ -67,9 +69,9 @@ class LinkDataLogic extends BaseLogic | @@ -67,9 +69,9 @@ class LinkDataLogic extends BaseLogic | ||
| 67 | } | 69 | } |
| 68 | $geoService = new GeoService(); | 70 | $geoService = new GeoService(); |
| 69 | if(!empty($info['time'])){ | 71 | if(!empty($info['time'])){ |
| 70 | - $date1 = new DateTime($info['time']); | ||
| 71 | - $date2 = new DateTime(date('Y-m-d')); | ||
| 72 | - $diff = $date1->diff($date2); | 72 | + $start = Carbon::parse($info['time']); |
| 73 | + $end = Carbon::parse(date('Y-m-d')); | ||
| 74 | + $diff = $start->diffInDays($end); | ||
| 73 | if($diff >= 60){ | 75 | if($diff >= 60){ |
| 74 | $host = $this->getDomainWithWWW($info['da_values']); | 76 | $host = $this->getDomainWithWWW($info['da_values']); |
| 75 | $result = $geoService->daResult($host); | 77 | $result = $geoService->daResult($host); |
-
请 注册 或 登录 后发表评论