作者 lyh

gx

@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 namespace App\Console\Commands\Sync; 10 namespace App\Console\Commands\Sync;
11 11
  12 +use App\Models\Manage\Manage;
12 use App\Models\Manage\Mobile; 13 use App\Models\Manage\Mobile;
13 use App\Models\User\User; 14 use App\Models\User\User;
14 use Illuminate\Console\Command; 15 use Illuminate\Console\Command;
@@ -60,7 +61,7 @@ class SyncMobile extends Command @@ -60,7 +61,7 @@ class SyncMobile extends Command
60 ]; 61 ];
61 $mobileModel->insert($param); 62 $mobileModel->insert($param);
62 //查看当前用户是否存在 63 //查看当前用户是否存在
63 - $info = $userModel->read(['mobile'=>$mobile,'project_id'=>1]); 64 + $info = $userModel->read(['mobile'=>$mobile,'project_id'=>1],['id']);
64 if($info === false){ 65 if($info === false){
65 $data = [ 66 $data = [
66 'mobile'=>$mobile, 67 'mobile'=>$mobile,
@@ -73,6 +74,9 @@ class SyncMobile extends Command @@ -73,6 +74,9 @@ class SyncMobile extends Command
73 } 74 }
74 } 75 }
75 $data[] = '13083988828'; 76 $data[] = '13083988828';
  77 + $managerModel = new Manage();
  78 + $mobileArr = $managerModel->selectField(['status'=>1],'mobile');
  79 + $data = array_values(array_unique(array_merge($data,$mobileArr)));
76 $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]); 80 $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]);
77 $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]); 81 $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]);
78 } 82 }