request = $request; $this->companyAccountService = $companyAccountService; $this->account = $request->user('company'); } /** * 修改密码. * * @return \Illuminate\Http\Response */ public function passwordByOld() { $oldPassword = $this->request->get('old_password'); $password = $this->request->get('password'); if ($this->account->password !== md5($oldPassword . $this->account->salt)) { return err('原密码不正确'); } if ($this->account->password === md5($password . $this->account->salt)) { return err('密码未修改'); } $attributes = [ 'id' => $this->account->id, 'password' => $password, ]; $account = $this->companyAccountService->store($attributes); return res($account, '修改成功'); } /** * 修改密码. * * @return \Illuminate\Http\Response */ public function password() { $attributes = [ 'id' => $this->account->id, 'password' => $this->request->get('password'), ]; $account = $this->companyAccountService->store($attributes); return res($account, '修改成功'); } /** * 绑定手机. * * @return \Illuminate\Http\Response */ public function mobile() { $attributes = [ 'id' => $this->account->id, 'mobile' => $this->request->get('mobile'), ]; $account = $this->companyAccountService->store($attributes); return res($account, '修改成功'); } }