| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | 
							- <?php
 
- namespace App\Console\Commands\Transfer;
 
- use App\Transfer\Company;
 
- use Illuminate\Console\Command;
 
- class TransferOther extends Command
 
- {
 
-     /**
 
-      * The name and signature of the console command.
 
-      *
 
-      * @var string
 
-      */
 
-     protected $signature = 'aix:transfer-other';
 
-     /**
 
-      * The console command description.
 
-      *
 
-      * @var string
 
-      */
 
-     protected $description = '转移旧系统企业数据';
 
-     /**
 
-      * Create a new command instance.
 
-      *
 
-      * @return void
 
-      */
 
-     public function __construct()
 
-     {
 
-         parent::__construct();
 
-     }
 
-     /**
 
-      * Execute the console command.
 
-      *
 
-      * @return mixed
 
-      */
 
-     public function handle()
 
-     {
 
-         $this->info("清除企业数据表:companys");
 
-         //DB::table('companys')->delete();
 
-         $this->info("清除企业数据表:companyImg");
 
-         //DB::table('companyImg')->delete();
 
-         ///其它需要清除的表
 
-         $this->info("开始转移数据...");
 
-         $total = Company::where(['utype' => 1])->count();
 
-         $bar=$this->output->createProgressBar($total);
 
-         Company::where(['utype' => 1])->orderBy('uid', 'asc')->chunk(500, function ($companys) use ($bar) {
 
-             $company_array=[];
 
-             $company_job_array=[];
 
-             $company_img_array=[];
 
-             /** @var Company $company */
 
-             foreach ($companys as $company) {
 
-                 //处理企业表
 
-                 $this->handleCompany($company, $company_array);
 
-                 //处理职业
 
-                 $this->handleCompanyJob($company->jobs, $company_job_array);
 
-                 //处理套餐
 
-                 //处理企业图片...
 
-             }
 
-             //批量插入数据;
 
-             $bar->advance(500);
 
-         });
 
-         $bar->finish();
 
-         $this->line("  完成!");
 
-         $this->info("转移企业数据成功.");
 
-     }
 
-     public function handleCompany($company, &$result_array)
 
-     {
 
-         $data['id']=$company->uid;
 
-         $data['id']="xx";
 
-         $data['id']="xx";
 
-         $data['id']="xx";
 
-         $data['id']="xx";
 
-         $result_array[]= $data;
 
-     }
 
-     public function handleCompanyJob($jobs, &$result_array)
 
-     {
 
-         foreach ($jobs as $job) {
 
-             $data['id']=$job->uid;
 
-             $data['id']="xx";
 
-             $data['id']="xx";
 
-             $data['id']="xx";
 
-             $data['id']="xx";
 
-             $result_array[]= $data;
 
-         }
 
-     }
 
- }
 
 
  |