正在显示
1 个修改的文件
包含
10 行增加
和
1 行删除
| @@ -177,6 +177,8 @@ class WebTrafficSpecial extends Command | @@ -177,6 +177,8 @@ class WebTrafficSpecial extends Command | ||
| 177 | public function handle() | 177 | public function handle() |
| 178 | { | 178 | { |
| 179 | try { | 179 | try { |
| 180 | + $this->sleep(); | ||
| 181 | + | ||
| 180 | $page = 1; | 182 | $page = 1; |
| 181 | while (true){ | 183 | while (true){ |
| 182 | $project_list = $this->getProjectList($page); | 184 | $project_list = $this->getProjectList($page); |
| @@ -281,6 +283,13 @@ class WebTrafficSpecial extends Command | @@ -281,6 +283,13 @@ class WebTrafficSpecial extends Command | ||
| 281 | } | 283 | } |
| 282 | 284 | ||
| 283 | /** | 285 | /** |
| 286 | + * 不同项目 休眠 | ||
| 287 | + */ | ||
| 288 | + protected function sleep(){ | ||
| 289 | + sleep(rand(5,480)); | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + /** | ||
| 284 | * 非俄语站的引流的项目 | 293 | * 非俄语站的引流的项目 |
| 285 | */ | 294 | */ |
| 286 | protected function getProjectList($page){ | 295 | protected function getProjectList($page){ |
| @@ -307,7 +316,7 @@ class WebTrafficSpecial extends Command | @@ -307,7 +316,7 @@ class WebTrafficSpecial extends Command | ||
| 307 | if(Cache::get('traffic_special_' . $project['project_id'])){ | 316 | if(Cache::get('traffic_special_' . $project['project_id'])){ |
| 308 | continue; | 317 | continue; |
| 309 | }else{ | 318 | }else{ |
| 310 | - $ttl = 24 * 60 * 60 / $this->projects[$project['project_id']] + sleep(rand(5,480)); | 319 | + $ttl = 24 * 60 * 60 / $this->projects[$project['project_id']]; |
| 311 | Cache::put('traffic_special_' . $project['project_id'], 1, $ttl); | 320 | Cache::put('traffic_special_' . $project['project_id'], 1, $ttl); |
| 312 | } | 321 | } |
| 313 | 322 |
-
请 注册 或 登录 后发表评论