正在显示
1 个修改的文件
包含
15 行增加
和
18 行删除
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Http\Logic\Bside\SeoSetting; | 10 | namespace App\Http\Logic\Bside\SeoSetting; |
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | +use App\Models\Geo\DomainDa; | ||
| 13 | use App\Models\SeoSetting\LinkData; | 14 | use App\Models\SeoSetting\LinkData; |
| 14 | use App\Services\Geo\GeoService; | 15 | use App\Services\Geo\GeoService; |
| 15 | use Illuminate\Support\Carbon; | 16 | use Illuminate\Support\Carbon; |
| @@ -67,28 +68,24 @@ class LinkDataLogic extends BaseLogic | @@ -67,28 +68,24 @@ class LinkDataLogic extends BaseLogic | ||
| 67 | if($info === false){ | 68 | if($info === false){ |
| 68 | $this->fail('当前数据不存在或者已被删除'); | 69 | $this->fail('当前数据不存在或者已被删除'); |
| 69 | } | 70 | } |
| 70 | - $geoService = new GeoService(); | ||
| 71 | - if(!empty($info['time'])){ | ||
| 72 | - $start = Carbon::parse($info['time']); | ||
| 73 | - $end = Carbon::parse(date('Y-m-d')); | ||
| 74 | - $diff = $start->diffInDays($end); | ||
| 75 | - if($diff >= 60){ | ||
| 76 | - $host = $this->getDomainWithWWW($info['da_values']); | ||
| 77 | - $result = $geoService->daResult($host); | ||
| 78 | - }else{ | ||
| 79 | - return $this->success($info); | ||
| 80 | - } | ||
| 81 | - }else{ | ||
| 82 | - $host = $this->getDomainWithWWW($info['da_values']); | ||
| 83 | - $result = $geoService->daResult($host); | 71 | + $host = $this->getDomainWithWWW($info['url']); |
| 72 | + $domainDaModel = new DomainDa(); | ||
| 73 | + $daInfo = $domainDaModel->read(['domain'=>$host]); | ||
| 74 | + if($daInfo !== false){ | ||
| 75 | + $info['da'] = $daInfo['da']; | ||
| 76 | + $this->model->edit(['da'=>$daInfo['da']], ['id'=>$info['id']]); | ||
| 77 | + return $this->success($info); | ||
| 84 | } | 78 | } |
| 79 | + $geoService = new GeoService(); | ||
| 80 | + $result = $geoService->daResult($host); | ||
| 85 | if(!isset($result['data']) || empty($result['data'])){ | 81 | if(!isset($result['data']) || empty($result['data'])){ |
| 86 | - $this->model->edit(['time'=>date('Y-m-d')], ['id'=>$info['id']]); | ||
| 87 | return $this->success($info); | 82 | return $this->success($info); |
| 88 | } | 83 | } |
| 89 | - $info['da_values'] = (int)$result['data']['mozDA'];//获取数据中的da值 | ||
| 90 | - $this->model->edit(['time'=>date('Y-m-d'),'da_values'=>$info['da_values']], ['id'=>$info['id']]); | ||
| 91 | - return $this->success($result); | 84 | + $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 |
| 85 | + //保存数据 | ||
| 86 | + $domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]); | ||
| 87 | + $this->model->edit(['da'=>$info['da']], ['id'=>$info['id']]); | ||
| 88 | + return $this->success($info); | ||
| 92 | } | 89 | } |
| 93 | 90 | ||
| 94 | /** | 91 | /** |
-
请 注册 或 登录 后发表评论