model = new CommonModel(); $this->userModel = new UserModel(); $this->naverApiClient = new NaverApiClient(); } public function getVrfcCode() { $type = $this->request->getGet("type"); $type = "VRFC_TYPE_SUB_" . $type; $data = $this->model->getVrfcCode($type); return $this->response->setJSON($data); } // 비밀번호 변경 public function changeUserPass() { $usr_id = session('usr_id'); try { $usr_pass = $this->request->getPost('usr_pass'); $new_pass = $this->request->getPost('new_pass'); $new_pass2 = $this->request->getPost('new_pass2'); if (empty($usr_pass)) { return $this->response->setJSON([ 'code' => '9', 'msg' => '기존 비밀번호 누락', ]); } if (empty($new_pass)) { return $this->response->setJSON([ 'code' => '9', 'msg' => '비밀번호 누락', ]); } else { if (strlen($new_pass) < 8) { return $this->response->setJSON([ 'code' => '9', 'msg' => '비밀번호 최소 길이는 8자 입니다.', ]); } } if (empty($new_pass2)) { return $this->response->setJSON([ 'code' => '9', 'msg' => '비밀번호 확인 누락', ]); } else { if ($new_pass !== $new_pass2) { return $this->response->setJSON([ 'code' => '9', 'msg' => '신규 비밀번호 불일치', ]); } } // 문자조합 유효성 검사 if (!checkPasswordTypes($new_pass, 2)) { return $this->response->setJSON([ 'code' => '9', 'msg' => '비밀번호는 영문 대/소문자, 숫자, 특수문자 중 최소 2종류 이상을 조합해야 합니다.', ]); } if ($usr_pass === $new_pass) { return $this->response->setJSON([ 'code' => '9', 'msg' => '기존 비밀번호와 다르게 설정하세요.', ]); } // 기존 비밀번호 일치 확인 $usrExist = $this->userModel->chkUserExist($usr_id, $usr_pass); if ($usrExist === 0) { return $this->response->setJSON([ 'code' => '9', 'msg' => '기존 비밀번호 불일치', ]); } else { // UPDATE users $this->userModel->changeUsrPass($usr_id, $usr_pass, $new_pass); return $this->response->setJSON([ 'code' => '0', 'msg' => 'success' ]); } } catch (\Exception $e) { // log_message('PASSWORD_CHG_ERROR', 'usr_id : ' . $usr_id . ', msg : ' . $e->getMessage()); return $this->response->setJSON([ 'code' => '9', 'msg' => $e->getMessage(), ]); } } // 단지 조회 public function getComplexList() { $legalDivisionNumber = $this->request->getGet("legalDivisionNumber"); $realEstateType = $this->request->getGet("realEstateType") ?? null; try { $complexList = $this->naverApiClient->getComplexList($legalDivisionNumber , $realEstateType); return $this->response->setJSON($complexList); } catch (\Exception $e) { return $this->response->setJSON([ 'code' => '9', 'msg' => $e->getMessage(), ]); } } /** * 평형 조회 * * complexNumber : 단지 번호 * realEstateType : 매물 종류 (APT, OFFICETEL, VILLA 등) */ public function getPyeongInfo() { $complexNumber = $this->request->getGet("complexNumber"); $realEstateType = $this->request->getGet("realEstateType"); try { if ( $realEstateType == 'A01' || $realEstateType == 'A02' || $realEstateType == 'A03' ) { $pyeongInfo = $this->naverApiClient->getPyeongTypeList($complexNumber); } else if ( $realEstateType == 'A05' || $realEstateType == 'A06' ) { $pyeongInfo = $this->naverApiClient->getVillaPyeongTypeList($complexNumber); } else { return $this->response->setJSON([ 'code' => '9', 'msg' => '지원하지 않는 매물 종류입니다.', ]); } return $this->response->setJSON($pyeongInfo); } catch (\Exception $e) { return $this->response->setJSON([ 'code' => '9', 'msg' => $e->getMessage(), ]); } } }