合并分支 'lyh-server' 到 'master'
Lyh server 查看合并请求 !2931
正在显示
2 个修改的文件
包含
16 行增加
和
4 行删除
| @@ -122,10 +122,16 @@ class GeoLinkLogic extends BaseLogic | @@ -122,10 +122,16 @@ class GeoLinkLogic extends BaseLogic | ||
| 122 | $domainDaModel = new DomainDa(); | 122 | $domainDaModel = new DomainDa(); |
| 123 | $daInfo = $domainDaModel->read(['domain'=>$host]); | 123 | $daInfo = $domainDaModel->read(['domain'=>$host]); |
| 124 | if($daInfo !== false){ | 124 | if($daInfo !== false){ |
| 125 | + //判断时间是否大于60天 | ||
| 126 | + $start = Carbon::parse(date('Y-m-d', strtotime($daInfo['updated_at']))); | ||
| 127 | + $end = Carbon::parse(date('Y-m-d')); | ||
| 128 | + $diff = $start->diffInDays($end); | ||
| 129 | + if($diff <= 60){ | ||
| 125 | $info['da'] = $daInfo['da']; | 130 | $info['da'] = $daInfo['da']; |
| 126 | - $this->model->edit(['da'=>$daInfo['da']], ['id'=>$info['id']]); | 131 | + $this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); |
| 127 | return $this->success($info); | 132 | return $this->success($info); |
| 128 | } | 133 | } |
| 134 | + } | ||
| 129 | $geoService = new GeoService(); | 135 | $geoService = new GeoService(); |
| 130 | $result = $geoService->daResult($host); | 136 | $result = $geoService->daResult($host); |
| 131 | if(!isset($result['data']) || empty($result['data'])){ | 137 | if(!isset($result['data']) || empty($result['data'])){ |
| @@ -134,7 +140,7 @@ class GeoLinkLogic extends BaseLogic | @@ -134,7 +140,7 @@ class GeoLinkLogic extends BaseLogic | ||
| 134 | $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 | 140 | $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 |
| 135 | //保存数据 | 141 | //保存数据 |
| 136 | $domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]); | 142 | $domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]); |
| 137 | - $this->model->edit(['da'=>$info['da']], ['id'=>$info['id']]); | 143 | + $this->model->edit(['da'=>$info['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); |
| 138 | return $this->success($info); | 144 | return $this->success($info); |
| 139 | } | 145 | } |
| 140 | 146 |
| @@ -72,10 +72,16 @@ class LinkDataLogic extends BaseLogic | @@ -72,10 +72,16 @@ class LinkDataLogic extends BaseLogic | ||
| 72 | $domainDaModel = new DomainDa(); | 72 | $domainDaModel = new DomainDa(); |
| 73 | $daInfo = $domainDaModel->read(['domain'=>$host]); | 73 | $daInfo = $domainDaModel->read(['domain'=>$host]); |
| 74 | if($daInfo !== false){ | 74 | if($daInfo !== false){ |
| 75 | + //判断时间是否大于60天 | ||
| 76 | + $start = Carbon::parse(date('Y-m-d', strtotime($daInfo['updated_at']))); | ||
| 77 | + $end = Carbon::parse(date('Y-m-d')); | ||
| 78 | + $diff = $start->diffInDays($end); | ||
| 79 | + if($diff <= 60){ | ||
| 75 | $info['da'] = $daInfo['da']; | 80 | $info['da'] = $daInfo['da']; |
| 76 | - $this->model->edit(['da'=>$daInfo['da']], ['id'=>$info['id']]); | 81 | + $this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); |
| 77 | return $this->success($info); | 82 | return $this->success($info); |
| 78 | } | 83 | } |
| 84 | + } | ||
| 79 | $geoService = new GeoService(); | 85 | $geoService = new GeoService(); |
| 80 | $result = $geoService->daResult($host); | 86 | $result = $geoService->daResult($host); |
| 81 | if(!isset($result['data']) || empty($result['data'])){ | 87 | if(!isset($result['data']) || empty($result['data'])){ |
| @@ -84,7 +90,7 @@ class LinkDataLogic extends BaseLogic | @@ -84,7 +90,7 @@ class LinkDataLogic extends BaseLogic | ||
| 84 | $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 | 90 | $info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值 |
| 85 | //保存数据 | 91 | //保存数据 |
| 86 | $domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]); | 92 | $domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]); |
| 87 | - $this->model->edit(['da'=>$info['da']], ['id'=>$info['id']]); | 93 | + $this->model->edit(['da'=>$info['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); |
| 88 | return $this->success($info); | 94 | return $this->success($info); |
| 89 | } | 95 | } |
| 90 | 96 |
-
请 注册 或 登录 后发表评论