合并分支 'lyh-server' 到 'master'
Lyh server 查看合并请求 !2931
正在显示
2 个修改的文件
包含
20 行增加
和
8 行删除
| @@ -122,9 +122,15 @@ class GeoLinkLogic extends BaseLogic | @@ -122,9 +122,15 @@ 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 | - $info['da'] = $daInfo['da']; | ||
| 126 | - $this->model->edit(['da'=>$daInfo['da']], ['id'=>$info['id']]); | ||
| 127 | - return $this->success($info); | 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){ | ||
| 130 | + $info['da'] = $daInfo['da']; | ||
| 131 | + $this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); | ||
| 132 | + return $this->success($info); | ||
| 133 | + } | ||
| 128 | } | 134 | } |
| 129 | $geoService = new GeoService(); | 135 | $geoService = new GeoService(); |
| 130 | $result = $geoService->daResult($host); | 136 | $result = $geoService->daResult($host); |
| @@ -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,9 +72,15 @@ class LinkDataLogic extends BaseLogic | @@ -72,9 +72,15 @@ 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 | - $info['da'] = $daInfo['da']; | ||
| 76 | - $this->model->edit(['da'=>$daInfo['da']], ['id'=>$info['id']]); | ||
| 77 | - return $this->success($info); | 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){ | ||
| 80 | + $info['da'] = $daInfo['da']; | ||
| 81 | + $this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]); | ||
| 82 | + return $this->success($info); | ||
| 83 | + } | ||
| 78 | } | 84 | } |
| 79 | $geoService = new GeoService(); | 85 | $geoService = new GeoService(); |
| 80 | $result = $geoService->daResult($host); | 86 | $result = $geoService->daResult($host); |
| @@ -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 |
-
请 注册 或 登录 后发表评论