user = $user; $this->password = $password; $this->source = $source; $this->userService = new UserService; } /** * Execute the job. * * @return void */ public function handle() { if(!empty($this->user)) { $mobile = $this->user->mobile; if (empty($mobile)) { //公众号不存在手机号 $mobile = 'u'.uniqid(); } $openid = $this->user->openid; $password = $this->password; $email = null; if ($this->source == 'SPA') { $email = $this->user->email; } //创建基表账号 $union_user = $this->userService->addUnionUser($mobile,$password, $this->source, $email, $openid); //绑定基表id if (!empty($union_user) && empty($this->user->uuid)) { $this->user->uuid = $union_user->id; $this->user->save(); } } } }