コード例 #1
0
ファイル: County.php プロジェクト: xincap/erp
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $obj = new Model();
     $obj->name = $this->data['areaName'];
     $obj->city_id = $this->data['city_id'];
     $obj->save();
     $c = new JdClient();
     $c->setAppKey(env('JD_APP_ID'));
     $c->setAppSecret(env('JD_APP_SECRET'));
     $req = new AreasTownGetRequest();
     $req->setParentId($this->data['areaId']);
     $resp = $c->execute($req);
     if (isset($resp['zh_desc'])) {
         Log::error($resp['zh_desc']);
     }
     $data = $resp['baseAreaServiceResponse']['data'];
     if (!$data) {
         return true;
     }
     foreach ($data as $key => $item) {
         $item['county_id'] = $obj->id;
         $event = new Town($item);
         Event::fire($event);
     }
 }
コード例 #2
0
ファイル: JdAddress.php プロジェクト: xincap/erp
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $c = new JdClient();
     $c->setAppKey(env('JD_APP_ID'));
     $c->setAppSecret(env('JD_APP_SECRET'));
     $req = new AreasProvinceGetRequest();
     $resp = $c->execute($req);
     $data = $resp['baseAreaServiceResponse']['data'];
     foreach ($data as $key => $item) {
         Event::fire('jd.province', [$item]);
     }
     $this->info('success');
 }
コード例 #3
0
ファイル: Province.php プロジェクト: xincap/erp
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $obj = new Model();
     $obj->name = $this->data['areaName'];
     $obj->save();
     $c = new JdClient();
     $c->setAppKey(env('JD_APP_ID'));
     $c->setAppSecret(env('JD_APP_SECRET'));
     $req = new AreasCityGetRequest();
     $req->setParentId($this->data['areaId']);
     $resp = $c->execute($req);
     $data = $resp['baseAreaServiceResponse']['data'];
     foreach ($data as $key => $item) {
         $item['province_id'] = $obj->id;
         $event = new City($item);
         Event::fire($event);
     }
 }