正在显示
1 个修改的文件
包含
15 行增加
和
10 行删除
| @@ -40,16 +40,21 @@ class SyncManager extends Command | @@ -40,16 +40,21 @@ class SyncManager extends Command | ||
| 40 | public function handle(){ | 40 | public function handle(){ |
| 41 | $url = 'https://www.quanqiusou.cn/extend_api/saas/get_phone.php'; | 41 | $url = 'https://www.quanqiusou.cn/extend_api/saas/get_phone.php'; |
| 42 | $data = curlGet($url);//TODO::获取号码库 | 42 | $data = curlGet($url);//TODO::获取号码库 |
| 43 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND); | ||
| 44 | -// if(!empty($data)){ | ||
| 45 | -// $userModel = new User(); | ||
| 46 | -// try { | ||
| 47 | -// $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]); | ||
| 48 | -// $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]); | ||
| 49 | -// }catch (\Exception $e){ | ||
| 50 | -// echo date('Y-m-d H:i:s') . 'error' . PHP_EOL; | ||
| 51 | -// } | ||
| 52 | -// } | 43 | + DB::connection('gl_manager')->delete(); |
| 44 | + $param = []; | ||
| 45 | + foreach ($data as $v){ | ||
| 46 | + $param['mobile'] = $v; | ||
| 47 | + } | ||
| 48 | + if(!empty($param)){ | ||
| 49 | + DB::connection('gl_manager')->insert($param); | ||
| 50 | + $userModel = new User(); | ||
| 51 | + try { | ||
| 52 | + $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]); | ||
| 53 | + $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]); | ||
| 54 | + }catch (\Exception $e){ | ||
| 55 | + echo date('Y-m-d H:i:s') . 'error' . PHP_EOL; | ||
| 56 | + } | ||
| 57 | + } | ||
| 53 | } | 58 | } |
| 54 | 59 | ||
| 55 | } | 60 | } |
-
请 注册 或 登录 后发表评论