正在显示
1 个修改的文件
包含
12 行增加
和
6 行删除
| @@ -35,9 +35,9 @@ class CountAllProject extends Command | @@ -35,9 +35,9 @@ class CountAllProject extends Command | ||
| 35 | 35 | ||
| 36 | public function handle(){ | 36 | public function handle(){ |
| 37 | AllProject::truncate(); | 37 | AllProject::truncate(); |
| 38 | - $noSixData = $this->NoSixProject(); | ||
| 39 | -// $sixData = $this->sixProject(); | ||
| 40 | - $data = array_merge($noSixData ?? [],$sixData ?? []); | 38 | + $noSixCount = $this->NoSixProject(); |
| 39 | + $sixCount = $this->sixProject(); | ||
| 40 | + $data = $noSixCount + $sixCount; | ||
| 41 | echo 'success:' .count($data) . PHP_EOL . date('Y-m-d H:i:s'); | 41 | echo 'success:' .count($data) . PHP_EOL . date('Y-m-d H:i:s'); |
| 42 | return true; | 42 | return true; |
| 43 | } | 43 | } |
| @@ -50,7 +50,7 @@ class CountAllProject extends Command | @@ -50,7 +50,7 @@ class CountAllProject extends Command | ||
| 50 | * @time :2024/11/11 15:21 | 50 | * @time :2024/11/11 15:21 |
| 51 | */ | 51 | */ |
| 52 | public function NoSixProject(){ | 52 | public function NoSixProject(){ |
| 53 | - $res_data = []; | 53 | + $count = 0; |
| 54 | $i = 1; | 54 | $i = 1; |
| 55 | while (true) { | 55 | while (true) { |
| 56 | $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=' . $i . '&pagesize=500'; | 56 | $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=' . $i . '&pagesize=500'; |
| @@ -77,6 +77,7 @@ class CountAllProject extends Command | @@ -77,6 +77,7 @@ class CountAllProject extends Command | ||
| 77 | $data[$k] = $v; | 77 | $data[$k] = $v; |
| 78 | } | 78 | } |
| 79 | echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL; | 79 | echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL; |
| 80 | + $count = $count + count($data); | ||
| 80 | $countAllModel = new AllProject; | 81 | $countAllModel = new AllProject; |
| 81 | $countAllModel->insert($data); | 82 | $countAllModel->insert($data); |
| 82 | $i++; | 83 | $i++; |
| @@ -88,7 +89,7 @@ class CountAllProject extends Command | @@ -88,7 +89,7 @@ class CountAllProject extends Command | ||
| 88 | break; | 89 | break; |
| 89 | } | 90 | } |
| 90 | } | 91 | } |
| 91 | - return $res_data; | 92 | + return $count; |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | public function httpGetProxy($url){ | 95 | public function httpGetProxy($url){ |
| @@ -112,6 +113,7 @@ class CountAllProject extends Command | @@ -112,6 +113,7 @@ class CountAllProject extends Command | ||
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | public function sixProject(){ | 115 | public function sixProject(){ |
| 116 | + $count = 0; | ||
| 115 | $projectModel = new Project(); | 117 | $projectModel = new Project(); |
| 116 | $manageModel = new ManageHr(); | 118 | $manageModel = new ManageHr(); |
| 117 | $i = 1; | 119 | $i = 1; |
| @@ -154,9 +156,13 @@ class CountAllProject extends Command | @@ -154,9 +156,13 @@ class CountAllProject extends Command | ||
| 154 | 'updated_at'=>date('Y-m-d H:i:s'), | 156 | 'updated_at'=>date('Y-m-d H:i:s'), |
| 155 | ]; | 157 | ]; |
| 156 | } | 158 | } |
| 159 | + $count = $count + count($data); | ||
| 160 | + $countAllModel = new AllProject; | ||
| 161 | + $countAllModel->insert($data); | ||
| 162 | + sleep(1); | ||
| 157 | $i++; | 163 | $i++; |
| 158 | } | 164 | } |
| 159 | - return $data; | 165 | + return $count; |
| 160 | } | 166 | } |
| 161 | 167 | ||
| 162 | /** | 168 | /** |
-
请 注册 或 登录 后发表评论