Merge branch 'master' of http://192.168.10.243:3000/owrainfo/confirms
This commit is contained in:
@@ -176,10 +176,19 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
|
||||
*/
|
||||
$routes->get('m701a/getResultList', 'M701::getResultList');
|
||||
$routes->get('m701a/excel', 'M701::excel');
|
||||
$routes->post('m701a/chgArticleStatus', 'M701::chgArticleStatus'); // 상태정보변경
|
||||
|
||||
$routes->post('m701a/changePrice', 'M701::changePrice'); // 가격수정
|
||||
$routes->post('m701a/chgArticleStatus', 'M701::chgArticleStatus'); // 상태정보변경
|
||||
$routes->post('m701a/modifyInfo', 'M701::modifyInfo'); // 정보수정
|
||||
$routes->post('m701a/saveMemo', 'M701::saveMemo'); // 메모저장
|
||||
|
||||
$routes->post('m701a/saveDocu', 'M701::saveDocu'); // 서류 저장
|
||||
$routes->post('m701a/saveTel', 'M701::saveTel'); // 전화정보 저장
|
||||
$routes->post('m701a/saveRegi', 'M701::saveRegi'); // 등기부등본 저장
|
||||
$routes->post('m701a/saveFinalRegi', 'M701::saveFinalRegi'); // 검증최종실패 처리
|
||||
|
||||
$routes->post('m701a/uploadFile', 'M701::uploadFile'); // 파일업로드
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -195,7 +204,11 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
|
||||
$routes->get('m702a/getResultList', 'M702::getResultList');
|
||||
$routes->get('m702a/excel', 'M702::excel');
|
||||
$routes->post('m702a/updateAssign', 'M702::updateAssign'); // 배정변경
|
||||
// 서류누락
|
||||
$routes->post('m702a/saveTel', 'M702::saveTel'); // 전화확인 정보 저장
|
||||
$routes->post('m702a/modifyInfo', 'M702::modifyInfo'); // 매물정보저장
|
||||
|
||||
$routes->post('m702a/uploadFile', 'M702::uploadFile'); // 파일업로드
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -220,6 +233,7 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
|
||||
$routes->post('m703a/saveRequestMessage', 'M703::saveRequestMessage'); // 중개사요청사항저장
|
||||
$routes->post('m703a/saveResult', 'M703::saveResult'); // 결과저장
|
||||
|
||||
|
||||
/**
|
||||
* 홍보확인서 확인
|
||||
*/
|
||||
@@ -238,8 +252,11 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
|
||||
*/
|
||||
$routes->get('m704a/getResultList', 'M704::getResultList');
|
||||
$routes->get('m704a/excel', 'M704::excel');
|
||||
$routes->post('m704a/modifyInfo', 'M704::modifyInfo'); // 매물정보 저장
|
||||
$routes->post('m704a/uploadFile', 'M704::uploadFile'); // 파일업로드
|
||||
$routes->post('m704a/saveMemo', 'M704::saveMemo'); // 메모저장
|
||||
$routes->post('m704a/contactFail', 'M704::contactFail'); // 통화실패 저장
|
||||
$routes->post('m704a/saveTel', 'M704::saveTel'); // 전화확인정보 저장
|
||||
$routes->post('m704a/getNextFaxImgs', 'M704::getNextFaxImgs'); // 다음매물확인
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,13 @@
|
||||
namespace App\Controllers\V2;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Libraries\MyUpload;
|
||||
use App\Libraries\NaverApiClient;
|
||||
use App\Models\common\CodeModel;
|
||||
use App\Models\results\M415Model;
|
||||
use App\Models\v2\M702Model;
|
||||
use App\Models\v2\M710Model;
|
||||
use Exception;
|
||||
|
||||
class M702 extends BaseController
|
||||
{
|
||||
@@ -121,7 +126,7 @@ class M702 extends BaseController
|
||||
$rows = $this->request->getPost('rows');
|
||||
$damdang = $this->request->getPost(index: 'damdang2');
|
||||
|
||||
$rows = json_decode($rows, true);
|
||||
$rows = json_decode($rows);
|
||||
|
||||
if (count($rows) > 0) {
|
||||
|
||||
@@ -164,6 +169,7 @@ class M702 extends BaseController
|
||||
public function detail($id)
|
||||
{
|
||||
$id = (string) $id;
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
if ($id === '') {
|
||||
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
|
||||
@@ -179,6 +185,15 @@ class M702 extends BaseController
|
||||
$data = $this->model->getDetail($id);
|
||||
$history = $this->model->getHistory($id);
|
||||
|
||||
$complexList = [];
|
||||
$ptpList = [];
|
||||
|
||||
// 아파트단지목록
|
||||
$complexList = $naver->complexList($data['address_code']);
|
||||
|
||||
// 평형목록
|
||||
$ptpList = $naver->ptpList($data['hscp_no']);
|
||||
|
||||
|
||||
$this->data['codes'] = $codes;
|
||||
|
||||
@@ -189,7 +204,806 @@ class M702 extends BaseController
|
||||
|
||||
$this->data['data'] = $data;
|
||||
$this->data['history'] = $history;
|
||||
$this->data['complexList'] = $complexList;
|
||||
$this->data['ptpList'] = $ptpList;
|
||||
|
||||
return view("pages/v2/m702/detail", $this->data);
|
||||
}
|
||||
|
||||
// 매물정보저장
|
||||
public function modifyInfo()
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
try {
|
||||
|
||||
$atcl_vr_sq = $this->request->getPost('rcpt_key'); //순번
|
||||
$atcl_hscp_nm = $this->request->getPost('atcl_hscp_nm'); //단지명
|
||||
$atcl_ptp_nm = $this->request->getPost('atcl_ptp_nm'); //평형명
|
||||
$atcl_vrfc_type = $this->request->getPost('atcl_vrtc_way'); //검증구분
|
||||
$trade_type = $this->request->getPost('trade_type_cd'); //거래구분
|
||||
$atcl_addr1 = $this->request->getPost('atcl_addr1'); //상세주소1 폐기예정
|
||||
$atcl_addr1a = $this->request->getPost('atcl_addr1a'); // 리 주소
|
||||
$atcl_addr1b = $this->request->getPost('atcl_addr1b'); // 공동 : 동 주소, 비공동 : 지번주소
|
||||
$atcl_addr2 = $this->request->getPost('atcl_addr2'); //상세주소2
|
||||
$atcl_hscp_no = $this->request->getPost('atcl_hscp_no'); //단지번호
|
||||
$atcl_ptp_no = $this->request->getPost('atcl_ptp_no'); //단지명
|
||||
$atcl_amt1 = $this->request->getPost('atcl_amt1');
|
||||
$atcl_amt2 = $this->request->getPost('atcl_amt2');
|
||||
$atcl_amt3 = $this->request->getPost('atcl_amt3');
|
||||
$atcl_floor = $this->request->getPost('atcl_floor'); // 층
|
||||
$atcl_floor2 = $this->request->getPost('atcl_floor2'); // 총층
|
||||
|
||||
|
||||
$return = '';
|
||||
if ($trade_type == 'A1') {
|
||||
$return = limitHscpMarketPriceInfo($this, $trade_type, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1);
|
||||
} elseif ($trade_type == 'B1') {
|
||||
$return = limitHscpMarketPriceInfo($this, $trade_type, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt2);
|
||||
}
|
||||
|
||||
if (empty($return)) {
|
||||
$result = $this->model->saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2);
|
||||
$resVrfc = $this->model->saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type);
|
||||
|
||||
if ($result['error_number'] != 0) {
|
||||
throw new \Exception($result['error_message']);
|
||||
} else {
|
||||
|
||||
//API 호출
|
||||
$resultData = $this->model->getDetail($atcl_vr_sq);
|
||||
|
||||
$modifyInfo = $naver->modifyInfo(
|
||||
$resultData['data']['atcl_no'],
|
||||
$resultData['data']['hscp_no'],
|
||||
$resultData['data']['ptp_no'],
|
||||
$resultData['data']['bild_nm'],
|
||||
$resultData['data']['rm_no'],
|
||||
$resultData['data']['trade_type_cd'],
|
||||
$resultData['data']['deal_amt'],
|
||||
$resultData['data']['wrrnt_amt'],
|
||||
$resultData['data']['lease_amt'],
|
||||
$resultData['data']['isale_amt'],
|
||||
$resultData['data']['prem_amt'],
|
||||
$resultData['data']['floor'],
|
||||
$resultData['data']['floor2'],
|
||||
$resultData['data']['charger'],
|
||||
$resultData['data']['address_code'],
|
||||
$resultData['data']['address2a'],
|
||||
$resultData['data']['address2a'],
|
||||
$resultData['data']['address2b'],
|
||||
$resultData['data']['address3'],
|
||||
$resultData['data']['sply_spc'],
|
||||
$resultData['data']['excls_spc'],
|
||||
$resultData['data']['tot_spc'],
|
||||
$resultData['data']['grnd_spc'],
|
||||
$resultData['data']['bldg_spc']
|
||||
);
|
||||
|
||||
|
||||
if ($modifyInfo['result'] != 'success') { //결과값 확인
|
||||
$return = $modifyInfo['error'];
|
||||
|
||||
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
|
||||
$err_time = date("Y-m-d H:i:s");
|
||||
$this->model->saveApiErr($atcl_vr_sq, $modifyInfo['error']['code'], $modifyInfo['error']['message'], $err_time, $resultData['data']['atcl_no']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success',
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 파일업로드
|
||||
public function uploadFile()
|
||||
{
|
||||
$lib = new MyUpload();
|
||||
|
||||
try {
|
||||
$usr_id = session('usr_id');
|
||||
$vr_sq = $this->request->getPost(index: 'vr_sq');
|
||||
|
||||
$files = $this->request->getFiles();
|
||||
|
||||
|
||||
|
||||
$uploadPath = "/upload/v2_file/" . $vr_sq . "/";
|
||||
|
||||
$file = $files['files'];
|
||||
$arrUploadfile = [];
|
||||
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||
|
||||
if ($uploadData !== false) {
|
||||
$arrUploadfile[] = $uploadData;
|
||||
}
|
||||
|
||||
// print_r($arrUploadfile);
|
||||
// exit;
|
||||
|
||||
if (!empty($arrUploadfile)) {
|
||||
foreach ($arrUploadfile as $key => $uploadFile) {
|
||||
$data = [
|
||||
'vr_sq' => $vr_sq,
|
||||
// 'file_sq' => $this->request->getPost('file_sq'),
|
||||
'orig_name' => $uploadFile['origin_name'],
|
||||
'new_name' => $uploadFile['file_name'],
|
||||
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
||||
'ext' => '.' . $uploadFile['ext'],
|
||||
'size' => $file->getSize(),
|
||||
'img_yn' => null,
|
||||
'img_height' => null,
|
||||
'img_width' => null,
|
||||
'usr_id' => $usr_id,
|
||||
'file_type' => '2',
|
||||
];
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
|
||||
$detail = $this->model->getDetail($vr_sq);
|
||||
$this->model->saveHistory($vr_sq, $detail['stat_cd'], 'C28', $usr_id, '이미지파일 업로드');
|
||||
|
||||
// 파일업로드 정보 저장
|
||||
$this->model->saveFileInfo($data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 전화정보저장
|
||||
public function saveTel()
|
||||
{
|
||||
/*
|
||||
1.0.1 POST 데이터 받기.
|
||||
1.1.1 1차 검증인지 2차검증인지 확인.
|
||||
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
|
||||
1.2.1 v2_confirms에 데이터가 있는지 확인.
|
||||
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
|
||||
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
|
||||
1.4.2 상태변경 하기 : 전화(서류)확인중 상태로 변경. (수정변경이력 저장)
|
||||
1.5.1 녹취파일 서버에 UPLOAD (수정변경이력 저장)
|
||||
1.6.1 기존파일 탐색.
|
||||
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
|
||||
1.8.1 기존파일 없음 : v2_files INSERT.
|
||||
1.9.1 개인정보 제공동의, 매물주소, 가격거래구분, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
|
||||
1.10.1 API 전송.
|
||||
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 전화(서류)확인완료 상태. (수정변경이력 저장)
|
||||
*/
|
||||
$lib = new MyUpload();
|
||||
$naver = new NaverApiClient();
|
||||
$model710 = new M710Model();
|
||||
$model415 = new M415Model();
|
||||
$v2DailyModel = new V2StDailyModel();
|
||||
|
||||
try {
|
||||
|
||||
$usr_id = session('usr_id');
|
||||
$toDay = date('Y-m-d H:i:s');
|
||||
$atcl_vrtc_way = $this->request->getPost('atcl_vrtc_way');
|
||||
$atcl_vr_sq = $this->request->getPost('rcpt_key');
|
||||
$tel_agree = $this->request->getPost('tel_agree');
|
||||
|
||||
// 개인정보 제공 동의가 승인일 경우 필수 필드 검증
|
||||
if ($tel_agree == '10000') {
|
||||
$validation = \Config\Services::validation();
|
||||
|
||||
$validation->setRules([
|
||||
'tel_conf_yn_2' => [
|
||||
'label' => '매물주소',
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
|
||||
],
|
||||
'tel_conf_yn_3' => [
|
||||
'label' => '가격 거래구분',
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
|
||||
],
|
||||
'tel_conf_yn_4' => [
|
||||
'label' => '의뢰인정보',
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
|
||||
],
|
||||
]);
|
||||
|
||||
if (!$validation->withRequest($this->request)->run()) {
|
||||
$errors = $validation->getErrors();
|
||||
throw new \Exception(implode(', ', $errors));
|
||||
}
|
||||
}
|
||||
|
||||
// POST 데이터 받기
|
||||
$tel_suc = $this->request->getPost('tel_suc');
|
||||
$tel_conf_yn_2 = $this->request->getPost('tel_conf_yn_2');
|
||||
$tel_conf_yn_3 = $this->request->getPost('tel_conf_yn_3');
|
||||
$tel_conf_yn_4 = $this->request->getPost('tel_conf_yn_4');
|
||||
$tel_conf_yn_5 = $this->request->getPost('tel_conf_yn_5');
|
||||
$tel_conf_yn_info_2 = $this->request->getPost('tel_conf_yn_info_2');
|
||||
$tel_conf_yn_info_3 = $this->request->getPost('tel_conf_yn_info_3');
|
||||
$tel_conf_yn_info_4 = $this->request->getPost('tel_conf_yn_info_4');
|
||||
$address_code = $this->request->getPost('address_code');
|
||||
$reg_chk_val = $this->request->getPost('reg_chk_val');
|
||||
$tel_file_yn = $this->request->getPost('tel_file_yn');
|
||||
$memo = $this->request->getPost('memo_tel');
|
||||
$tel_fail_cause = $this->request->getPost('tel_fail_cause');
|
||||
|
||||
|
||||
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
|
||||
$resStat = $this->model->chkStat($atcl_vr_sq);
|
||||
|
||||
|
||||
if ($resStat['stat_cd'] >= '40' || $resStat['stat_cd'] == '19') {
|
||||
throw new \Exception('이미 저장된 데이터입니다.');
|
||||
} else {
|
||||
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
|
||||
|
||||
|
||||
$this->model->InsCharger($atcl_vr_sq); //담당자가 없을 경우 강제로 session 정보로 넣어준다
|
||||
|
||||
$try_cnt = '0';
|
||||
$resultCnt = $this->model->chkTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
|
||||
if ($resultCnt['try_cnt'] == 0) { //1차 검증일 때
|
||||
$try_cnt = '1';
|
||||
} else if ($resultCnt['try_cnt'] == 1) { //2차 검증일 때
|
||||
$try_cnt = '2';
|
||||
} else {
|
||||
$try_cnt = intval($try_cnt) + 1;
|
||||
}
|
||||
|
||||
$result = $this->model->chkConfirm($atcl_vr_sq, '');
|
||||
|
||||
if ($result == 0) { //v2_confirm 존재하지 않는다면
|
||||
|
||||
if ($tel_conf_yn_2 == '10000' && $tel_conf_yn_3 == '10000' && $tel_conf_yn_4 == '10000') { //success 여부 판단
|
||||
$chk_type = '1';
|
||||
//$chk_delay = '0'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
} else {
|
||||
$chk_type = '0';
|
||||
//$chk_delay = '1'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
}
|
||||
|
||||
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
|
||||
|
||||
//v2_vrfc_req INSERT//상태변경 TABLE INSERT : 전화(서류)확인중 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '30', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '30');
|
||||
|
||||
|
||||
} else { //v2_confirm 기존데이터에 success 컬럼만 변경 가능하도록
|
||||
|
||||
if ($tel_conf_yn_2 == '10000' && $tel_conf_yn_3 == '10000' && $tel_conf_yn_4 == '10000') { //success 여부 판단
|
||||
$chk_type = '1';
|
||||
//$chk_delay = '0'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
} else {
|
||||
$chk_type = '0';
|
||||
$chk_delay = '1'; //지연여부
|
||||
$chk_zombie = '0'; //좀비매물
|
||||
}
|
||||
|
||||
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
|
||||
}
|
||||
|
||||
$file = $this->request->getFile('rec_file');
|
||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||
$uploadPath = './upload/v2_file/' . $atcl_vr_sq . '/';
|
||||
$arrUploadfile = [];
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||
|
||||
if ($uploadData !== false) {
|
||||
$arrUploadfile[] = $uploadData;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrUploadfile)) {
|
||||
foreach ($arrUploadfile as $key => $uploadFile) {
|
||||
$data['file'] = [
|
||||
'vr_sq' => $atcl_vr_sq,
|
||||
'orig_name' => $uploadFile['origin_name'],
|
||||
'new_name' => $uploadFile['file_name'],
|
||||
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
||||
'ext' => '.' . $uploadFile['ext'],
|
||||
'size' => $file->getSize(),
|
||||
'img_yn' => null,
|
||||
// 높이/폭은 나중에 getimagesize 등으로 구해도 됨
|
||||
'img_height' => null,
|
||||
'img_width' => null,
|
||||
];
|
||||
}
|
||||
|
||||
$this->model->saveFileInfo($data['file']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//v2_check_list 확인여부 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T11', $tel_agree, '');
|
||||
if ($tel_agree == '10000') {
|
||||
//v2_check_list 매물주소 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T12', $tel_conf_yn_2, $tel_conf_yn_info_2);
|
||||
|
||||
//v2_check_list 가격거래구분 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T13', $tel_conf_yn_3, $tel_conf_yn_info_3);
|
||||
|
||||
//v2_check_list 의뢰인정보 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T14', $tel_conf_yn_4, $tel_conf_yn_info_4);
|
||||
} else {
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T12');
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T13');
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T14');
|
||||
}
|
||||
if (!empty($tel_conf_yn_5)) {
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15', $tel_conf_yn_5, $tel_conf_yn_5);
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T11');
|
||||
} else {
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15');
|
||||
}
|
||||
|
||||
//memo 저장
|
||||
if (!empty($memo)) {
|
||||
$this->model->saveMemo(['vr_sq' => $atcl_vr_sq, 'memo' => $memo]);
|
||||
}
|
||||
|
||||
//전화실패 사유 저장
|
||||
if (!empty($tel_fail_cause)) {
|
||||
$this->model->up_tel_fail_cause($atcl_vr_sq, $tel_fail_cause);
|
||||
}
|
||||
|
||||
$sendData = $this->model->getDataConfirmAPI($atcl_vr_sq);
|
||||
$t_yn = $model710->get_send_yn('T');
|
||||
if ($t_yn['stop_yn'] == 'N') { //전송금지
|
||||
//1.해당매물정보를v2_stop_api_save_info에다 넣음
|
||||
$this->model->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'T1', '');
|
||||
//2.아무렇지않게 행동한다
|
||||
$send_result['result'] = 'success';
|
||||
} else {
|
||||
//API 호출
|
||||
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
|
||||
}
|
||||
|
||||
//v2_vrfc_req INSERT//상태변경 TABLE INSERT : 전화(서류)확인중 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '30', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '30');
|
||||
|
||||
if ($send_result['result'] == 'success') {
|
||||
|
||||
if ($tel_agree == '10000' && $chk_type == '1') {
|
||||
//상태변경 TABLE INSERT : 전화(서류)확인 완료 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '35', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '35'); //v2_vrfc_req INSERT
|
||||
|
||||
if ($reg_chk_val == '1') {
|
||||
//등기부등본 확인 대상은 전화(서류)확인 완료 후 -> 등기부등본 확인중 상태로 변경.
|
||||
$this->model->chgStat($atcl_vr_sq, '40', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '40'); //v2_vrfc_req INSERT
|
||||
|
||||
//★등기 로 넘어갈때
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 확인일자
|
||||
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$sf = 'T';
|
||||
$model415->insert_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $sf);
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0201', '1', 'add'); // 일치로 저장
|
||||
} else {
|
||||
//등기부등본 확인 대상이 아닌 경우 전화(서류)확인 완료 후 -> 검증 완료 상태로 변경.
|
||||
$this->model->chgStat($atcl_vr_sq, '60', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
|
||||
|
||||
//★검증완료일때
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 확인일자
|
||||
$tel_doc_conf_dt = $model415->getConfTimeForHistory($atcl_vr_sq);
|
||||
//3.검증완료시간
|
||||
$finishTime = $model415->get_60_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0206', '1', 'add'); // 전화확인완료 등기부등본확인 안함 저장
|
||||
}
|
||||
|
||||
} else {
|
||||
//상태변경 TABLE INSERT : 전화(서류)확인 불일치 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '39', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '39'); //v2_vrfc_req INSERT
|
||||
|
||||
if ($try_cnt == '1') {
|
||||
//v2_vrfc_req try_cnt 값을 1로 update
|
||||
$this->model->chgTryCnt($atcl_vr_sq, '1');
|
||||
|
||||
//★불일치
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 불일치 시간
|
||||
$tel_doc_conf_dt = $model415->getFaxFailTimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$sf = 'F';
|
||||
$model415->insert_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $sf);
|
||||
}
|
||||
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0301', '1', 'add'); // 1차실패로 저장
|
||||
} else if ($try_cnt == '2') {
|
||||
//v2_vrfc_req try_cnt 값을 2로 update
|
||||
$res_try = $this->m701_model->chgTryCnt($atcl_vr_sq, '2');
|
||||
|
||||
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
|
||||
$result_query9 = $this->m701_model->chgStat($atcl_vr_sq, '69', $toDay);
|
||||
$chgVrfc69 = $this->m701_model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
|
||||
|
||||
//★ 검증실패
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 불일치 시간
|
||||
$tel_doc_conf_dt = $model415->getFaxFailTimeForHistory($atcl_vr_sq);
|
||||
//3.검증실패시간
|
||||
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0302', '1', 'add'); // 최종실패로 저장
|
||||
}
|
||||
|
||||
if (in_array($tel_agree, array('20001', '20002'))) {
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0203', '1', 'add'); // 거부로 저장
|
||||
} elseif (in_array($tel_agree, array('20003', '20004', '20005'))) {
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0204', '1', 'add'); // 무응답 외
|
||||
} else {
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0202', '1', 'add'); // 불일치
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
if (isset($send_result['error'])) {
|
||||
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
|
||||
|
||||
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
|
||||
$err_time = date("Y-m-d H:i:s");
|
||||
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
|
||||
throw new \Exception($error_message);
|
||||
} else {
|
||||
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
//$file = $this->request->getFile('rec_file');
|
||||
|
||||
// print_r($file);
|
||||
// exit;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 등기부등본 저장
|
||||
public function saveRegi()
|
||||
{
|
||||
/*
|
||||
1.0.1 POST 데이터 받기.
|
||||
1.1.1 1차 검증인지 2차검증인지 확인.
|
||||
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
|
||||
1.2.1 v2_confirms에 데이터가 있는지 확인.
|
||||
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
|
||||
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
|
||||
1.4.2 상태변경 하기 : 등기부등본 확인중 상태로 변경. (수정변경이력 저장)
|
||||
1.5.1 이미지파일 서버에 UPLOAD (수정변경이력 저장)
|
||||
1.6.1 기존파일 탐색.
|
||||
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
|
||||
1.8.1 기존파일 없음 : v2_files INSERT.
|
||||
1.9.1 매물주소, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
|
||||
1.10.1 API 전송.
|
||||
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 등기부등본 확인완료 상태. (수정변경이력 저장)
|
||||
*/
|
||||
|
||||
$model415 = new M415Model();
|
||||
$model710 = new M710Model();
|
||||
$v2DailyModel = new V2StDailyModel();
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
try {
|
||||
|
||||
$usr_id = session('usr_id');
|
||||
$toDay = date('Y-m-d H:i:s');
|
||||
$atcl_vrtc_way = 'R'; //검증구분
|
||||
$atcl_vr_sq = $this->request->getPost('rcpt_key', TRUE);
|
||||
$reg_conf_yn_1 = $this->request->getPost('reg_conf_yn_1', TRUE); //확인내용
|
||||
$reg_conf_yn_2 = $this->request->getPost('reg_conf_yn_2', TRUE); //매물주소
|
||||
$reg_conf_yn_3 = $this->request->getPost('reg_conf_yn_3', TRUE); //의뢰인정보
|
||||
$reg_conf_yn_info_2 = $this->request->getPost('reg_conf_yn_info_2', TRUE); //매물주소
|
||||
$reg_conf_yn_info_3 = $this->request->getPost('reg_conf_yn_info_3', TRUE); //의뢰인정보
|
||||
$memo = $this->request->getPost('memo_reg', TRUE); //메모
|
||||
$atcl_vrtc_type = $this->request->getGet('atcl_vrtc_type', TRUE); // 검증방식
|
||||
// $send_type = $this->request->get('send_type', TRUE); // 전송구분
|
||||
|
||||
|
||||
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
|
||||
$resStat = $this->model->chkStat($atcl_vr_sq);
|
||||
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
|
||||
$rlet_type_cd = $model415->get_rlet_type_cd($atcl_vr_sq);
|
||||
|
||||
|
||||
if ($resStat['stat_cd'] >= '60' || $resStat['stat_cd'] == '19') {
|
||||
throw new \Exception('이미 저장된 데이터입니다.');
|
||||
} else {
|
||||
$this->model->InsResChar($atcl_vr_sq); //담당자가 없을 경우 강제로 session 정보로 넣어준다
|
||||
|
||||
$resultCnt = $this->model->chkRegiTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
|
||||
$try_cnt = '0';
|
||||
if ($resultCnt['reg_try_cnt'] == 0) { //1차 검증일 때
|
||||
$try_cnt = '1';
|
||||
} else if ($resultCnt['reg_try_cnt'] == 1) { //2차 검증일 때
|
||||
$try_cnt = '2';
|
||||
} else {
|
||||
$try_cnt = intval($try_cnt) + 1;
|
||||
}
|
||||
|
||||
$result = $this->model->chkConfirm($atcl_vr_sq, $atcl_vrtc_way);
|
||||
if ($result == 0) { //v2_confirm 존재하지 않는다면
|
||||
|
||||
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
|
||||
$chk_type = '1';
|
||||
//$chk_delay = '0'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
} else {
|
||||
$chk_type = '0';
|
||||
//$chk_delay = '1'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
}
|
||||
|
||||
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
|
||||
|
||||
//상태변경 TABLE INSERT : 등기부등본 확인중 상태로 변경
|
||||
//$chgVrfc = $this->m702_model->chgStatVrfc($atcl_vr_sq, '40'); //v2_vrfc_req INSERT
|
||||
//$result_query2 = $this->m702_model->chgStat($atcl_vr_sq, '40', $toDay);
|
||||
|
||||
} else {
|
||||
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
|
||||
$chk_type = '1';
|
||||
//$chk_delay = '0'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
} else {
|
||||
$chk_type = '0';
|
||||
//$chk_delay = '1'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
}
|
||||
|
||||
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
|
||||
}
|
||||
|
||||
//v2_check_list 확인여부 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '21', $reg_conf_yn_2, $reg_conf_yn_info_2);
|
||||
|
||||
//v2_check_list 매물주소 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '22', $reg_conf_yn_3, $reg_conf_yn_info_3);
|
||||
|
||||
//memo 저장
|
||||
if (!empty($memo)) {
|
||||
$this->model->saveMemo([
|
||||
'vr_sq' => $atcl_vr_sq,
|
||||
'memo' => $memo
|
||||
]);
|
||||
}
|
||||
|
||||
$sendData = $this->model->getDatacertAPI($atcl_vr_sq, 'R');
|
||||
|
||||
$d_yn = $model710->get_send_yn('D');
|
||||
if ($d_yn['stop_yn'] == 'N') { //전송금지
|
||||
//1.해당매물정보를v2_stop_api_save_info에다 넣음
|
||||
$model710->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'D', '');
|
||||
//2.아무렇지않게 행동한다
|
||||
$send_result['result'] = 'success';
|
||||
} else {
|
||||
$send_result = $naver->certification($sendData['atclNo'], $try_cnt, $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['date'], $sendData['modifyInfo'], $sendData['ownerVerifiable']);
|
||||
}
|
||||
|
||||
if ($send_result['result'] == 'success') {
|
||||
if ($chk_type == '1') {
|
||||
//상태변경 TABLE INSERT : 등기부등본 확인완료 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '45', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '45'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '45'); //fax_imgs
|
||||
|
||||
//상태변경 TABLE INSERT : 검증완료 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '60', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '60'); //fax_imgs
|
||||
|
||||
// ★ 검증완료
|
||||
//0.불일치 이력이 있는지 확인
|
||||
$cnt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //검증완료일땐 불일치가없어야 통계포함된다
|
||||
if ($atcl_vrtc_type == 'M' || $atcl_vrtc_type == 'O') { //모바일은 등기가 첨 시작이니까 insert해줘야함
|
||||
if (!($atcl_vrtc_type == 'M' && in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03')))) {//만약 분양권들이면 넘어가고 아니면 체크
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인완료 시간
|
||||
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
|
||||
//3.검증완료시간
|
||||
$finishTime = $model415->get_60_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
}
|
||||
} else {
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인완료 시간
|
||||
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
|
||||
}
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
|
||||
} else {
|
||||
if ($atcl_vrtc_type == 'M') {
|
||||
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '49', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
|
||||
|
||||
//v2_vrfc_req try_cnt 값을 1로 update
|
||||
$this->model->chgRegiTryCnt($atcl_vr_sq, '2');
|
||||
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
|
||||
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
|
||||
|
||||
// ★모바일이고 검증실패
|
||||
if (!in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03'))) {//만약 분양권들이면 넘어가고 아니면 체크
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인실패 시간
|
||||
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
//3.검증실패시간
|
||||
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
}
|
||||
|
||||
} else {
|
||||
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '49', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
|
||||
|
||||
//등기부등본 확인중 상태로 변경.
|
||||
$this->model->saveHistory($atcl_vr_sq, '30', 'C9', $usr_id, '상태변경 : 49 => 30'); //검증결과 변동사항 HISTORY
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '30'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '30'); //fax_imgs
|
||||
|
||||
if ($try_cnt == '1') {
|
||||
//v2_vrfc_req try_cnt 값을 1로 update
|
||||
$this->model->chgRegiTryCnt($atcl_vr_sq, '1');
|
||||
|
||||
// ★1차실패
|
||||
if ($atcl_vrtc_type == 'O') {
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인실패 시간
|
||||
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
//3.검증실패시간
|
||||
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
} else {
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인실패 시간
|
||||
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$sf = 'F';
|
||||
$model415->update_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $sf);
|
||||
}
|
||||
} else if ($try_cnt == '2') {
|
||||
//v2_vrfc_req try_cnt 값을 2로 update
|
||||
$this->model->chgRegiTryCnt($atcl_vr_sq, '2');
|
||||
|
||||
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
|
||||
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
|
||||
|
||||
// ★모바일 이외 검증실패
|
||||
if ($atcl_vrtc_type == 'O') {
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인실패 시간
|
||||
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
//3.검증실패시간
|
||||
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
} else {
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인실패 시간
|
||||
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (isset($send_result['error'])) {
|
||||
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
|
||||
|
||||
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
|
||||
$err_time = date("Y-m-d H:i:s");
|
||||
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
|
||||
throw new \Exception($error_message);
|
||||
} else {
|
||||
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace App\Controllers\V2;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Libraries\NaverApiClient;
|
||||
use App\Models\common\CodeModel;
|
||||
use App\Models\results\M415Model;
|
||||
use App\Models\v2\M703Model;
|
||||
@@ -400,6 +401,8 @@ class M703 extends BaseController
|
||||
// 결과저장
|
||||
public function saveResult()
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
try {
|
||||
|
||||
$fax_sq = $this->request->getPost('fax_sq');
|
||||
@@ -461,8 +464,7 @@ class M703 extends BaseController
|
||||
//2.아무렇지않게 행동한다
|
||||
$send_result['result'] = 'success';
|
||||
} else {
|
||||
// $this->load->library('call_kiso_api');
|
||||
// $send_result = $this->call_kiso_api->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
|
||||
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
|
||||
}
|
||||
|
||||
if ($send_result['result'] == 'success') {
|
||||
|
||||
@@ -3,8 +3,12 @@ namespace App\Controllers\V2;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Libraries\MyUpload;
|
||||
use App\Libraries\NaverApiClient;
|
||||
use App\Models\common\CodeModel;
|
||||
use App\Models\results\M415Model;
|
||||
use App\Models\v2\M704Model;
|
||||
use App\Models\v2\M710Model;
|
||||
use Exception;
|
||||
|
||||
class M704 extends BaseController
|
||||
{
|
||||
@@ -121,6 +125,8 @@ class M704 extends BaseController
|
||||
// 상세화면
|
||||
public function detail($id)
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
$id = (string) $id;
|
||||
|
||||
if ($id === '') {
|
||||
@@ -137,6 +143,33 @@ class M704 extends BaseController
|
||||
$phone_list = $this->model->getPhoneNumber(); // 주택임대사업자번호 리스트
|
||||
$tel = $this->model->getRecordInfo($id, '3'); //녹취파일
|
||||
|
||||
$complexList = [];
|
||||
$ptpList = [];
|
||||
|
||||
// 아파트단지목록
|
||||
$complexList = $naver->complexList($data['address_code']);
|
||||
|
||||
// 평형목록
|
||||
$ptpList = $naver->ptpList($data['hscp_no']);
|
||||
|
||||
$hscp_info = [];
|
||||
if (!empty($data['hscp_no'])) {
|
||||
$apt_rlet_type_cd = ['A01', 'A02', 'A03', 'A04', 'B01', 'B02', 'B03'];
|
||||
$villa_rlet_type_cd = ['A05', 'A06'];
|
||||
|
||||
|
||||
if (in_array($data['rlet_type_cd'], $apt_rlet_type_cd)) { // apt 단지
|
||||
$detail_hscp = $naver->aptDetail($data['hscp_no']);
|
||||
}
|
||||
|
||||
if (in_array($data['rlet_type_cd'], $villa_rlet_type_cd)) { // villa 단지
|
||||
$detail_hscp = $naver->villaDetail($data['hscp_no']);
|
||||
}
|
||||
|
||||
$hscp_info = $detail_hscp['result'];
|
||||
|
||||
}
|
||||
|
||||
$this->data['codes'] = $codes;
|
||||
|
||||
$this->data['data'] = $data;
|
||||
@@ -145,10 +178,99 @@ class M704 extends BaseController
|
||||
$this->data['regist2'] = $regist2;
|
||||
$this->data['phone_list'] = $phone_list;
|
||||
$this->data['tel'] = $tel;
|
||||
$this->data['complexList'] = $complexList;
|
||||
$this->data['ptpList'] = $ptpList;
|
||||
$this->data['detail_hscp'] = $hscp_info;
|
||||
|
||||
return view("pages/v2/m704/detail", $this->data);
|
||||
}
|
||||
|
||||
// 상세정보 수정
|
||||
public function modifyInfo()
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
try {
|
||||
|
||||
$atcl_vr_sq = $this->request->post('rcpt_key', TRUE); //순번
|
||||
$atcl_hscp_nm = $this->request->getPost('atcl_hscp_nm'); //단지명
|
||||
$atcl_ptp_nm = $this->request->getPost('atcl_ptp_nm'); //평형명
|
||||
$atcl_vrfc_type = $this->request->getPost('atcl_vrtc_way'); //검증구분
|
||||
$trade_type = $this->request->getPost('trade_type_cd'); //거래구분
|
||||
$atcl_addr1 = $this->request->getPost('atcl_addr1'); //상세주소1 폐기예정
|
||||
$atcl_addr1a = $this->request->getPost('atcl_addr1a'); // 리 주소
|
||||
$atcl_addr1b = $this->request->getPost('atcl_addr1b'); // 공동 : 동 주소, 비공동 : 지번주소
|
||||
$atcl_addr2 = $this->request->getPost('atcl_addr2'); //상세주소2
|
||||
$atcl_hscp_no = $this->request->getPost('atcl_hscp_no'); //단지번호
|
||||
$atcl_ptp_no = $this->request->getPost('atcl_ptp_no'); //단지명
|
||||
$atcl_amt1 = $this->request->getPost('atcl_amt1');
|
||||
$atcl_amt2 = $this->request->getPost('atcl_amt2');
|
||||
$atcl_amt3 = $this->request->getPost('atcl_amt3');
|
||||
$atcl_amt4 = $this->request->getPost('atcl_amt4'); // 분양권매매 가격 2
|
||||
$isale_amt = $this->request->getPost('isale_amt'); // 분양가
|
||||
$prem_amt = $this->request->getPost('prem_amt'); // 프리미엄가
|
||||
$atcl_floor = $this->request->getPost('atcl_floor'); // 층
|
||||
$atcl_floor2 = $this->request->getPost('atcl_floor2'); // 총층
|
||||
|
||||
$result = $this->model->saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt);
|
||||
$resVrfc = $this->model->saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type);
|
||||
|
||||
if ($result['error_number'] != 0) {
|
||||
throw new \Exception($result['error_message']);
|
||||
} else {
|
||||
//API 호출
|
||||
$resultData = $this->model->getDetail($atcl_vr_sq);
|
||||
|
||||
$modifyInfo = $naver->modifyInfo(
|
||||
$resultData['data']['atcl_no'],
|
||||
$resultData['data']['hscp_no'],
|
||||
$resultData['data']['ptp_no'],
|
||||
$resultData['data']['bild_nm'],
|
||||
$resultData['data']['rm_no'],
|
||||
$resultData['data']['trade_type_cd'],
|
||||
$resultData['data']['deal_amt'],
|
||||
$resultData['data']['wrrnt_amt'],
|
||||
$resultData['data']['lease_amt'],
|
||||
$resultData['data']['isale_amt'],
|
||||
$resultData['data']['prem_amt'],
|
||||
$resultData['data']['floor'],
|
||||
$resultData['data']['floor2'],
|
||||
$resultData['data']['charger'],
|
||||
$resultData['data']['address_code'],
|
||||
$resultData['data']['address2'],
|
||||
$resultData['data']['address2a'],
|
||||
$resultData['data']['address2b'],
|
||||
$resultData['data']['address3'],
|
||||
$resultData['data']['sply_spc'],
|
||||
$resultData['data']['excls_spc'],
|
||||
$resultData['data']['tot_spc'],
|
||||
$resultData['data']['grnd_spc'],
|
||||
$resultData['data']['bldg_spc']
|
||||
);
|
||||
|
||||
if ($modifyInfo['result'] != 'success') { //결과값 확인
|
||||
$return = $modifyInfo['error'];
|
||||
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
|
||||
$err_time = date("Y-m-d H:i:s");
|
||||
$this->model->saveApiErr($atcl_vr_sq, $modifyInfo['error']['code'], $modifyInfo['error']['message'], $err_time, $resultData['data']['atcl_no']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 파일업로드
|
||||
public function uploadFile()
|
||||
{
|
||||
@@ -248,6 +370,470 @@ class M704 extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 전화실패
|
||||
public function contactFail()
|
||||
{
|
||||
try {
|
||||
|
||||
$vr_sq = $this->request->getPost('vr_sq');
|
||||
|
||||
// UPDATE v2_vrfc_req
|
||||
$this->model->saveContactFail($vr_sq);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 전화확인정보 저장
|
||||
public function saveTel()
|
||||
{
|
||||
/*
|
||||
1.0.1 POST 데이터 받기.
|
||||
1.1.1 1차 검증인지 2차검증인지 확인.
|
||||
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
|
||||
1.2.1 v2_confirms에 데이터가 있는지 확인.
|
||||
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
|
||||
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
|
||||
1.4.2 상태변경 하기 : 전화(서류)확인중 상태로 변경. (수정변경이력 저장)
|
||||
1.5.1 녹취파일 서버에 UPLOAD (수정변경이력 저장)
|
||||
1.6.1 기존파일 탐색.
|
||||
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
|
||||
1.8.1 기존파일 없음 : v2_files INSERT.
|
||||
1.9.1 개인정보 제공동의, 매물주소, 가격거래구분, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
|
||||
1.10.1 API 전송.
|
||||
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 전화(서류)확인완료 상태. (수정변경이력 저장)
|
||||
*/
|
||||
|
||||
$naver = new NaverApiClient();
|
||||
$model710 = new M710Model();
|
||||
$model415 = new M415Model();
|
||||
$v2DailyModel = new V2StDailyModel();
|
||||
|
||||
try {
|
||||
|
||||
$usr_id = session('usr_id');
|
||||
$toDay = date('Y-m-d H:i:s');
|
||||
$atcl_vrtc_way = $this->request->getPost('atcl_vrtc_way');
|
||||
$atcl_vr_sq = $this->request->getPost('rcpt_key');
|
||||
$tel_agree = $this->request->getPost('tel_agree');
|
||||
|
||||
// 개인정보 제공 동의가 승인일 경우 필수 필드 검증
|
||||
if ($tel_agree == '10000') {
|
||||
$validation = \Config\Services::validation();
|
||||
|
||||
$validation->setRules([
|
||||
'tel_conf_yn_2' => [
|
||||
'label' => '매물주소',
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
|
||||
],
|
||||
'tel_conf_yn_3' => [
|
||||
'label' => '가격 거래구분',
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
|
||||
],
|
||||
'tel_conf_yn_4' => [
|
||||
'label' => '의뢰인정보',
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
|
||||
],
|
||||
]);
|
||||
|
||||
if (!$validation->withRequest($this->request)->run()) {
|
||||
$errors = $validation->getErrors();
|
||||
throw new \Exception(implode(', ', $errors));
|
||||
}
|
||||
}
|
||||
|
||||
// POST 데이터 받기
|
||||
$tel_suc = $this->request->getPost('tel_suc');
|
||||
$tel_conf_yn_2 = $this->request->getPost('tel_conf_yn_2');
|
||||
$tel_conf_yn_3 = $this->request->getPost('tel_conf_yn_3');
|
||||
$tel_conf_yn_4 = $this->request->getPost('tel_conf_yn_4');
|
||||
$tel_conf_yn_5 = $this->request->getPost('tel_conf_yn_5');
|
||||
$tel_conf_yn_info_2 = $this->request->getPost('tel_conf_yn_info_2');
|
||||
$tel_conf_yn_info_3 = $this->request->getPost('tel_conf_yn_info_3');
|
||||
$tel_conf_yn_info_4 = $this->request->getPost('tel_conf_yn_info_4');
|
||||
$address_code = $this->request->getPost('address_code');
|
||||
$reg_chk_val = $this->request->getPost('reg_chk_val');
|
||||
$tel_file_yn = $this->request->getPost('tel_file_yn');
|
||||
$memo = $this->request->getPost('memo_tel');
|
||||
$tel_fail_cause = $this->request->getPost('tel_fail_cause');
|
||||
|
||||
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
|
||||
$resStat = $this->model->chkStat($atcl_vr_sq);
|
||||
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
|
||||
$reg_try_cnt = $this->model->getRegTry($atcl_vr_sq);
|
||||
$rlet_type_cd = $model415->get_rlet_type_cd($atcl_vr_sq);
|
||||
|
||||
$try_cnt = '0';
|
||||
if ($resStat['stat_cd'] >= '40' || $resStat['stat_cd'] == '19') {
|
||||
throw new \Exception('이미 저장된 데이터입니다.');
|
||||
} else {
|
||||
$this->model->InsCharger($atcl_vr_sq); //담당자가 없을 경우 강제로 session 정보로 넣어준다
|
||||
|
||||
$resultCnt = $this->model->chkTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
|
||||
$chkHistoryStat = $this->model->chkHistoryStat($atcl_vr_sq); // history에 등기부등본 확인중인적이 있는지 확인
|
||||
if ($resultCnt['try_cnt'] == 0) { //1차 검증일 때
|
||||
$try_cnt = '1';
|
||||
} else if ($resultCnt['try_cnt'] == 1) { //2차 검증일 때
|
||||
$try_cnt = '2';
|
||||
} else if ($resultCnt['try_cnt'] == 2) { //2차 검증이상 일 때
|
||||
$try_cnt = '2';
|
||||
} else {
|
||||
$try_cnt = intval($try_cnt) + 1;
|
||||
}
|
||||
|
||||
$result = $this->model->chkConfirm($atcl_vr_sq, '');
|
||||
|
||||
if ($result == 0) {
|
||||
if ($tel_conf_yn_2 == '10000' && $tel_conf_yn_3 == '10000' && $tel_conf_yn_4 == '10000') { //success 여부 판단
|
||||
$chk_type = '1';
|
||||
//$chk_delay = '0'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
} else {
|
||||
// 2015.06.29 추가
|
||||
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
|
||||
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
|
||||
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
|
||||
|
||||
$chk_type = '0';
|
||||
//$chk_delay = '1'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
|
||||
$result_tm = $this->m704_model->getUpdateFailTime($atcl_vr_sq);
|
||||
$update_tm = $result_tm['insert_tm'];
|
||||
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 10, date("s"), date("m"), date("d"), date("Y")));
|
||||
|
||||
if ($update_tm > $ten_ago) {
|
||||
throw new \Exception('이미 불일치 처리 된 매물입니다.');
|
||||
}
|
||||
|
||||
}
|
||||
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
|
||||
} else {
|
||||
if ($tel_conf_yn_2 == '10000' && $tel_conf_yn_3 == '10000' && $tel_conf_yn_4 == '10000') { //success 여부 판단
|
||||
$chk_type = '1';
|
||||
//$chk_delay = '0'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
} else {
|
||||
// 2015.06.29 추가
|
||||
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
|
||||
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
|
||||
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
|
||||
|
||||
$chk_type = '0';
|
||||
//$chk_delay = '1'; //지연여부
|
||||
//$chk_zombie = '0'; //좀비매물
|
||||
|
||||
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
|
||||
$update_tm = $result_tm['insert_tm'];
|
||||
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 10, date("s"), date("m"), date("d"), date("Y")));
|
||||
|
||||
if ($update_tm > $ten_ago) {
|
||||
throw new \Exception('이미 불일치 처리 된 매물입니다.');
|
||||
}
|
||||
}
|
||||
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
|
||||
}
|
||||
|
||||
//v2_vrfc_req INSERT//상태변경 TABLE INSERT : 전화(서류)확인중 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '30', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '30');
|
||||
|
||||
// 불일치건이면서 등기부등본 불일치 1회 이상일 경우 초기상태를 등기부등본 상태로 변경
|
||||
if ($chk_type == '0' && $reg_try_cnt['reg_try_cnt'] == '1') {
|
||||
$this->model->chgStat($atcl_vr_sq, '40', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '40');
|
||||
}
|
||||
|
||||
|
||||
if ($chk_type == '0' && ($reg_try_cnt['reg_try_cnt'] == '1' || $reg_try_cnt['reg_try_cnt'] == '2')) { // $reg_try_cnt['reg_try_cnt'] 는 등기부등본 실패횟수
|
||||
log_message('debug', 'm704 insertChkList : ' . $atcl_vr_sq);
|
||||
//v2_check_list 매물정보확인 INSERT : 전화매물확인 페이지에서 통신하는 등기부등본 확인 API이므로 값을 강제로 넣어줌.
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '21', '20000', '불일치');
|
||||
|
||||
//v2_check_list 의뢰인정보 INSERT : 전화매물확인 페이지에서 통신하는 등기부등본 확인 API이므로 값을 강제로 넣어줌.
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '22', '20000', '불일치');
|
||||
|
||||
} else {
|
||||
//v2_check_list 확인여부 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T11', $tel_agree, '');
|
||||
|
||||
if ($tel_agree == '10000') {
|
||||
//v2_check_list 매물주소 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T12', $tel_conf_yn_2, $tel_conf_yn_info_2);
|
||||
|
||||
//v2_check_list 가격거래구분 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T13', $tel_conf_yn_3, $tel_conf_yn_info_3);
|
||||
|
||||
//v2_check_list 의뢰인정보 INSERT
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T14', $tel_conf_yn_4, $tel_conf_yn_info_4);
|
||||
} else {
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T12');
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T13');
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T14');
|
||||
}
|
||||
if (!empty($tel_conf_yn_5)) {
|
||||
// $this->m704_model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15', $tel_conf_yn_5, $tel_conf_yn_5);
|
||||
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15', $tel_conf_yn_5, '');
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T11');
|
||||
} else {
|
||||
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//memo 저장
|
||||
if (!empty($memo)) {
|
||||
$this->model->saveMemo(['vr_sq' => $atcl_vr_sq, 'memo' => $memo]);
|
||||
}
|
||||
//전화실패 사유 저장
|
||||
if (!empty($tel_fail_cause)) {
|
||||
$this->model->up_tel_fail_cause($atcl_vr_sq, $tel_fail_cause);
|
||||
}
|
||||
|
||||
//확인정보 수정 로그 찍기
|
||||
log_message('debug', 'checking >> 검증횟수(등기부등본) : ' . $reg_try_cnt['reg_try_cnt'] . '/' . ' >> chk_type : ' . $chk_type . ' 매물번호 : ' . $atcl_vr_sq);
|
||||
|
||||
// 전화서류가 불일치이고 등기부등본 실패횟수가 1회일 때 바로 등기부등본 불일치 >> 검증실패 처리
|
||||
// [s] 2015.09.08 등기부등본 검증 API 추가
|
||||
if ($chk_type == '0' && ($reg_try_cnt['reg_try_cnt'] == '1' || $reg_try_cnt['reg_try_cnt'] == '2')) {
|
||||
log_message('debug', '704 page (등기부등본 불일치) >> before call api / 매물번호 : ' . $atcl_vr_sq);
|
||||
|
||||
//☆
|
||||
$sendData = $this->model->getDatacertAPI($atcl_vr_sq, 'R');
|
||||
$t_yn = $model710->get_send_yn('T');
|
||||
|
||||
if ($t_yn['stop_yn'] == 'N') { //전송금지
|
||||
//1.해당매물정보를v2_stop_api_save_info에다 넣음
|
||||
$model710->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'T2', '');
|
||||
//2.아무렇지않게 행동한다
|
||||
$send_result['result'] = 'success';
|
||||
} else {
|
||||
//API 호출
|
||||
$send_result = $naver->certification($sendData['atclNo'], $try_cnt, $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['date'], $sendData['modifyInfo'], $sendData['ownerVerifiable']);
|
||||
}
|
||||
|
||||
if ($send_result['result'] == 'success') {
|
||||
log_message('debug', '704 page (등기부등본 불일치) >> success call api / 매물번호 : ' . $atcl_vr_sq);
|
||||
|
||||
// 전화서류를 처리한 모든건을 카운트 하는
|
||||
$result_query1 = $this->model->chgStat($atcl_vr_sq, '38', $toDay);
|
||||
|
||||
//상태변경 TABLE INSERT : 등기부등본 불일치 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '49', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
|
||||
|
||||
$this->model->chgRegTryCnt($atcl_vr_sq, '2');
|
||||
|
||||
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
|
||||
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
|
||||
$this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
|
||||
|
||||
//★검증실패
|
||||
if ($atcl_vrtc_way == 'M' || $atcl_vrtc_way == 'O') { //모바일은 등기가 첨 시작이니까 insert해줘야함
|
||||
if (!($atcl_vrtc_way == 'M' && in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03')))) {//만약 분양권들이면 넘어가고 아니면 체크
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인실패 시간
|
||||
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
//3.검증실패시간
|
||||
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_way, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
}
|
||||
} else {
|
||||
//1.등기부등본 확인중 시간
|
||||
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
|
||||
//2.등기부등본 확인실패 시간
|
||||
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_way, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0302', '1', 'add'); // 최종실패로 저장
|
||||
} else {
|
||||
if (isset($send_result['error'])) {
|
||||
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
|
||||
|
||||
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
|
||||
$err_time = date("Y-m-d H:i:s");
|
||||
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
|
||||
throw new \Exception($error_message);
|
||||
} else {
|
||||
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sendData = $this->model->getDataConfirmAPI($atcl_vr_sq);
|
||||
|
||||
$t_yn = $model710->get_send_yn('T');
|
||||
|
||||
if ($t_yn['stop_yn'] == 'N') { //전송금지
|
||||
//1.해당매물정보를v2_stop_api_save_info에다 넣음
|
||||
$model710->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'T1', '');
|
||||
//2.아무렇지않게 행동한다
|
||||
$send_result['result'] = 'success';
|
||||
} else {
|
||||
//API 호출
|
||||
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
|
||||
}
|
||||
|
||||
if ($send_result['result'] == 'success' || $send_result['error']['code'] == 'VC013') {
|
||||
// 검증단계가 상이하더라도 상태값이 변경될 수 있도록 함.
|
||||
if ($tel_agree == '10000' && $chk_type == '1') {
|
||||
//상태변경 TABLE INSERT : 전화(서류)확인 완료 상태로 변경
|
||||
$this->model->chgStat($atcl_vr_sq, '35', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '35'); //v2_vrfc_req INSERT
|
||||
|
||||
// 전화서류를 처리한 모든건을 카운트
|
||||
$this->model->chgStat($atcl_vr_sq, '38', $toDay);
|
||||
|
||||
if ($reg_chk_val == '1') {
|
||||
|
||||
//등기부등본 확인 대상은 전화(서류)확인 완료 후 -> 등기부등본 확인중 상태로 변경.
|
||||
$result_query8 = $this->model->chgStat($atcl_vr_sq, '40', $toDay);
|
||||
$chgVrfc40 = $this->model->chgStatVrfc($atcl_vr_sq, '40'); //v2_vrfc_req INSERT
|
||||
|
||||
//★등기 로 넘어갈때
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 확인일자
|
||||
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$sf = 'T';
|
||||
$model415->insert_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $sf);
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0201', '1', 'add'); // 일치로 저장
|
||||
} else {
|
||||
//등기부등본 확인 대상이 아닌 경우 전화(서류)확인 완료 후 -> 검증 완료 상태로 변경.
|
||||
$result_query8 = $this->model->chgStat($atcl_vr_sq, '60', $toDay);
|
||||
$chgVrfc40 = $this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
|
||||
|
||||
//★검증완료일때
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 확인일자
|
||||
$tel_doc_conf_dt = $model415->getConfTimeForHistory($atcl_vr_sq);
|
||||
//3.검증완료시간
|
||||
$finishTime = $model415->get_60_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
}
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0206', '1', 'add'); // 전화확인완료 등기부등본확인 안함 저장
|
||||
}
|
||||
} else {
|
||||
if ($try_cnt == '1') {
|
||||
// 전화서류를 처리한 모든건을 카운트
|
||||
$result_query19 = $this->model->chgStat($atcl_vr_sq, '38', $toDay);
|
||||
|
||||
//상태변경 TABLE INSERT : 전화(서류)확인 불일치 상태로 변경
|
||||
$result_query7 = $this->model->chgStat($atcl_vr_sq, '39', $toDay);
|
||||
$chgVrfc35 = $this->model->chgStatVrfc($atcl_vr_sq, '39'); //v2_vrfc_req INSERT
|
||||
|
||||
//★불일치
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 불일치 시간
|
||||
$tel_doc_conf_dt = $model415->getFaxFailTimeForHistory($atcl_vr_sq);
|
||||
//3.해당 정보를 테이블에 넣는다
|
||||
$sf = 'F';
|
||||
$model415->insert_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $sf);
|
||||
}
|
||||
|
||||
//v2_vrfc_req try_cnt 값을 1로 update
|
||||
$res_try = $this->model->chgTryCnt($atcl_vr_sq, '1');
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0301', '1', 'add'); // 1차실패로 저장
|
||||
} else if ($try_cnt == '2') { //상태변경 TABLE INSERT : 전화(서류)확인 불일치 상태로 변경
|
||||
// 전화서류를 처리한 모든건을 카운트
|
||||
$this->model->chgStat($atcl_vr_sq, '38', $toDay);
|
||||
|
||||
$this->model->chgStat($atcl_vr_sq, '39', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '39'); //v2_vrfc_req INSERT
|
||||
|
||||
//v2_vrfc_req try_cnt 값을 2로 update
|
||||
$this->model->chgTryCnt($atcl_vr_sq, '2');
|
||||
|
||||
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
|
||||
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
|
||||
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
|
||||
|
||||
//★ 검증실패
|
||||
//0.통화실패 여부를 확인한다
|
||||
$cnt = $this->model->getCallfailForHistory($atcl_vr_sq);
|
||||
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
|
||||
//1.서류전화 들어온시간
|
||||
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
|
||||
//2.서류/전화 불일치 시간
|
||||
$tel_doc_conf_dt = $model415->getFaxFailTimeForHistory($atcl_vr_sq);
|
||||
//3.검증실패시간
|
||||
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
|
||||
//4.해당 정보를 테이블에 넣는다
|
||||
$model415->insert_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $finishTime['insert_tm']);
|
||||
}
|
||||
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0302', '1', 'add'); // 최종실패로 저장
|
||||
}
|
||||
|
||||
if (in_array($tel_agree, array('20001', '20002'))) {
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0203', '1', 'add'); // 거부로 저장
|
||||
} elseif (in_array($tel_agree, array('20003', '20004', '20005'))) {
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0204', '1', 'add'); // 무응답 외
|
||||
} else {
|
||||
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0202', '1', 'add'); // 불일치
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (isset($send_result['error'])) {
|
||||
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
|
||||
|
||||
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
|
||||
$err_time = date("Y-m-d H:i:s");
|
||||
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
|
||||
throw new \Exception($error_message);
|
||||
} else {
|
||||
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 다음 매물정보 조회
|
||||
public function getNextTelInfo()
|
||||
|
||||
73
app/Controllers/V2/V2StDailyModel.php
Normal file
73
app/Controllers/V2/V2StDailyModel.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace App\Controllers\V2;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class V2StDailyModel extends Model
|
||||
{
|
||||
/**
|
||||
* 일자별 통계데이터에 값 집어 넣기...
|
||||
* 반환값 없음.
|
||||
* @param date $sd_date 날짜 값이 없을경우 현재날짜로 입력됨.
|
||||
* @param string $cpid CPID
|
||||
* @param string $gbn_cd 코드값 (category='STATISTICS_DAILY3')
|
||||
* @param int $cnt 더할 숫자..
|
||||
* @param string $cnt_type 숫자를 더할것인지.. 아니변 변경할것인지.
|
||||
*/
|
||||
public function set_v2_st_daily($st_date, $cpid, $gbn_cd, $cnt, $cnt_type = 'add')
|
||||
{
|
||||
/**
|
||||
* insert into v2_st_daily (sd_date, cpid, gbn_cd, cnt) values ($sd_date, $cpid, $gbn_cd, $cnt)
|
||||
* on duplicate key update cnt = values(cnt); // $cnt_type='change'
|
||||
* on duplicate key update cnt = cnt + $cnt; // $cnt_type='add'
|
||||
*/
|
||||
if (empty($cnt))
|
||||
$cnt = '0';
|
||||
|
||||
$sql_dup = "";
|
||||
switch (strtolower($cnt_type)) {
|
||||
case 'add':
|
||||
$sql_dup = "on duplicate key update cnt = cnt + " . $cnt;
|
||||
break;
|
||||
|
||||
case 'change':
|
||||
$sql_dup = "on duplicate key update cnt = values(cnt)";
|
||||
break;
|
||||
}
|
||||
if (empty($st_date)) {
|
||||
$sql = "insert into v2_st_daily (st_date, cpid, gbn_cd, cnt) values (now(), ?, ?, ?)" . $sql_dup;
|
||||
$data = array(
|
||||
$cpid,
|
||||
$gbn_cd,
|
||||
$cnt
|
||||
);
|
||||
} else {
|
||||
$sql = "insert into v2_st_daily (st_date, cpid, gbn_cd, cnt) values (?, ?, ?, ?)" . $sql_dup;
|
||||
$data = array(
|
||||
$st_date,
|
||||
$cpid,
|
||||
$gbn_cd,
|
||||
$cnt
|
||||
);
|
||||
}
|
||||
$this->db->query($sql, $data);
|
||||
|
||||
$return['error_number'] = $this->db->_error_number();
|
||||
$return['error_message'] = $this->db->_error_message();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 지정한 매물의 요청번호를 이용하여 요청내역을 가져온다.
|
||||
*/
|
||||
public function get_v2_vrfc_req($vr_sq)
|
||||
{
|
||||
$columns = "vr_sq,atcl_no,step,cpid,cp_atcl_id,trade_type,realtor_nm,realtor_tel_no,seller_tel_no,vrfc_type,rgbk_confirm,req_type,rdate,stat_cd,try_cnt,insert_user,insert_tm,memo,contact_fail_cnt,sync_yn,reg_try_cnt";
|
||||
$builder = $this->db->table('v2_vrfc_req');
|
||||
$builder->select($columns, false);
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$row = $builder->get()->getRowArray();
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
57
app/Libraries/FormValidation.php
Normal file
57
app/Libraries/FormValidation.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries;
|
||||
|
||||
class FormValidation
|
||||
{
|
||||
/**
|
||||
* 한글, 영문, 숫자, 대시, 언더바만 가능하게 한다. utf-8 기준.
|
||||
*
|
||||
* @param string $str 검증할 문자열
|
||||
* @param string|null $error 에러 메시지 (참조로 전달)
|
||||
* @return bool
|
||||
*/
|
||||
public function korean_alpha_dash(string $str, ?string &$error = null): bool
|
||||
{
|
||||
if (!preg_match('/^[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}0-9a-zA-Z_-]+$/u', $str)) {
|
||||
$error = '한글, 영문, 숫자, 대시, 언더바만 입력 가능합니다.';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열 형식이 Date가 맞는지 확인한다.
|
||||
*
|
||||
* @param string $str 검증할 날짜 문자열
|
||||
* @param string $format 날짜 형식 (기본값: Y-m-d)
|
||||
* @param string|null $error 에러 메시지 (참조로 전달)
|
||||
* @return bool
|
||||
*/
|
||||
public function is_date(string $str, string $format = 'Y-m-d', ?string &$error = null): bool
|
||||
{
|
||||
try {
|
||||
if (empty($format)) {
|
||||
$format = 'Y-m-d';
|
||||
}
|
||||
|
||||
$date = strtotime($str);
|
||||
|
||||
if ($date === false) {
|
||||
$error = '올바른 날짜 형식이 아닙니다.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$strDate = date($format, $date);
|
||||
|
||||
if (strcmp($str, $strDate) !== 0) {
|
||||
$error = "날짜 형식이 {$format}와 일치하지 않습니다.";
|
||||
return false;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$error = '날짜 검증 중 오류가 발생했습니다.';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,20 @@
|
||||
|
||||
namespace App\Libraries;
|
||||
|
||||
use App\Models\common\CommonModel;
|
||||
|
||||
class NaverApiClient
|
||||
{
|
||||
protected $baseUrl = 'https://test-b2b.land.naver.com';
|
||||
protected $charger = '';
|
||||
|
||||
private $commonModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->commonModel = new CommonModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* [GET] 매물 정보 조회
|
||||
*/
|
||||
@@ -27,7 +36,7 @@ class NaverApiClient
|
||||
{
|
||||
$this->charger = $charger;
|
||||
$url = "{$this->baseUrl}/kiso/center/verification-article/{$articleNumber}?charger={$this->charger}";
|
||||
|
||||
|
||||
return $this->request('PUT', $url, $updateData);
|
||||
}
|
||||
|
||||
@@ -59,6 +68,212 @@ class NaverApiClient
|
||||
return $this->request('GET', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 단지상세정보조회
|
||||
* hscpNo : 단지번호(숫자)
|
||||
*/
|
||||
public function aptDetail($hscpNo)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(2);
|
||||
$url = $url['api_server'] . "/confirms/APTDetail?hscpNo={$hscpNo}";
|
||||
return $this->request('GET', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 빌라 단지상세정보 조회
|
||||
* hscpNo : 단지번호(숫자)
|
||||
*/
|
||||
|
||||
public function villaDetail($hscpNo)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(2);
|
||||
$url = $url['api_server'] . "/confirms/villa/{$hscpNo}";
|
||||
return $this->request('GET', $url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 단지목록
|
||||
* cortarNo : 법정동코드
|
||||
*/
|
||||
public function complexList($cortarNo)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(2);
|
||||
$url = $url['api_server'] . "/common/complexList.nhn?cortarNo={$cortarNo}";
|
||||
return $this->request('GET', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 평형목록
|
||||
* rletNo : 단지번호
|
||||
*/
|
||||
public function ptpList($rletNo)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(2);
|
||||
$url = $url['api_server'] . "/common/ptpList.nhn?rletNo={$rletNo}";
|
||||
return $this->request('GET', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 가격수정
|
||||
* @param String atclNo 매물번호
|
||||
* @param integer dealAmt 매매가, 전세(보증금) 단위 : 만원
|
||||
* @param integer wrrntAmt 전세가(보증금) 단위 : 만원
|
||||
* @param integer leaseAmt 월세가 단위 : 만원
|
||||
* @param integer isaleAmt 분양가 단위 : 만원
|
||||
* @param integer premAmt 프리미엄 단위 : 만원
|
||||
* @param integer charger 담당자id
|
||||
*/
|
||||
public function priceChange($atclNo, $dealAmt, $wrrntAmt, $leaseAmt, $isaleAmt, $premAmt, $charger)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(3);
|
||||
$url = $url['api_server'] . "/confirms/priceChange";
|
||||
|
||||
$postData = [
|
||||
"atclNo" => $atclNo,
|
||||
"dealAmt" => $dealAmt,
|
||||
"wrrntAmt" => $wrrntAmt,
|
||||
"leaseAmt" => $leaseAmt,
|
||||
"isaleAmt" => $isaleAmt,
|
||||
"premAmt" => $premAmt,
|
||||
"charger" => $charger
|
||||
];
|
||||
|
||||
return $this->request('POST', $url, $postData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 매물정보수정
|
||||
* @param String atclNo 매물번호
|
||||
* @param integer hscpNo 단지번호
|
||||
* @param integer ptpNo 평형번호
|
||||
* @param String bildNm 동이름
|
||||
* @param String rmNo 호수
|
||||
* @param String tradeType 거래종류(A1,B1,B2 / 변경시 B1 <-> B2만 가능)
|
||||
* @param integer dealAmt 매매가, 전세(보증금) 단위 : 만원
|
||||
* @param integer wrrntAmt 전세가(보증금) 단위 : 만원
|
||||
* @param integer leaseAmt 월세가 단위 : 만원
|
||||
* @param integer isaleAmt 분양가 단위 : 만원
|
||||
* @param integer premAmt 프리미엄 단위 : 만원
|
||||
* @param integer floor 층
|
||||
* @param integer charger 담당자id
|
||||
*
|
||||
* @param String addressCode 주소코드 : 비공동 주택 법정동 코드
|
||||
* @param String address2 지번주소 : 비공동 주택 지번 주소
|
||||
* @param String address3 기타주소 : 비공동 주택 기타 주소
|
||||
* @param float splySpc 공급면적
|
||||
* @param float exclsSpc 대지면적
|
||||
* @param float totSpc 전체면적
|
||||
* @param float grndSpc 대지면적
|
||||
* @param float bldgSpc 건축면적
|
||||
*
|
||||
*/
|
||||
public function modifyInfo($atclNo, $hscpNo, $ptpNo, $bildNm, $rmNo, $tradeType, $dealAmt, $wrrntAmt, $leaseAmt, $isaleAmt, $premAmt, $floor, $floor2, $charger, $addressCode, $address2, $address2a, $address2b, $address3, $splySpc, $exclsSpc, $totSpc, $grndSpc, $bldgSpc)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(3);
|
||||
$url = $url['api_server'] . "/confirms/modifyInfo";
|
||||
|
||||
// 공통
|
||||
$postData = [
|
||||
"atclNo" => $atclNo,
|
||||
"tradeType" => $tradeType,
|
||||
"dealAmt" => $dealAmt,
|
||||
"wrrntAmt" => $wrrntAmt,
|
||||
"leaseAmt" => $leaseAmt,
|
||||
"isaleAmt" => $isaleAmt,
|
||||
"charger" => $charger
|
||||
];
|
||||
|
||||
// 공동주택
|
||||
$apartData["hscpNo"] = $hscpNo;
|
||||
$apartData["ptpNo"] = $ptpNo;
|
||||
$apartData["bildNm"] = $address2; // 네이버에서 보내주는거랑 수정되어 전달하는 거랑 다른 타입임. 2014년 11월 13일 수정
|
||||
$apartData["rmNo"] = $address3; // 네이버에서 보내주는거랑 수정되어 전달하는 거랑 다른 타입임. 2014년 11월 13일 수정
|
||||
// $apartData["bildNm"] = $bildNm;
|
||||
// $apartData["rmNo"] = $rmNo;
|
||||
$apartData["premAmt"] = $premAmt;
|
||||
$apartData["floor"] = $floor;
|
||||
$apartData["floor2"] = $floor2;
|
||||
|
||||
// 비공동주택 연동
|
||||
$detachData["addressCode"] = $addressCode;
|
||||
$detachData["address2"] = $address2;
|
||||
$detachData["address2a"] = $address2a;
|
||||
$detachData["address2b"] = $address2b;
|
||||
$detachData["address3"] = $address3;
|
||||
$detachData["splySpc"] = $splySpc;
|
||||
$detachData["exclsSpc"] = $exclsSpc;
|
||||
$detachData["totSpc"] = $totSpc;
|
||||
$detachData["grndSpc"] = $grndSpc;
|
||||
$detachData["bldgSpc"] = $bldgSpc;
|
||||
$detachData["floor"] = $floor;
|
||||
$detachData["floor2"] = $floor2;
|
||||
|
||||
if (!empty($hscpNo)) { //공동주택일 때
|
||||
$postData = array_merge($postData, $apartData);
|
||||
} else { //비공동주택일 때
|
||||
$postData = array_merge($postData, $detachData);
|
||||
}
|
||||
|
||||
return $this->request('POST', $url, $postData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 검증결과 전송
|
||||
* @param String atclNo 매물번호
|
||||
* @param boolean success 성공여부
|
||||
* @param array checkList 확인정보 array('type'=>'T11','code'=>'10000','comment'=>'01|02|03'); 또는 array('type'=>'T11','code'=>'10000','comment'=>'코멘트');
|
||||
* @param String charger 담당자 사번
|
||||
* @param array modifyInfo 공동 비공동에 따라 다른 배열을 넘긴다.
|
||||
* @param String date 상담일시
|
||||
*/
|
||||
public function confirm($atclNo, $success, $checkList, $charger, $modifyInfo, $date)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(3);
|
||||
$url = $url['api_server'] . "/confirms/confirm";
|
||||
|
||||
$postData = [
|
||||
"atclNo" => $atclNo,
|
||||
"success" => $success,
|
||||
"checkList" => $checkList,
|
||||
"charger" => $charger,
|
||||
"modifyInfo" => $modifyInfo,
|
||||
"date" => $date,
|
||||
];
|
||||
|
||||
return $this->request('POST', $url, $postData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 등기부 등본 확인 결과
|
||||
* @param String atclNo 매물번호
|
||||
* @param String type 1: 1차 확인(등기부확인) / 2: 2차 확인(최종확인 또는 중개업소 TM)
|
||||
* @param boolean success 성공여부
|
||||
* @param array checkList 확인정보
|
||||
* @param String charger 담당자 사번
|
||||
* @param String date 상담일시
|
||||
* @param array modifyInfo 수정정보 - success:true 에서만 허용
|
||||
*/
|
||||
public function certification($atclNo, $type, $success, $checkList, $charger, $date, $modifyInfo, $ownerVerifiable)
|
||||
{
|
||||
$url = $this->commonModel->getCompanyInfo(3);
|
||||
$url = $url['api_server'] . "/confirms/certification";
|
||||
|
||||
$postData = [
|
||||
"atclNo" => $atclNo,
|
||||
"type" => $type,
|
||||
"success" => $success,
|
||||
"checkList" => $checkList,
|
||||
"charger" => $charger,
|
||||
"date" => $date,
|
||||
"modifyInfo" => $modifyInfo,
|
||||
"ownerVerifiable" => $ownerVerifiable
|
||||
];
|
||||
|
||||
return $this->request('POST', $url, $postData);
|
||||
}
|
||||
|
||||
/**
|
||||
* CURL 공통 실행 함수
|
||||
*/
|
||||
|
||||
@@ -17,4 +17,12 @@ class CommonModel extends Model
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function getCompanyInfo($compSq)
|
||||
{
|
||||
$sql = "SELECT api_server, api_key, comp_nm FROM companies WHERE comp_sq = ?";
|
||||
$data = [$compSq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
return $query->getRowArray();
|
||||
}
|
||||
}
|
||||
@@ -191,6 +191,42 @@ class M415Model extends Model
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 서류/전화 확인완료 시간 = 등기부등본 확인중 시간
|
||||
public function getConfTimeForHistory($vr_sq)
|
||||
{
|
||||
$sql = "select insert_tm from v2_chg_history" .
|
||||
" where vr_sq = ?" .
|
||||
" and stat_cd = '35'" .
|
||||
" and chg_type= 'C9'" .
|
||||
" order by seq desc" .
|
||||
" limit 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res = $query->getRowArray();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 검증완료 시간
|
||||
public function get_60_ForHistory($vr_sq)
|
||||
{
|
||||
$sql = "select insert_tm from v2_chg_history" .
|
||||
" where vr_sq = ?" .
|
||||
" and stat_cd = '60'" .
|
||||
" and chg_type= 'C9'" .
|
||||
" order by seq desc" .
|
||||
" limit 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res = $query->getRowArray();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 등기부등본 확인중 시간, 서류에서 등기로 넘어갈때 간혹 서류전화 확인 완료가 안찍히는 건들이 있다
|
||||
public function get_cert_ing_TimeForHistory($vr_sq)
|
||||
{
|
||||
@@ -338,4 +374,214 @@ class M415Model extends Model
|
||||
);
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
//전화확인 - 통화실패 카운트
|
||||
public function getCallfailForHistory($vr_sq)
|
||||
{
|
||||
$sql = "SELECT 'x' from v2_chg_history" .
|
||||
" WHERE vr_sq = ?" .
|
||||
" AND chg_type= 'C29'" .
|
||||
" ORDER BY seq desc" .
|
||||
" LIMIT 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res = $query->getRowArray();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 서류/전화 인입시간
|
||||
public function getSaveTimeForHistory($vr_sq)
|
||||
{
|
||||
$sql = "select insert_tm from v2_chg_history" .
|
||||
" where vr_sq = ?" .
|
||||
" and stat_cd = '30'" .
|
||||
" and chg_type= 'C9'" .
|
||||
" order by seq desc" .
|
||||
" limit 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
|
||||
$res = $query->getRowArray();
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 등기부등본 확인실패 시간
|
||||
public function get_cert_failTimeForHistory($vr_sq)
|
||||
{
|
||||
$sql = "select insert_tm from v2_chg_history" .
|
||||
" where vr_sq = ?" .
|
||||
" and stat_cd = '49'" .
|
||||
" and chg_type= 'C9'" .
|
||||
" order by seq desc" .
|
||||
" limit 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res = $query->getRowArray();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
//등기부등본 확인완료(모바일)
|
||||
public function insert_v2_time_required_M($atcl_no, $cpid, $vrfc_type, $insert_tm, $cert_comple_dt, $finishTime)
|
||||
{
|
||||
if (substr($insert_tm, 0, 10) == substr($cert_comple_dt, 0, 10)) {
|
||||
if (('12:00:00' < substr($insert_tm, -8)) && (substr($insert_tm, -8) < '13:00:00')) {//접수시간이 12~13시 사이면 13시로 해준다
|
||||
if ($cert_comple_dt > '13:00:00') { //검증완료가 13시 '이후'에 끝나면 접수시간을 13시로 변경해준다
|
||||
$insert_tm = date("Y-m-d", time()) . " 13:00:00";
|
||||
}
|
||||
} else if (
|
||||
(substr($insert_tm, -8) > '17:30:00' || substr($insert_tm, -8) < '08:59:59') && //접수와 확인완료시간이 모두 17:30:00 ~ 09:00:00 사이가 아니면
|
||||
(substr($cert_comple_dt, -8) < '17:30:00' || substr($cert_comple_dt, -8) < '08:59:59')
|
||||
) {
|
||||
$insert_tm = date("Y-m-d", time()) . " 09:00:00";
|
||||
}
|
||||
} else {
|
||||
if (substr($insert_tm, -8) > '17:30:00' || substr($insert_tm, -8) < '08:59:59') {
|
||||
$insert_tm = date("Y-m-d", time()) . " 09:00:00";
|
||||
}
|
||||
}
|
||||
$stan_date = substr($insert_tm, 0, 10);
|
||||
|
||||
$sql = "INSERT INTO v2_time_required(stan_date, atcl_no, cpid, vrfc_type, insert_tm, cert_comple_dt, cert_required_tm, tot_required_tm)" .
|
||||
" VALUES(?, ?, ?, ?, ?, ?, TIMEDIFF(?,?), TIMEDIFF(?,?)) " .
|
||||
" ON DUPLICATE KEY UPDATE insert_tm = VALUES(insert_tm), tel_doc_conf_dt=VALUES(tel_doc_conf_dt),conf_required_tm = VALUES(conf_required_tm),tot_required_tm = VALUES(tot_required_tm) ";
|
||||
$data = array(
|
||||
$stan_date,
|
||||
$atcl_no,
|
||||
$cpid,
|
||||
$vrfc_type,
|
||||
$insert_tm,
|
||||
$cert_comple_dt,
|
||||
$cert_comple_dt,
|
||||
$insert_tm,
|
||||
$cert_comple_dt,
|
||||
$insert_tm
|
||||
);
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
//등기부등본 확인완료(불일치)
|
||||
public function update_v2_time_required_Conf($atcl_no, $cpid, $vrfc_type, $tel_doc_conf_dt, $cert_comple_dt, $sf)
|
||||
{
|
||||
if ($sf == 'F') {
|
||||
if (substr($tel_doc_conf_dt, 0, 10) == substr($cert_comple_dt, 0, 10)) {
|
||||
if (('12:00:00' < substr($tel_doc_conf_dt, -8)) && (substr($tel_doc_conf_dt, -8) < '13:00:00')) {//전서확인시간이 12~13시 사이면 13시로 해준다
|
||||
// if (substr($finishTime, -8) > '13:00:00'){ //등본완료가 13시 '이후'에 끝나면 전서확인시간을 13시로 변경해준다
|
||||
// $tel_doc_conf_dt = date("Y-m-d",time())." 13:00:00";
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql = "UPDATE v2_time_required " .
|
||||
" SET cert_comple_dt = ?" .
|
||||
" ,cert_required_tm = TIMEDIFF(?,?)" .//등본 소요시간 = 등본완료시간-전/서확인완료시간
|
||||
" WHERE atcl_no = ?";
|
||||
$data = array(
|
||||
$cert_comple_dt,
|
||||
$cert_comple_dt,
|
||||
$tel_doc_conf_dt,
|
||||
$atcl_no
|
||||
);
|
||||
$this->db->query($sql, $data);
|
||||
// echo $this->db->last_query().'<br>';
|
||||
}
|
||||
|
||||
// 최초! 등기부등본 확인중 시간-모바일용
|
||||
public function get_cert_M_timeForHistory($vr_sq)
|
||||
{
|
||||
$sql = "select insert_tm from v2_chg_history" .
|
||||
" where vr_sq = ?" .
|
||||
" and stat_cd = '40'" .
|
||||
" and chg_type= 'C9'" .
|
||||
" limit 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res = $query->getRowArray();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 등기부등본 확인완료 시간
|
||||
public function get_cert_confTimeForHistory($vr_sq)
|
||||
{
|
||||
$sql = "select insert_tm from v2_chg_history" .
|
||||
" where vr_sq = ?" .
|
||||
" and stat_cd = '45'" .
|
||||
" and chg_type= 'C9'" .
|
||||
" order by seq desc" .
|
||||
" limit 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res = $query->getRowArray();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 검증실패 시간
|
||||
public function get_69_ForHistory($vr_sq)
|
||||
{
|
||||
$sql = "select insert_tm from v2_chg_history" .
|
||||
" where vr_sq = ?" .
|
||||
" and stat_cd = '69'" .
|
||||
" and chg_type= 'C9'" .
|
||||
" order by seq desc" .
|
||||
" limit 1";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res = $query->getRowArray();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
//등기부등본 확인완료(일치/불일치), 검증완료/실패까지 갈때만!
|
||||
public function update_v2_time_required_Conf_Done($atcl_no, $cpid, $vrfc_type, $tel_doc_conf_dt, $cert_comple_dt)
|
||||
{
|
||||
//1.검증소요시간 가져온다
|
||||
$sql = "SELECT conf_required_tm" .
|
||||
" FROM v2_time_required" .
|
||||
" WHERE atcl_no = ?";
|
||||
$data = array(
|
||||
$atcl_no
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
|
||||
$res = $query->row_array();
|
||||
|
||||
if (substr($tel_doc_conf_dt, 0, 10) == substr($cert_comple_dt, 0, 10)) {
|
||||
if (('12:00:00' < substr($tel_doc_conf_dt, -8)) && (substr($tel_doc_conf_dt, -8) < '13:00:00')) {//전서확인시간이 12~13시 사이면 13시로 해준다
|
||||
if (substr($cert_comple_dt, -8) > '13:00:00') { //등본완료가 13시 '이후'에 끝나면 전서확인시간을 13시로 변경해준다
|
||||
$tel_doc_conf_dt = date("Y-m-d", time()) . " 13:00:00";
|
||||
}
|
||||
}
|
||||
}
|
||||
//2.등본소요시간, 등본완료시간, 총소요시간을 넣는다
|
||||
$sql = "UPDATE v2_time_required " .
|
||||
" SET cert_comple_dt = ?" .
|
||||
" ,cert_required_tm = TIMEDIFF(?,?)" . //등본 소요시간 = 등본완료시간-전/서확인완료시간
|
||||
" ,tot_required_tm = ADDTIME(?,TIMEDIFF(?,?))" .//총소요시간 = 검증소요시간+등본소요시간
|
||||
" WHERE atcl_no = ?";
|
||||
$data = array(
|
||||
$cert_comple_dt,
|
||||
$cert_comple_dt,
|
||||
$tel_doc_conf_dt,
|
||||
$res['conf_required_tm'],
|
||||
$cert_comple_dt,
|
||||
$tel_doc_conf_dt,
|
||||
$atcl_no
|
||||
);
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Models\v2;
|
||||
|
||||
use App\Models\webfax\FaxModel;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class M701Model extends Model
|
||||
@@ -310,7 +311,7 @@ class M701Model extends Model
|
||||
b.vrfc_type,
|
||||
IFNULL(c.rm_no, '') as rm_no,
|
||||
c.floor,
|
||||
c.address_code,
|
||||
IFNULL(c.address_code, '') as address_code,
|
||||
IFNULL(c.address2, '') as address2,
|
||||
IFNULL(m.address2a, '') as address2a,
|
||||
IFNULL(m.address2b, '') as address2b,
|
||||
@@ -331,7 +332,7 @@ class M701Model extends Model
|
||||
d.insert_tm as update_res_tm,
|
||||
greatest(ifnull(d45.insert_tm, ''), ifnull(d49.insert_tm, '')) as rgbk_check_tm,
|
||||
e.insert_tm as result_tm,
|
||||
f.region_nm,
|
||||
IFNULL(f.region_nm, '') as region_nm,
|
||||
g.cd_nm as pre_stat,
|
||||
h.cd_nm as vrfc_type,
|
||||
i.usr_nm,
|
||||
@@ -887,6 +888,179 @@ class M701Model extends Model
|
||||
}
|
||||
|
||||
|
||||
// 가격수정
|
||||
public function changePrice($param)
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$detail = $this->getDetail($param['rcpt_key']);
|
||||
|
||||
if ($param['trade_type'] != 'B2') {
|
||||
// 월세가 아닐경우에는 월세가에 0으로 ....
|
||||
$data['lease_amt'] = $param['atcl_amt3'];
|
||||
}
|
||||
|
||||
if (!empty($param['atcl_amt1']))
|
||||
$data['deal_amt'] = $param['atcl_amt1'];
|
||||
if (!empty($param['atcl_amt2']))
|
||||
$data['wrrnt_amt'] = $param['atcl_amt2'];
|
||||
if (!empty($param['atcl_amt3']))
|
||||
$data['lease_amt'] = $param['atcl_amt3']; // 월세이고 월세가격이 입력되지 않았으면... 원래 금액으로
|
||||
if (!empty($param['atcl_amt4']))
|
||||
$data['deal_amt'] = $param['atcl_amt4'];
|
||||
if (!empty($param['isale_amt']))
|
||||
$data['isale_amt'] = $param['isale_amt'];
|
||||
if (!empty($param['prem_amt']))
|
||||
$data['prem_amt'] = $param['prem_amt'];
|
||||
|
||||
$data['modify_yn'] = 'Y';
|
||||
|
||||
$builder = $this->db->table('v2_modify_info');
|
||||
$ok = $builder->where('vr_sq', $param['rcpt_key'])->update($data);
|
||||
if ($ok === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장 실패',
|
||||
];
|
||||
}
|
||||
|
||||
$memo = "가격변경 ";
|
||||
$this->saveHistory($detail['vr_sq'], $detail['pre_stat_cd'], 'C25', $usr_id, $memo);
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
|
||||
// 정보수정
|
||||
public function modifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt)
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$detail = $this->getDetail($atcl_vr_sq);
|
||||
|
||||
if ($trade_type != 'B2') {
|
||||
// 월세가 아닐경우에는 월세가에 0으로 ....
|
||||
$atcl_amt3 = '0';
|
||||
$data['lease_amt'] = $atcl_amt3;
|
||||
}
|
||||
if (!empty($trade_type))
|
||||
$data['trade_type'] = $trade_type;
|
||||
if (!empty($atcl_hscp_nm))
|
||||
$data['hscp_nm'] = $atcl_hscp_nm;
|
||||
if (!empty($atcl_ptp_nm))
|
||||
$data['ptp_nm'] = $atcl_ptp_nm;
|
||||
if (!empty($atcl_addr1))
|
||||
$data['address2'] = $atcl_addr1; // 폐기 예정
|
||||
if (!empty($atcl_addr1a))
|
||||
$data['address2a'] = $atcl_addr1a;
|
||||
if (!empty($atcl_addr1b))
|
||||
$data['address2b'] = $atcl_addr1b;
|
||||
if (!empty($atcl_addr2))
|
||||
$data['address3'] = $atcl_addr2;
|
||||
if (!empty($atcl_hscp_no))
|
||||
$data['hscp_no'] = $atcl_hscp_no;
|
||||
if (!empty($atcl_ptp_no))
|
||||
$data['ptp_no'] = $atcl_ptp_no;
|
||||
if (!empty($atcl_amt1))
|
||||
$data['deal_amt'] = $atcl_amt1;
|
||||
if (!empty($atcl_amt2))
|
||||
$data['wrrnt_amt'] = $atcl_amt2;
|
||||
if (!empty($atcl_amt3))
|
||||
$data['lease_amt'] = $atcl_amt3; // 월세이고 월세가격이 입력되지 않았으면... 원래 금액으로
|
||||
if (!empty($atcl_amt4))
|
||||
$data['deal_amt'] = $atcl_amt4;
|
||||
if (!empty($isale_amt))
|
||||
$data['isale_amt'] = $isale_amt;
|
||||
if (!empty($prem_amt))
|
||||
$data['prem_amt'] = $prem_amt;
|
||||
if (!empty($atcl_floor))
|
||||
$data['floor'] = $atcl_floor;
|
||||
if (!empty($atcl_floor2))
|
||||
$data['floor2'] = $atcl_floor2;
|
||||
$data['modify_yn'] = 'Y';
|
||||
|
||||
$builder = $this->db->table('v2_modify_info');
|
||||
$ok = $builder->where('vr_sq', $atcl_vr_sq)->update($data);
|
||||
if ($ok === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장 실패',
|
||||
];
|
||||
}
|
||||
|
||||
$last_query = $this->db->getLastQuery();
|
||||
$current_url = current_url();
|
||||
|
||||
|
||||
$memo = "상세정보수정 ";
|
||||
$this->saveHistory(vr_sq: $detail['vr_sq'], stat_cd: $detail['pre_stat_cd'], chg_type: 'C25', usr_id: $usr_id, memo: $memo);
|
||||
|
||||
$faxModel = new FaxModel();
|
||||
$faxModel->updateAddress($atcl_vr_sq, $detail['address_code'], $data['address2'], $data['address3'], $data['hscp_no'], $data['hscp_nm']);
|
||||
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type)
|
||||
{
|
||||
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->get_detail($atcl_vr_sq); //변경된 내용 비교를 위해.
|
||||
|
||||
$data['vrfc_type'] = $atcl_vrfc_type;
|
||||
|
||||
$this->db->where('vr_sq', $atcl_vr_sq);
|
||||
$this->db->trans_start();
|
||||
$this->db->update('v2_vrfc_req', $data);
|
||||
|
||||
$data['vrfc_type_cd'] = $atcl_vrfc_type;
|
||||
$return['error_number'] = $this->db->_error_number();
|
||||
$return['error_message'] = $this->db->_error_message();
|
||||
|
||||
if (empty($return['error_number'])) {
|
||||
// 로그를 남긴다.
|
||||
if ($this->db->affected_rows() > 0) {
|
||||
// $changed = $this->what_is_changed($list['data'], $data, $atcl_vr_sq);
|
||||
if (!empty($changed)) {
|
||||
$this->saveHistory($list['data']['vr_sq'], $list['data']['pre_stat_cd'], 'C25', $usr_id, "상세정보 수정");
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->db->transComplete();
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function saveApiErr($err_sq, $err_code, $err_nm, $err_time, $err_no, $err_server = '')
|
||||
{
|
||||
$sql = "INSERT INTO err_api (err_sq, err_code, err_nm, err_time, err_no, err_server)" .
|
||||
" VALUES (?, ?, ?, ?, ?, ?);";
|
||||
|
||||
$data = [
|
||||
$err_sq,
|
||||
$err_code,
|
||||
$err_nm,
|
||||
$err_time,
|
||||
$err_no,
|
||||
$err_server
|
||||
];
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
// 상태변경
|
||||
public function chgArticleStatus($data)
|
||||
{
|
||||
@@ -961,6 +1135,601 @@ class M701Model extends Model
|
||||
];
|
||||
}
|
||||
|
||||
// 현재상태확인
|
||||
public function chkStat($vr_sq)
|
||||
{
|
||||
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
|
||||
$data = [
|
||||
$vr_sq
|
||||
];
|
||||
$query = $this->db->query($sql, $data);
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function chkTryCnt($vr_sq)
|
||||
{
|
||||
$columns = 'a.try_cnt';
|
||||
$builder = $this->db->table('v2_vrfc_req a');
|
||||
$builder->select($columns);
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function chkRegiTryCnt($atcl_vr_sq)
|
||||
{ //1차 검증인지 2차 검증인지 확인.
|
||||
$builder = $this->db->table('v2_vrfc_req a');
|
||||
$builder->select('a.reg_try_cnt');
|
||||
$builder->where('vr_sq', $atcl_vr_sq);
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function chkConfirm($vr_sq, $reg_yn)
|
||||
{
|
||||
$columns = "a.vr_sq";
|
||||
$builder = $this->db->table('v2_confirm a');
|
||||
$builder->select($columns);
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
|
||||
if ($reg_yn) {
|
||||
$builder->where('vrfc_type', $reg_yn); // 등기부등본 정보 확인시
|
||||
}
|
||||
|
||||
$query = $builder->get();
|
||||
$result = $query->getNumRows();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function insertConfirm($vr_sq, $vrfc_type, $success, $type, $usr_id = '', $usr_sq = '')
|
||||
{
|
||||
if (empty($usr_sq))
|
||||
$usr_sq = session('usr_sq');
|
||||
if (empty($usr_id))
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "INSERT INTO v2_confirm" .
|
||||
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
|
||||
"VALUES" .
|
||||
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW()) " .
|
||||
" ON DUPLICATE KEY UPDATE" .
|
||||
" success=values(success), charger=values(charger)
|
||||
, date=values(date), update_user=values(update_user), update_tm=values(update_tm)";
|
||||
|
||||
$data = [
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$success,
|
||||
$type,
|
||||
$usr_id,
|
||||
$usr_sq,
|
||||
$usr_sq
|
||||
];
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
public function updateConfirm($vr_sq, $vrfc_type, $success)
|
||||
{
|
||||
$data = [
|
||||
'success' => $success,
|
||||
];
|
||||
|
||||
$builder = $this->db->table('v2_confirm');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->where('vrfc_type', $vrfc_type);
|
||||
$builder->update($data);
|
||||
}
|
||||
|
||||
public function chgRegiTryCnt($vr_sq, $try_cnt)
|
||||
{ //v2_vrfc_req try_cnt 값 변경.
|
||||
$sql = "UPDATE v2_vrfc_req" .
|
||||
" SET reg_try_cnt = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$try_cnt,
|
||||
$vr_sq
|
||||
);
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function chgStat($vr_sq, $stat_cd, $insert_tm)
|
||||
{
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->getDetail($vr_sq);
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)
|
||||
VALUES (?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
vr_sq = VALUES(vr_sq),
|
||||
stat_cd = VALUES(stat_cd),
|
||||
insert_user = VALUES(insert_user),
|
||||
insert_tm = VALUES(insert_tm)";
|
||||
|
||||
$data = [
|
||||
$vr_sq,
|
||||
$stat_cd,
|
||||
$usr_sq,
|
||||
$insert_tm,
|
||||
];
|
||||
|
||||
if ($this->db->query($sql, $data) === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장 실패',
|
||||
];
|
||||
}
|
||||
|
||||
$this->saveHistory($list['vr_sq'], $stat_cd, 'C9', $usr_id, '서류확인 정보 변경');
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function chgStatVrfc($vr_sq, $stat_cd)
|
||||
{
|
||||
$data = [
|
||||
'stat_cd' => $stat_cd,
|
||||
];
|
||||
|
||||
$builder = $this->db->table('v2_vrfc_req');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->update($data);
|
||||
}
|
||||
|
||||
public function chgStatFax($vr_sq, $stat_cd)
|
||||
{
|
||||
$data = [
|
||||
'stat_cd' => $stat_cd,
|
||||
];
|
||||
|
||||
$builder = $this->db->table('fax_imgs');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->update($data);
|
||||
}
|
||||
|
||||
|
||||
// 파일정보 저장
|
||||
public function saveFileInfo($file)
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
$fileType = $file['file_type'] ?? '1';
|
||||
|
||||
// 기존 파일 확인
|
||||
$sql = "SELECT seq FROM v2_files WHERE vr_sq = ? AND use_yn = 'Y' AND file_type = ?";
|
||||
$query = $this->db->query($sql, [$file['vr_sq'], $fileType]);
|
||||
$result = $query->getRow();
|
||||
|
||||
if (!empty($result)) {
|
||||
// 기존 파일을 비활성화
|
||||
$sql = "UPDATE v2_files SET use_yn = 'N' WHERE vr_sq = ? AND file_type = ?";
|
||||
$this->db->query($sql, [$file['vr_sq'], $fileType]);
|
||||
}
|
||||
|
||||
// 새 파일 정보 INSERT
|
||||
$data = [
|
||||
'vr_sq' => $file['vr_sq'],
|
||||
'use_yn' => 'Y',
|
||||
'file_type' => $fileType,
|
||||
'view_odr' => $file['view_odr'] ?? 0,
|
||||
'file_path' => $file['file_path'],
|
||||
'file_name' => $file['new_name'],
|
||||
'file_ext' => $file['ext'],
|
||||
'file_size' => $file['size'],
|
||||
'insert_user' => session('usr_sq'),
|
||||
'insert_tm' => date('Y-m-d H:i:s'),
|
||||
'cloud_upload_yn' => 'Y',
|
||||
];
|
||||
|
||||
$builder = $this->db->table('v2_files');
|
||||
$builder->insert($data);
|
||||
|
||||
$this->db->transComplete();
|
||||
}
|
||||
|
||||
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
|
||||
{
|
||||
if (is_array($comment)) {
|
||||
$comment = implode('|', $comment);
|
||||
}
|
||||
|
||||
$usr_sq = $this->session->userdata('usr_sq');
|
||||
$sql = "INSERT INTO v2_check_list" .
|
||||
"(vr_sq, vrfc_type, type, code, comment, insert_user, insert_tm)" .
|
||||
"VALUES" .
|
||||
"(?, ?, ?, ?, ?, ?, NOW())" .
|
||||
" ON DUPLICATE KEY UPDATE" .
|
||||
" vr_sq=values(vr_sq), vrfc_type=values(vrfc_type), type=values(type), code=values(code), comment=values(comment), insert_user=values(insert_user), insert_tm=values(insert_tm)";
|
||||
|
||||
$data = [
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$type,
|
||||
$code,
|
||||
$comment,
|
||||
$usr_sq
|
||||
];
|
||||
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function chgTryCnt($vr_sq, $try_cnt)
|
||||
{ //v2_vrfc_req try_cnt 값 변경.
|
||||
$sql = "UPDATE v2_vrfc_req" .
|
||||
" SET try_cnt = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$try_cnt,
|
||||
$vr_sq
|
||||
);
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function InsResChar($atcl_vr_sq)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "UPDATE v2_article_info" .
|
||||
" SET reg_charger = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$usr_id,
|
||||
$atcl_vr_sq
|
||||
);
|
||||
$res = $this->db->query($sql, $data);
|
||||
$log_v = $this->db->getLastQuery();
|
||||
log_message('debug', $log_v);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증결과 전송 API를 위한 데이터 조회..
|
||||
*/
|
||||
public function getDataConfirmAPI($vr_sq)
|
||||
{
|
||||
// 요청정보
|
||||
$sql = "SELECT vr_sq, atcl_no, step, cpid, cp_atcl_id, trade_type, realtor_nm, realtor_tel_no, seller_tel_no, vrfc_type, rgbk_confirm, req_type, rdate, stat_cd, try_cnt, insert_user, insert_tm
|
||||
FROM v2_vrfc_req WHERE vr_sq = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq]);
|
||||
$rowVrfcReq = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 매물정보
|
||||
$sql = "SELECT vr_sq, atcl_no, cpid, cp_atcl_id, rlet_type_cd, trade_type, address_code, address1, address2, address3, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sise, floor, rdate, seller_tel_no, seller_nm, realtor_nm, realtor_tel_no, hscp_no, hscp_nm, ptp_no, ptp_nm, charger, req_price_yn, reg_charger, dept1_sq, dept2_sq, reg_dept1_sq, reg_dept2_sq, floor2
|
||||
FROM v2_article_info WHERE vr_sq = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq]);
|
||||
$rowArticleInfo = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 수정정보
|
||||
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, address4, trade_type, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, hscp_no, hscp_nm, ptp_no, ptp_nm, modify_yn, floor2
|
||||
FROM v2_modify_info WHERE vr_sq = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq]);
|
||||
$rowModifyInfo = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 검증결과
|
||||
$sql = "SELECT vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm, work_type
|
||||
FROM v2_confirm WHERE vr_sq = ? AND vrfc_type = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq, $rowVrfcReq['vrfc_type']]);
|
||||
$rowConfirm = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 확인정보
|
||||
$sql = "SELECT type, code, comment, ownerNm, ownerBirth FROM v2_check_list WHERE vr_sq = ? AND vrfc_type = ? AND type LIKE CONCAT(vrfc_type, '%')";
|
||||
$query = $this->db->query($sql, [$vr_sq, $rowVrfcReq['vrfc_type']]);
|
||||
$resCheckList = $query->getResultArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
if (!empty($rowConfirm)) {
|
||||
log_message('debug', implode(', ', $rowConfirm));
|
||||
}
|
||||
|
||||
$atclNo = $rowVrfcReq['atcl_no'] ?? null;
|
||||
$success = !empty($rowConfirm['success']);
|
||||
$charger = $rowConfirm['charger'] ?? null;
|
||||
$date = $rowConfirm['date'] ?? null;
|
||||
$tryCnt = $rowVrfcReq['try_cnt'] ?? 0;
|
||||
|
||||
$checkList = [];
|
||||
foreach ($resCheckList as $row) {
|
||||
$checkList[] = [
|
||||
'type' => $row['type'],
|
||||
'code' => $row['code'],
|
||||
'comment' => $row['comment'],
|
||||
'ownerNm' => $row['ownerNm'],
|
||||
'ownerBirth' => $row['ownerBirth'],
|
||||
];
|
||||
}
|
||||
|
||||
$modifyInfo = [];
|
||||
if (($rowModifyInfo['modify_yn'] ?? 'N') === 'Y') {
|
||||
if (!empty($rowModifyInfo['hscp_no'])) {
|
||||
// 공동주택
|
||||
$modifyInfo = [
|
||||
'hscpNo' => $rowModifyInfo['hscp_no'],
|
||||
'ptpNo' => $rowModifyInfo['ptp_no'],
|
||||
'bildNm' => $rowModifyInfo['address2'],
|
||||
'rmNo' => $rowModifyInfo['address3'],
|
||||
'tradeType' => $rowModifyInfo['trade_type'],
|
||||
'dealAmt' => $rowModifyInfo['deal_amt'],
|
||||
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
|
||||
'leaseAmt' => $rowModifyInfo['lease_amt'],
|
||||
'isaleAmt' => $rowModifyInfo['isale_amt'],
|
||||
'premAmt' => $rowModifyInfo['prem_amt'],
|
||||
'floor' => $rowModifyInfo['floor'],
|
||||
];
|
||||
} else {
|
||||
// 비공동주택
|
||||
$modifyInfo = [
|
||||
'addressCode' => $rowModifyInfo['address_code'],
|
||||
'address2' => $rowModifyInfo['address2'],
|
||||
'address3' => $rowModifyInfo['address3'],
|
||||
'tradeType' => $rowModifyInfo['trade_type'],
|
||||
'dealAmt' => $rowModifyInfo['deal_amt'],
|
||||
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
|
||||
'leaseAmt' => $rowModifyInfo['lease_amt'],
|
||||
'splySpc' => $rowModifyInfo['sply_spc'],
|
||||
'exclsSpc' => $rowModifyInfo['excls_spc'],
|
||||
'totSpc' => $rowModifyInfo['tot_spc'],
|
||||
'grndSpc' => $rowModifyInfo['grnd_spc'],
|
||||
'bldgSpc' => $rowModifyInfo['bldg_spc'],
|
||||
'floor' => $rowModifyInfo['floor'],
|
||||
'floor2' => $rowModifyInfo['floor2'],
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'atclNo' => $atclNo,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'modifyInfo' => $modifyInfo,
|
||||
'date' => $date,
|
||||
'try_cnt' => $tryCnt,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'atclNo' => $atclNo,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'date' => $date,
|
||||
'try_cnt' => $tryCnt,
|
||||
];
|
||||
}
|
||||
|
||||
/* 등기부등본 API 호출*/
|
||||
/**
|
||||
* $vrfc_type: 값이 R이면 등기부등본
|
||||
*/
|
||||
public function getDatacertAPI($vr_sq, $vrfc_type = '')
|
||||
{
|
||||
// 요청정보
|
||||
$sql = "SELECT vr_sq, atcl_no, step, cpid, cp_atcl_id, trade_type, realtor_nm, realtor_tel_no, seller_tel_no, vrfc_type, rgbk_confirm, req_type, rdate, stat_cd, try_cnt, insert_user, insert_tm, reg_try_cnt, owner_verifiable
|
||||
FROM v2_vrfc_req WHERE vr_sq = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq]);
|
||||
$rowVrfcReq = $query->getRowArray();
|
||||
|
||||
if (!empty($vrfc_type)) {
|
||||
$rowVrfcReq['vrfc_type'] = $vrfc_type;
|
||||
}
|
||||
|
||||
log_message('debug', (string) $this->db->getLastQuery());
|
||||
|
||||
// 매물정보
|
||||
$sql = "SELECT vr_sq, atcl_no, cpid, cp_atcl_id, rlet_type_cd, trade_type, address_code, address1, address2, address3, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sise, floor, rdate, seller_tel_no, seller_nm, realtor_nm, realtor_tel_no, hscp_no, hscp_nm, ptp_no, ptp_nm, charger, req_price_yn, reg_charger, dept1_sq, dept2_sq, reg_dept1_sq, reg_dept2_sq, floor2
|
||||
FROM v2_article_info WHERE vr_sq = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq]);
|
||||
$rowArticleInfo = $query->getRowArray();
|
||||
|
||||
log_message('debug', (string) $this->db->getLastQuery());
|
||||
|
||||
// 수정정보
|
||||
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, trade_type, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, hscp_no, hscp_nm, ptp_no, ptp_nm, modify_yn, floor2
|
||||
FROM v2_modify_info WHERE vr_sq = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq]);
|
||||
$rowModifyInfo = $query->getRowArray();
|
||||
|
||||
log_message('debug', (string) $this->db->getLastQuery());
|
||||
|
||||
// 검증결과
|
||||
$sql = "SELECT vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm, work_type
|
||||
FROM v2_confirm WHERE vr_sq = ? AND vrfc_type = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq, $rowVrfcReq['vrfc_type']]);
|
||||
$rowConfirm = $query->getRowArray();
|
||||
|
||||
log_message('debug', (string) $this->db->getLastQuery());
|
||||
|
||||
// 확인정보
|
||||
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth
|
||||
FROM v2_check_list a
|
||||
INNER JOIN v2_article_info b ON a.vr_sq = b.vr_sq
|
||||
WHERE a.vr_sq = ? AND a.vrfc_type = ?";
|
||||
$query = $this->db->query($sql, [$vr_sq, $rowVrfcReq['vrfc_type']]);
|
||||
$resCheckList = $query->getResultArray();
|
||||
|
||||
log_message('debug', (string) $this->db->getLastQuery());
|
||||
|
||||
if (!empty($rowConfirm)) {
|
||||
log_message('debug', implode(', ', $rowConfirm));
|
||||
}
|
||||
|
||||
$atclNo = $rowVrfcReq['atcl_no'] ?? null;
|
||||
$type = $rowVrfcReq['try_cnt'] ?? null;
|
||||
$success = !empty($rowConfirm['success']);
|
||||
$charger = $rowConfirm['charger'] ?? null;
|
||||
$date = $rowConfirm['date'] ?? null;
|
||||
|
||||
switch ($rowVrfcReq['owner_verifiable'] ?? null) {
|
||||
case '1':
|
||||
case 'true':
|
||||
$ownerVerifiable = true;
|
||||
break;
|
||||
default:
|
||||
$ownerVerifiable = false;
|
||||
break;
|
||||
}
|
||||
|
||||
$checkList = [];
|
||||
foreach ($resCheckList as $row) {
|
||||
$checkList[] = [
|
||||
'type' => $row['type'],
|
||||
'code' => $row['code'],
|
||||
'comment' => $row['comment'],
|
||||
'ownerNm' => $row['ownerNm'],
|
||||
'ownerBirth' => $row['owner_birth'],
|
||||
];
|
||||
}
|
||||
|
||||
$modifyInfo = [];
|
||||
if (($rowModifyInfo['modify_yn'] ?? 'N') === 'Y') {
|
||||
if (!empty($rowModifyInfo['hscp_no'])) {
|
||||
$modifyInfo = [
|
||||
'hscpNo' => $rowModifyInfo['hscp_no'],
|
||||
'ptpNo' => $rowModifyInfo['ptp_no'],
|
||||
'bildNm' => $rowModifyInfo['address2'],
|
||||
'rmNo' => $rowModifyInfo['address3'],
|
||||
'tradeType' => $rowModifyInfo['trade_type'],
|
||||
'dealAmt' => $rowModifyInfo['deal_amt'],
|
||||
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
|
||||
'leaseAmt' => $rowModifyInfo['lease_amt'],
|
||||
'isaleAmt' => $rowModifyInfo['isale_amt'],
|
||||
'premAmt' => $rowModifyInfo['prem_amt'],
|
||||
'floor' => $rowModifyInfo['floor'],
|
||||
];
|
||||
} else {
|
||||
$modifyInfo = [
|
||||
'addressCode' => $rowModifyInfo['address_code'],
|
||||
'address2' => $rowModifyInfo['address2'],
|
||||
'address3' => $rowModifyInfo['address3'],
|
||||
'tradeType' => $rowModifyInfo['trade_type'],
|
||||
'dealAmt' => $rowModifyInfo['deal_amt'],
|
||||
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
|
||||
'leaseAmt' => $rowModifyInfo['lease_amt'],
|
||||
'splySpc' => $rowModifyInfo['sply_spc'],
|
||||
'exclsSpc' => $rowModifyInfo['excls_spc'],
|
||||
'totSpc' => $rowModifyInfo['tot_spc'],
|
||||
'grndSpc' => $rowModifyInfo['grnd_spc'],
|
||||
'bldgSpc' => $rowModifyInfo['bldg_spc'],
|
||||
'floor' => $rowModifyInfo['floor'],
|
||||
'floor2' => $rowModifyInfo['floor2'],
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'atclNo' => $atclNo,
|
||||
'type' => $type,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'modifyInfo' => $modifyInfo,
|
||||
'date' => $date,
|
||||
'ownerVerifiable' => $ownerVerifiable,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'atclNo' => $atclNo,
|
||||
'type' => $type,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'date' => $date,
|
||||
'ownerVerifiable' => $ownerVerifiable,
|
||||
];
|
||||
}
|
||||
|
||||
public function InsCharger($atcl_vr_sq)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "UPDATE v2_article_info" .
|
||||
" SET charger = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$usr_id,
|
||||
$atcl_vr_sq
|
||||
);
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function getUpdateFailTime1($vr_sq)
|
||||
{
|
||||
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
|
||||
"from v2_chg_stat " .
|
||||
"where vr_sq = ? and stat_cd = '39' " .
|
||||
"order by insert_tm desc " .
|
||||
"limit 1";
|
||||
$data = array($vr_sq);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getRowArray();
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
public function getUpdateFailTime2($vr_sq)
|
||||
{
|
||||
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
|
||||
"from v2_chg_stat " .
|
||||
"where vr_sq = ? and stat_cd = '49' " .
|
||||
"order by insert_tm desc " .
|
||||
"limit 1";
|
||||
$data = array($vr_sq);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getRowArray();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function deleteChkList($vr_sq, $vrfc_type, $type)
|
||||
{
|
||||
$sql = "delete from v2_check_list where vr_sq = ? and vrfc_type = ? and type = ?";
|
||||
$data = array(
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$type
|
||||
);
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function up_tel_fail_cause($vr_sq, $tel_fail_cause)
|
||||
{
|
||||
$sql = "UPDATE v2_vrfc_req" .
|
||||
" SET tel_fail_cause = ? " .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$tel_fail_cause,
|
||||
$vr_sq
|
||||
);
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
// 변경이력 저장
|
||||
public function saveHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Models\v2;
|
||||
|
||||
use App\Models\webfax\FaxModel;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class M702Model extends Model
|
||||
@@ -316,7 +317,7 @@ class M702Model extends Model
|
||||
c.ptp_no,
|
||||
d.insert_tm as update_res_tm,
|
||||
e.insert_tm as result_tm,
|
||||
f.region_nm,
|
||||
IFNULL(f.region_nm , '') as region_nm,
|
||||
g.cd_nm as pre_stat,
|
||||
h.cd_nm as vrfc_type,
|
||||
i.usr_nm,
|
||||
@@ -740,6 +741,78 @@ class M702Model extends Model
|
||||
];
|
||||
}
|
||||
|
||||
public function chgStat($vr_sq, $stat_cd, $insert_tm)
|
||||
{ //상태변경 TABLE INSERT
|
||||
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->getDetail($vr_sq);
|
||||
|
||||
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)" .
|
||||
"VALUES (?, ?, ?, ?)" .
|
||||
"ON DUPLICATE KEY " .
|
||||
"UPDATE vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
|
||||
|
||||
$data = array(
|
||||
'vr_sq' => $vr_sq
|
||||
,
|
||||
'stat_cd' => $stat_cd
|
||||
,
|
||||
'usr_sq' => $usr_sq
|
||||
,
|
||||
'insert_tm' => $insert_tm
|
||||
);
|
||||
|
||||
$this->db->transStart();
|
||||
$res = $this->db->query($sql, $data);
|
||||
|
||||
// echo $this->db->last_query();
|
||||
|
||||
$return['error_number'] = $this->db->_error_number();
|
||||
$return['error_message'] = $this->db->_error_message();
|
||||
|
||||
if (empty($return['error_number'])) {
|
||||
//로그를 남긴다.
|
||||
if ($this->db->affected_rows() > 0) {
|
||||
if (!empty($changed)) {
|
||||
$this->saveHistory($list['data']['vr_sq'], $stat_cd, 'C9', $usr_id, "등기부등본확인 정보 수정"); //검증결과 변동사항 HISTORY
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->db->transComplete();
|
||||
}
|
||||
|
||||
public function chgStatVrfc($vr_sq, $stat_cd)
|
||||
{
|
||||
$data = ['stat_cd' => $stat_cd];
|
||||
|
||||
$builder = $this->db->table('v2_vrfc_req');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'] ?? null;
|
||||
$return['error_message'] = $error['message'] ?? null;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function chgStatFax($vr_sq, $stat_cd)
|
||||
{
|
||||
$data = ['stat_cd' => $stat_cd];
|
||||
|
||||
$builder = $this->db->table('fax_imgs');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'] ?? null;
|
||||
$return['error_message'] = $error['message'] ?? null;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
// 상태변경 시각 기록
|
||||
public function saveV2ChgStat($vr_sq, $stat_cd, $insert_user)
|
||||
{
|
||||
@@ -752,6 +825,45 @@ class M702Model extends Model
|
||||
$this->db->query($sql, [$vr_sq, $stat_cd, $insert_user]);
|
||||
}
|
||||
|
||||
// 파일정보 저장
|
||||
public function saveFileInfo($file)
|
||||
{
|
||||
$this->db->transStart();
|
||||
|
||||
$fileType = $file['file_type'] ?? '1';
|
||||
|
||||
// 기존 파일 확인
|
||||
$sql = "SELECT seq FROM v2_files WHERE vr_sq = ? AND use_yn = 'Y' AND file_type = ?";
|
||||
$query = $this->db->query($sql, [$file['vr_sq'], $fileType]);
|
||||
$result = $query->getRow();
|
||||
|
||||
if (!empty($result)) {
|
||||
// 기존 파일을 비활성화
|
||||
$sql = "UPDATE v2_files SET use_yn = 'N' WHERE vr_sq = ? AND file_type = ?";
|
||||
$this->db->query($sql, [$file['vr_sq'], $fileType]);
|
||||
}
|
||||
|
||||
// 새 파일 정보 INSERT
|
||||
$data = [
|
||||
'vr_sq' => $file['vr_sq'],
|
||||
'use_yn' => 'Y',
|
||||
'file_type' => $fileType,
|
||||
'view_odr' => $file['view_odr'] ?? 0,
|
||||
'file_path' => $file['file_path'],
|
||||
'file_name' => $file['new_name'],
|
||||
'file_ext' => $file['ext'],
|
||||
'file_size' => $file['size'],
|
||||
'insert_user' => session('usr_sq'),
|
||||
'insert_tm' => date('Y-m-d H:i:s'),
|
||||
'cloud_upload_yn' => 'Y',
|
||||
];
|
||||
|
||||
$builder = $this->db->table('v2_files');
|
||||
$builder->insert($data);
|
||||
|
||||
$this->db->transComplete();
|
||||
}
|
||||
|
||||
|
||||
// 변경이력 저장
|
||||
public function saveHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)
|
||||
@@ -925,6 +1037,476 @@ class M702Model extends Model
|
||||
}
|
||||
|
||||
|
||||
/* 매물정보를 수정 */
|
||||
//public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2){
|
||||
public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->getDetail($atcl_vr_sq);
|
||||
|
||||
if ($trade_type !== 'B2') {
|
||||
$atcl_amt3 = '0';
|
||||
$data['lease_amt'] = $atcl_amt3;
|
||||
}
|
||||
if (!empty($trade_type)) {
|
||||
$data['trade_type'] = $trade_type;
|
||||
}
|
||||
if (!empty($atcl_hscp_nm)) {
|
||||
$data['hscp_nm'] = $atcl_hscp_nm;
|
||||
}
|
||||
if (!empty($atcl_ptp_nm)) {
|
||||
$data['ptp_nm'] = $atcl_ptp_nm;
|
||||
}
|
||||
if (!empty($atcl_addr1)) {
|
||||
$data['address2'] = $atcl_addr1;
|
||||
}
|
||||
if (!empty($atcl_addr1a)) {
|
||||
$data['address2a'] = $atcl_addr1a;
|
||||
}
|
||||
if (!empty($atcl_addr1b)) {
|
||||
$data['address2b'] = $atcl_addr1b;
|
||||
}
|
||||
if (!empty($atcl_addr2)) {
|
||||
$data['address3'] = $atcl_addr2;
|
||||
}
|
||||
if (!empty($atcl_hscp_no)) {
|
||||
$data['hscp_no'] = $atcl_hscp_no;
|
||||
}
|
||||
if (!empty($atcl_ptp_no)) {
|
||||
$data['ptp_no'] = $atcl_ptp_no;
|
||||
}
|
||||
if (!empty($atcl_amt1)) {
|
||||
$data['deal_amt'] = $atcl_amt1;
|
||||
}
|
||||
if (!empty($atcl_amt2)) {
|
||||
$data['wrrnt_amt'] = $atcl_amt2;
|
||||
}
|
||||
if (!empty($atcl_amt3)) {
|
||||
$data['lease_amt'] = $atcl_amt3;
|
||||
}
|
||||
if (!empty($atcl_floor)) {
|
||||
$data['floor'] = $atcl_floor;
|
||||
}
|
||||
if (!empty($atcl_floor2)) {
|
||||
$data['floor2'] = $atcl_floor2;
|
||||
}
|
||||
$data['modify_yn'] = 'Y';
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
$builder = $this->db->table('v2_modify_info');
|
||||
$builder->where('vr_sq', $atcl_vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$lastQuery = (string) $this->db->getLastQuery();
|
||||
$currentUrl = current_url();
|
||||
log_message('debug', "{$currentUrl} :: {$lastQuery}");
|
||||
|
||||
$data['trade_type_cd'] = $trade_type;
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'] ?? null;
|
||||
$return['error_message'] = $error['message'] ?? null;
|
||||
|
||||
if (empty($return['error_number'])) {
|
||||
if ($this->db->affectedRows() > 0) {
|
||||
if (!empty($changed)) {
|
||||
$this->saveHistory($list['data']['vr_sq'], $list['data']['pre_stat_cd'], 'C25', $usr_id, '매물정보 수정');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
$faxModel = new FaxModel();
|
||||
$faxModel->updateAddress($atcl_vr_sq, $list['data']['address_code'], $data['address2'], $data['address3'], $data['hscp_no'], $data['hscp_nm']);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->getDetail($atcl_vr_sq);
|
||||
|
||||
|
||||
$data = [
|
||||
'vrfc_type' => $atcl_vrfc_type,
|
||||
];
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
$builder = $this->db->table('v2_vrfc_req');
|
||||
$builder->where('vr_sq', $atcl_vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$data['vrfc_type_cd'] = $atcl_vrfc_type;
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'] ?? null;
|
||||
$return['error_message'] = $error['message'] ?? null;
|
||||
|
||||
if (empty($return['error_number'])) {
|
||||
if ($this->db->affectedRows() > 0) {
|
||||
if (!empty($changed)) {
|
||||
$this->saveHistory($list['data']['vr_sq'], $list['data']['pre_stat_cd'], 'C25', $usr_id, '매물정보 저장');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
// 현재상태확인
|
||||
public function chkStat($vr_sq)
|
||||
{
|
||||
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
|
||||
$data = [
|
||||
$vr_sq
|
||||
];
|
||||
$query = $this->db->query($sql, $data);
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function InsResChar($atcl_vr_sq)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "UPDATE v2_article_info" .
|
||||
" SET reg_charger = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$usr_id,
|
||||
$atcl_vr_sq
|
||||
);
|
||||
$res = $this->db->query($sql, $data);
|
||||
$log_v = $this->db->getLastQuery();
|
||||
log_message('debug', $log_v);
|
||||
}
|
||||
|
||||
public function chkRegiTryCnt($atcl_vr_sq)
|
||||
{
|
||||
$builder = $this->db->table('v2_vrfc_req a');
|
||||
$builder->select('a.reg_try_cnt');
|
||||
$builder->where('vr_sq', $atcl_vr_sq);
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function chkConfirm($atcl_vr_sq, $reg_yn)
|
||||
{ //검증결과 table에 있는지 확인.
|
||||
$builder = $this->db->table('v2_confirm a');
|
||||
$builder->select('a.vr_sq');
|
||||
$builder->where('a.vr_sq', $atcl_vr_sq);
|
||||
|
||||
if (!empty($reg_yn)) {
|
||||
$builder->where('a.vrfc_type', $reg_yn); // 등기부등본 정보 확인시
|
||||
}
|
||||
|
||||
return $builder->get()->getNumRows();
|
||||
}
|
||||
|
||||
public function insertConfirm($vr_sq, $vrfc_type, $success, $type)
|
||||
{ //v2_confirm INSERT
|
||||
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "INSERT INTO v2_confirm" .
|
||||
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
|
||||
"VALUES" .
|
||||
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW())";
|
||||
|
||||
$data = array(
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$success,
|
||||
$type,
|
||||
$usr_id,
|
||||
$usr_sq,
|
||||
$usr_sq
|
||||
);
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
|
||||
}
|
||||
|
||||
public function updateConfirm($vr_sq, $vrfc_type, $success)
|
||||
{
|
||||
$data = [
|
||||
'success' => $success,
|
||||
'update_user' => session('usr_sq'),
|
||||
'update_tm' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$builder = $this->db->table('v2_confirm');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->where('vrfc_type', $vrfc_type);
|
||||
$builder->update($data);
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'] ?? null;
|
||||
$return['error_message'] = $error['message'] ?? null;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function saveApiErr($err_sq, $err_code, $err_nm, $err_time, $err_no, $err_server = '')
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO err_api (err_sq, err_code, err_nm, err_time, err_no, err_server)" .
|
||||
" VALUES (?, ?, ?, ?, ?, ?);";
|
||||
|
||||
$data = array(
|
||||
$err_sq,
|
||||
$err_code,
|
||||
$err_nm,
|
||||
$err_time,
|
||||
$err_no,
|
||||
$err_server
|
||||
);
|
||||
$res = $this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
|
||||
{ //v2_check_list INSERT
|
||||
|
||||
$usr_sq = session('usr_sq');
|
||||
$sql = "INSERT INTO v2_check_list" .
|
||||
"(vr_sq, vrfc_type, type, code, comment, insert_user, insert_tm)" .
|
||||
"VALUES" .
|
||||
"(?, ?, ?, ?, ?, ?, NOW())" .
|
||||
" ON DUPLICATE KEY UPDATE" .
|
||||
" vr_sq=values(vr_sq), vrfc_type=values(vrfc_type), type=values(type), code=values(code), comment=values(comment), insert_user=values(insert_user), insert_tm=values(insert_tm)";
|
||||
|
||||
$data = array(
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$type,
|
||||
$code,
|
||||
$comment,
|
||||
$usr_sq
|
||||
);
|
||||
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
/* 등기부등본 API 호출*/
|
||||
public function getDatacertAPI($vr_sq, $vrfc_type = '')
|
||||
{
|
||||
|
||||
// 요청정보
|
||||
$sql = "SELECT vr_sq, atcl_no, step, cpid, cp_atcl_id, trade_type, realtor_nm, realtor_tel_no, seller_tel_no, vrfc_type, rgbk_confirm, req_type, rdate, stat_cd, try_cnt, insert_user, insert_tm, owner_verifiable" .
|
||||
" FROM v2_vrfc_req where vr_sq = ?";
|
||||
$data = array($vr_sq);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_vrfc_req = $query->getRowArray();
|
||||
|
||||
if (!empty($vrfc_type)) {
|
||||
$row_vrfc_req['vrfc_type'] = $vrfc_type;
|
||||
}
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 매물정보
|
||||
$sql = "SELECT vr_sq, atcl_no, cpid, cp_atcl_id, rlet_type_cd, trade_type, address_code, address1, address2, address3, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sise, floor, rdate, seller_tel_no, seller_nm, realtor_nm, realtor_tel_no, hscp_no, hscp_nm, ptp_no, ptp_nm, charger, req_price_yn, reg_charger, dept1_sq, dept2_sq, reg_dept1_sq, reg_dept2_sq, floor2" .
|
||||
" FROM v2_article_info where vr_sq = ?";
|
||||
$data = array($vr_sq);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_article_info = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 수정정보
|
||||
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, trade_type, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, hscp_no, hscp_nm, ptp_no, ptp_nm, modify_yn, floor2" .
|
||||
" FROM v2_modify_info where vr_sq = ?";
|
||||
$data = array($vr_sq);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_modify_info = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 검증결과
|
||||
$sql = "SELECT vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm, work_type" .
|
||||
" FROM v2_confirm where vr_sq = ? and vrfc_type = ?";
|
||||
$data = array($vr_sq, $row_vrfc_req['vrfc_type']);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_confirm = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 확인정보
|
||||
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth" .
|
||||
" FROM v2_check_list a " .
|
||||
" INNER JOIN v2_article_info b on a.vr_sq = b.vr_sq" .
|
||||
" WHERE a.vr_sq = ? and a.vrfc_type = ?";
|
||||
// " FROM v2_check_list where vr_sq = ? and vrfc_type = ? and type like concat(vrfc_type, '%')";
|
||||
$data = array($vr_sq, $row_vrfc_req['vrfc_type']);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res_check_list = $query->getResultArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
log_message('debug', implode(', ', $row_confirm));
|
||||
|
||||
$atclNo = $row_vrfc_req['atcl_no'];
|
||||
$type = $row_vrfc_req['try_cnt'];
|
||||
$success = empty($row_confirm['success']) ? FALSE : TRUE;
|
||||
$charger = $row_confirm['charger'];
|
||||
$date = $row_confirm['date'];
|
||||
if ($row_vrfc_req['owner_verifiable'] == 'false') {
|
||||
$ownerVerifiable = FALSE;
|
||||
} else {
|
||||
$ownerVerifiable = TRUE;
|
||||
}
|
||||
|
||||
$checkList = array();
|
||||
foreach ($res_check_list as $row) {
|
||||
$checkList[] = array(
|
||||
'type' => $row['type'],
|
||||
'code' => $row['code'],
|
||||
'comment' => $row['comment'],
|
||||
'ownerNm' => $row['ownerNm'],
|
||||
'ownerBirth' => $row['owner_birth'],
|
||||
);
|
||||
}
|
||||
|
||||
$modifyInfo = array();
|
||||
if ($row_modify_info['modify_yn'] == 'Y') {
|
||||
if (!empty($row_modify_info['hscp_no'])) {
|
||||
// 공동주택
|
||||
$modifyInfo = array(
|
||||
'hscpNo' => $row_modify_info['hscp_no'],
|
||||
'ptpNo' => $row_modify_info['ptp_no'],
|
||||
'bildNm' => $row_modify_info['address2'],
|
||||
'rmNo' => $row_modify_info['address3'],
|
||||
'tradeType' => $row_modify_info['trade_type'],
|
||||
'dealAmt' => $row_modify_info['deal_amt'],
|
||||
'wrrntAmt' => $row_modify_info['wrrnt_amt'],
|
||||
'leaseAmt' => $row_modify_info['lease_amt'],
|
||||
'isaleAmt' => $row_modify_info['isale_amt'],
|
||||
'premAmt' => $row_modify_info['prem_amt'],
|
||||
'floor' => $row_modify_info['floor'],
|
||||
);
|
||||
} else {
|
||||
// 비공동주택
|
||||
$modifyInfo = array(
|
||||
'addressCode' => $row_modify_info['address_code'],
|
||||
'address2' => $row_modify_info['address2'],
|
||||
'address3' => $row_modify_info['address3'],
|
||||
'tradeType' => $row_modify_info['trade_type'],
|
||||
'dealAmt' => $row_modify_info['deal_amt'],
|
||||
'wrrntAmt' => $row_modify_info['wrrnt_amt'],
|
||||
'leaseAmt' => $row_modify_info['lease_amt'],
|
||||
'splySpc' => $row_modify_info['sply_spc'],
|
||||
'exclsSpc' => $row_modify_info['excls_spc'],
|
||||
'totSpc' => $row_modify_info['tot_spc'],
|
||||
'grndSpc' => $row_modify_info['grnd_spc'],
|
||||
'bldgSpc' => $row_modify_info['bldg_spc'],
|
||||
'floor' => $row_modify_info['floor'],
|
||||
'floor2' => $row_modify_info['floor2'],
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'atclNo' => $atclNo,
|
||||
'type' => $type,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'modifyInfo' => $modifyInfo,
|
||||
'date' => $date,
|
||||
'ownerVerifiable' => $ownerVerifiable,
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
'atclNo' => $atclNo,
|
||||
'type' => $type,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'date' => $date,
|
||||
'ownerVerifiable' => $ownerVerifiable,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function chgRegiTryCnt($vr_sq, $try_cnt)
|
||||
{ //v2_vrfc_req try_cnt 값 변경.
|
||||
$sql = "UPDATE v2_vrfc_req" .
|
||||
" SET reg_try_cnt = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$try_cnt,
|
||||
$vr_sq
|
||||
);
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function InsCharger($atcl_vr_sq)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "UPDATE v2_article_info" .
|
||||
" SET charger = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$usr_id,
|
||||
$atcl_vr_sq
|
||||
);
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
$log_v = $this->db->getLastQuery();
|
||||
log_message('debug', $log_v);
|
||||
}
|
||||
|
||||
public function chkTryCnt($atcl_vr_sq)
|
||||
{
|
||||
$builder = $this->db->table('v2_vrfc_req a');
|
||||
$builder->select('a.try_cnt');
|
||||
$builder->where('a.vr_sq', $atcl_vr_sq);
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function saveMemo($data)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "UPDATE v2_vrfc_req SET
|
||||
memo = ?
|
||||
WHERE vr_sq = ?
|
||||
";
|
||||
|
||||
if ($this->db->query($sql, [$data['memo'], $data['vr_sq']]) === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '저장 실패',
|
||||
];
|
||||
}
|
||||
|
||||
$detail = $this->getDetail($data['vr_sq']);
|
||||
|
||||
$memo = "메모변경 : " . $detail['memo'] . " => " . $data['memo'];
|
||||
$this->saveHistory($data['vr_sq'], $data['pre_stat_cd'], 'C19', $usr_id, $memo);
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
|
||||
// 변경이력 조회
|
||||
public function getHistory($vr_sq)
|
||||
{
|
||||
|
||||
@@ -787,6 +787,149 @@ class M704Model extends Model
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
/* 매물정보를 수정 */
|
||||
//public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt){
|
||||
public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->getDetail($atcl_vr_sq); // 변경된 내용 비교를 위해.
|
||||
|
||||
if ($trade_type != 'B2') {
|
||||
// 월세가 아닐경우에는 월세가에 0으로 ....
|
||||
$atcl_amt3 = '0';
|
||||
$data['lease_amt'] = $atcl_amt3;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
if (!empty($trade_type))
|
||||
$data['trade_type'] = $trade_type;
|
||||
if (!empty($atcl_hscp_nm))
|
||||
$data['hscp_nm'] = $atcl_hscp_nm;
|
||||
if (!empty($atcl_ptp_nm))
|
||||
$data['ptp_nm'] = $atcl_ptp_nm;
|
||||
if (!empty($atcl_addr1))
|
||||
$data['address2'] = $atcl_addr1; // 폐기 예정
|
||||
if (!empty($atcl_addr1a))
|
||||
$data['address2a'] = $atcl_addr1a;
|
||||
if (!empty($atcl_addr1b))
|
||||
$data['address2b'] = $atcl_addr1b;
|
||||
if (!empty($atcl_addr2))
|
||||
$data['address3'] = $atcl_addr2;
|
||||
if (!empty($atcl_hscp_no))
|
||||
$data['hscp_no'] = $atcl_hscp_no;
|
||||
if (!empty($atcl_ptp_no))
|
||||
$data['ptp_no'] = $atcl_ptp_no;
|
||||
if (!empty($atcl_amt1))
|
||||
$data['deal_amt'] = $atcl_amt1;
|
||||
if (!empty($atcl_amt2))
|
||||
$data['wrrnt_amt'] = $atcl_amt2;
|
||||
if (!empty($atcl_amt3))
|
||||
$data['lease_amt'] = $atcl_amt3;
|
||||
if (!empty($atcl_amt4))
|
||||
$data['deal_amt'] = $atcl_amt4;
|
||||
if (!empty($isale_amt))
|
||||
$data['isale_amt'] = $isale_amt;
|
||||
if (!empty($prem_amt))
|
||||
$data['prem_amt'] = $prem_amt;
|
||||
if (!empty($atcl_floor))
|
||||
$data['floor'] = $atcl_floor;
|
||||
if (!empty($atcl_floor2))
|
||||
$data['floor2'] = $atcl_floor2;
|
||||
|
||||
$data['modify_yn'] = 'Y';
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
$builder = $this->db->table('v2_modify_info');
|
||||
$builder->where('vr_sq', $atcl_vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$last_query = $this->db->getLastQuery();
|
||||
$current_url = current_url();
|
||||
log_message('debug', "{$current_url} :: {$last_query}");
|
||||
|
||||
$data['trade_type_cd'] = $trade_type;
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'];
|
||||
$return['error_message'] = $error['message'];
|
||||
|
||||
if (empty($return['error_number'])) {
|
||||
// 로그를 남긴다.
|
||||
if ($this->db->affectedRows() > 0) {
|
||||
$changed = $this->whatIsChanged($list, $data, $atcl_vr_sq);
|
||||
if (!empty($changed)) {
|
||||
$this->saveChangedHistory($list['vr_sq'], $list['pre_stat_cd'], 'C25', $usr_id, $changed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
// 홍보확인서인 경우 주소 변경시 FAX 이미지의 정보도 함께 변경한다.
|
||||
$faxModel = model('App\Models\FaxModel');
|
||||
$faxModel->updateAddress($atcl_vr_sq, $list['address_code'], $data['address2'] ?? '', $data['address3'] ?? '', $data['hscp_no'] ?? '', $data['hscp_nm'] ?? '');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->getDetail($atcl_vr_sq); // 변경된 내용 비교를 위해.
|
||||
|
||||
$data = [];
|
||||
$data['vrfc_type'] = $atcl_vrfc_type;
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
$builder = $this->db->table('v2_vrfc_req');
|
||||
$builder->where('vr_sq', $atcl_vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$last_query = $this->db->getLastQuery();
|
||||
$current_url = current_url();
|
||||
log_message('debug', "{$current_url} :: {$last_query}");
|
||||
|
||||
$data['vrfc_type_cd'] = $atcl_vrfc_type;
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'];
|
||||
$return['error_message'] = $error['message'];
|
||||
|
||||
if (empty($return['error_number'])) {
|
||||
// 로그를 남긁다.
|
||||
if ($this->db->affectedRows() > 0) {
|
||||
$changed = $this->whatIsChanged($list, $data, $atcl_vr_sq);
|
||||
if (!empty($changed)) {
|
||||
$this->saveChangedHistory($list['vr_sq'], $list['pre_stat_cd'], 'C25', $usr_id, $changed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function saveApiErr($err_sq, $err_code, $err_nm, $err_time, $err_no, $err_server = '')
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO err_api (err_sq, err_code, err_nm, err_time, err_no, err_server)" .
|
||||
" VALUES (?, ?, ?, ?, ?, ?);";
|
||||
|
||||
$data = array(
|
||||
$err_sq,
|
||||
$err_code,
|
||||
$err_nm,
|
||||
$err_time,
|
||||
$err_no,
|
||||
$err_server
|
||||
);
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
// 메모조회
|
||||
public function getMemo($vr_sq)
|
||||
{
|
||||
@@ -971,6 +1114,30 @@ class M704Model extends Model
|
||||
];
|
||||
}
|
||||
|
||||
// 전화실패
|
||||
public function saveContactFail($vr_sq)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "update v2_vrfc_req set contact_fail_cnt = ifnull(contact_fail_cnt, 0) +1 where vr_sq = ?";
|
||||
$data = array($vr_sq);
|
||||
|
||||
if ($this->db->query($sql, $data) === false) {
|
||||
return [
|
||||
'success' => false,
|
||||
'msg' => '통화실패 처리중 오류가 발생했습니다.',
|
||||
];
|
||||
}
|
||||
|
||||
$row = $this->getDetail($vr_sq);
|
||||
|
||||
$this->saveChangedHistory($vr_sq, $row['data']['stat_cd'], 'C29', $usr_id, '통화실패');
|
||||
|
||||
return [
|
||||
'success' => true
|
||||
];
|
||||
}
|
||||
|
||||
// 다음 전화매물 가져오기
|
||||
public function getNextTelInfo($vr_sq)
|
||||
{
|
||||
@@ -1003,4 +1170,409 @@ class M704Model extends Model
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/* 현재 상태 확인 */
|
||||
public function chkStat($vr_sq)
|
||||
{
|
||||
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
|
||||
$data = array(
|
||||
$vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function InsCharger($atcl_vr_sq)
|
||||
{
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "UPDATE v2_article_info" .
|
||||
" SET charger = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$usr_id,
|
||||
$atcl_vr_sq
|
||||
);
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
$log_v = $this->db->getLastQuery();
|
||||
log_message('debug', $log_v);
|
||||
}
|
||||
|
||||
public function chkTryCnt($atcl_vr_sq)
|
||||
{
|
||||
// 1차 검증인지 2차 검증인지 확인.
|
||||
$sql = "SELECT try_cnt FROM v2_vrfc_req WHERE vr_sq = ?";
|
||||
|
||||
$query = $this->db->query($sql, [$atcl_vr_sq]);
|
||||
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
/*
|
||||
* 등기부등본 확인중의 상태인 적이 있었는지 확인
|
||||
*/
|
||||
public function chkHistoryStat($atcl_vr_sq)
|
||||
{
|
||||
$sql = "select count(a.stat_cd) from v2_chg_history a " .
|
||||
"where vr_sq = ? and stat_cd = 40 " .
|
||||
"order by vr_sq desc;";
|
||||
$data = array(
|
||||
$atcl_vr_sq
|
||||
);
|
||||
$query = $this->db->query($sql, $data);
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function chkConfirm($atcl_vr_sq, $reg_yn = null)
|
||||
{
|
||||
$builder = $this->db->table('v2_confirm');
|
||||
$builder->select('vr_sq');
|
||||
$builder->where('vr_sq', $atcl_vr_sq);
|
||||
|
||||
if ($reg_yn) {
|
||||
$builder->where('vrfc_type', $reg_yn);
|
||||
}
|
||||
|
||||
$query = $builder->get();
|
||||
return $query->getNumRows();
|
||||
}
|
||||
|
||||
public function insertConfirm($vr_sq, $vrfc_type, $success, $type)
|
||||
{ //v2_confirm INSERT
|
||||
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$sql = "INSERT INTO v2_confirm" .
|
||||
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
|
||||
"VALUES" .
|
||||
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW())";
|
||||
|
||||
$data = array(
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$success,
|
||||
$type,
|
||||
$usr_id,
|
||||
$usr_sq,
|
||||
$usr_sq
|
||||
);
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function getUpdateFailTime($vr_sq)
|
||||
{
|
||||
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
|
||||
"from v2_chg_stat " .
|
||||
"where vr_sq = ? and stat_cd = 39 " .
|
||||
"order by insert_tm desc " .
|
||||
"limit 1";
|
||||
$data = array($vr_sq);
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row = $query->getRowArray();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function updateConfirm($vr_sq, $vrfc_type, $success)
|
||||
{
|
||||
$data = [
|
||||
'success' => $success
|
||||
];
|
||||
|
||||
$builder = $this->db->table('v2_confirm');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->where('vrfc_type', $vrfc_type);
|
||||
$builder->update($data);
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'];
|
||||
$return['error_message'] = $error['message'];
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function chgStat($vr_sq, $stat_cd, $insert_tm)
|
||||
{
|
||||
// 상태변경 TABLE INSERT
|
||||
$usr_sq = session('usr_sq');
|
||||
$usr_id = session('usr_id');
|
||||
|
||||
$list = $this->getDetail($vr_sq);
|
||||
|
||||
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)" .
|
||||
"VALUES (?, ?, ?, ?)" .
|
||||
"ON DUPLICATE KEY " .
|
||||
"UPDATE vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
|
||||
|
||||
$data = [
|
||||
$vr_sq,
|
||||
$stat_cd,
|
||||
$usr_sq,
|
||||
$insert_tm
|
||||
];
|
||||
|
||||
$this->db->transStart();
|
||||
$res = $this->db->query($sql, $data);
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'];
|
||||
$return['error_message'] = $error['message'];
|
||||
|
||||
if (empty($return['error_number'])) {
|
||||
// 로그를 남긴다.
|
||||
if ($this->db->affectedRows() > 0) {
|
||||
$changed = "전화확인 정보 저장";
|
||||
if (!empty($changed)) {
|
||||
$this->saveChangedHistory($list['vr_sq'], $stat_cd, 'C9', $usr_id, $changed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function chgStatVrfc($vr_sq, $stat_cd)
|
||||
{
|
||||
$data = ['stat_cd' => $stat_cd];
|
||||
|
||||
$builder = $this->db->table('v2_vrfc_req');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'];
|
||||
$return['error_message'] = $error['message'];
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function chgStatFax($vr_sq, $stat_cd)
|
||||
{
|
||||
$data = ['stat_cd' => $stat_cd];
|
||||
|
||||
$builder = $this->db->table('fax_imgs');
|
||||
$builder->where('vr_sq', $vr_sq);
|
||||
$builder->update($data);
|
||||
|
||||
$error = $this->db->error();
|
||||
$return['error_number'] = $error['code'];
|
||||
$return['error_message'] = $error['message'];
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function chgRegTryCnt($vr_sq, $reg_try_cnt)
|
||||
{
|
||||
$sql = "UPDATE v2_vrfc_req" .
|
||||
" SET reg_try_cnt = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$reg_try_cnt,
|
||||
$vr_sq
|
||||
);
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function chgTryCnt($vr_sq, $try_cnt)
|
||||
{ //v2_vrfc_req try_cnt 값 변경.
|
||||
$sql = "UPDATE v2_vrfc_req" .
|
||||
" SET try_cnt = ?" .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$try_cnt,
|
||||
$vr_sq
|
||||
);
|
||||
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
|
||||
{ //v2_check_list INSERT
|
||||
|
||||
$usr_sq = session('usr_sq');
|
||||
|
||||
$sql = "INSERT INTO v2_check_list" .
|
||||
"(vr_sq, vrfc_type, type, code, comment, insert_user, insert_tm)" .
|
||||
"VALUES" .
|
||||
"(?, ?, ?, ?, ?, ?, NOW())" .
|
||||
" ON DUPLICATE KEY UPDATE" .
|
||||
" vr_sq=values(vr_sq), vrfc_type=values(vrfc_type), type=values(type), code=values(code), comment=values(comment), insert_user=values(insert_user), insert_tm=values(insert_tm)";
|
||||
|
||||
$data = array(
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$type,
|
||||
$code,
|
||||
$comment,
|
||||
$usr_sq
|
||||
);
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
$log_v = $this->db->getLastQuery();
|
||||
log_message('debug', "704 => " . $log_v);
|
||||
|
||||
}
|
||||
|
||||
public function deleteChkList($vr_sq, $vrfc_type, $type)
|
||||
{
|
||||
$sql = "delete from v2_check_list where vr_sq = ? and vrfc_type = ? and type = ?";
|
||||
$data = array(
|
||||
$vr_sq,
|
||||
$vrfc_type,
|
||||
$type
|
||||
);
|
||||
$this->db->query($sql, $data);
|
||||
}
|
||||
|
||||
public function up_tel_fail_cause($vr_sq, $tel_fail_cause)
|
||||
{
|
||||
$sql = "UPDATE v2_vrfc_req" .
|
||||
" SET tel_fail_cause = ? " .
|
||||
" WHERE vr_sq = ?";
|
||||
|
||||
$data = array(
|
||||
$tel_fail_cause,
|
||||
$vr_sq
|
||||
);
|
||||
|
||||
$res = $this->db->query($sql, $data);
|
||||
echo $this->db->getLastQuery();
|
||||
$return['error_number'] = $this->db->_error_number();
|
||||
$return['error_message'] = $this->db->_error_message();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/* 검증결과 전송 API를 위한 데이터 조회. */
|
||||
public function getDataConfirmAPI($vr_sq)
|
||||
{
|
||||
// 요청정보
|
||||
$sql = "SELECT vr_sq, atcl_no, step, cpid, cp_atcl_id, trade_type, realtor_nm, realtor_tel_no, seller_tel_no, vrfc_type, rgbk_confirm, req_type, rdate, stat_cd, try_cnt, insert_user, insert_tm" .
|
||||
" FROM v2_vrfc_req where vr_sq = ?";
|
||||
$data = [$vr_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_vrfc_req = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 매물정보
|
||||
$sql = "SELECT vr_sq, atcl_no, cpid, cp_atcl_id, rlet_type_cd, trade_type, address_code, address1, address2, address3, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sise, floor, rdate, seller_tel_no, seller_nm, realtor_nm, realtor_tel_no, hscp_no, hscp_nm, ptp_no, ptp_nm, charger, req_price_yn, reg_charger, dept1_sq, dept2_sq, reg_dept1_sq, reg_dept2_sq, floor2" .
|
||||
" FROM v2_article_info where vr_sq = ?";
|
||||
$data = [$vr_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_article_info = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 수정정보
|
||||
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, address4, trade_type, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, hscp_no, hscp_nm, ptp_no, ptp_nm, modify_yn, floor2" .
|
||||
" FROM v2_modify_info where vr_sq = ?";
|
||||
$data = [$vr_sq];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_modify_info = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 검증결과
|
||||
$sql = "SELECT vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm, work_type" .
|
||||
" FROM v2_confirm where vr_sq = ? and vrfc_type = ?";
|
||||
$data = [$vr_sq, $row_vrfc_req['vrfc_type']];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$row_confirm = $query->getRowArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
// 확인정보
|
||||
$sql = "SELECT cl_sq, vr_sq, vrfc_type, type, code, comment, ownerNm, ownerBirth insert_user, insert_tm " .
|
||||
" FROM v2_check_list where vr_sq = ? and vrfc_type = ? and type like concat(vrfc_type, '%')";
|
||||
$data = [$vr_sq, $row_vrfc_req['vrfc_type']];
|
||||
$query = $this->db->query($sql, $data);
|
||||
$res_check_list = $query->getResultArray();
|
||||
|
||||
log_message('debug', $this->db->getLastQuery());
|
||||
|
||||
log_message('debug', implode(', ', $row_confirm));
|
||||
|
||||
$atclNo = $row_vrfc_req['atcl_no'];
|
||||
$success = empty($row_confirm['success']) ? false : true;
|
||||
$charger = $row_confirm['charger'];
|
||||
$date = $row_confirm['date'];
|
||||
|
||||
$checkList = [];
|
||||
foreach ($res_check_list as $row) {
|
||||
$checkList[] = [
|
||||
'type' => $row['type'],
|
||||
'code' => $row['code'],
|
||||
'comment' => $row['comment'],
|
||||
'ownerNm' => $row['ownerNm'],
|
||||
'ownerBirth' => $row['ownerBirth'],
|
||||
];
|
||||
}
|
||||
|
||||
$modifyInfo = [];
|
||||
if ($row_modify_info['modify_yn'] == 'Y') {
|
||||
if (!empty($row_modify_info['hscp_no'])) {
|
||||
// 공동주택
|
||||
$modifyInfo = [
|
||||
'hscpNo' => $row_modify_info['hscp_no'],
|
||||
'ptpNo' => $row_modify_info['ptp_no'],
|
||||
'bildNm' => $row_modify_info['address2'],
|
||||
'rmNo' => $row_modify_info['address3'],
|
||||
'tradeType' => $row_modify_info['trade_type'],
|
||||
'dealAmt' => $row_modify_info['deal_amt'],
|
||||
'wrrntAmt' => $row_modify_info['wrrnt_amt'],
|
||||
'leaseAmt' => $row_modify_info['lease_amt'],
|
||||
'isaleAmt' => $row_modify_info['isale_amt'],
|
||||
'premAmt' => $row_modify_info['prem_amt'],
|
||||
'floor' => $row_modify_info['floor'],
|
||||
];
|
||||
} else {
|
||||
// 비공동주택
|
||||
$modifyInfo = [
|
||||
'addressCode' => $row_modify_info['address_code'],
|
||||
'address2' => $row_modify_info['address2'],
|
||||
'address3' => $row_modify_info['address3'],
|
||||
'tradeType' => $row_modify_info['trade_type'],
|
||||
'dealAmt' => $row_modify_info['deal_amt'],
|
||||
'wrrntAmt' => $row_modify_info['wrrnt_amt'],
|
||||
'leaseAmt' => $row_modify_info['lease_amt'],
|
||||
'splySpc' => $row_modify_info['sply_spc'],
|
||||
'exclsSpc' => $row_modify_info['excls_spc'],
|
||||
'totSpc' => $row_modify_info['tot_spc'],
|
||||
'grndSpc' => $row_modify_info['grnd_spc'],
|
||||
'bldgSpc' => $row_modify_info['bldg_spc'],
|
||||
'floor' => $row_modify_info['floor'],
|
||||
'floor2' => $row_modify_info['floor2'],
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'atclNo' => $atclNo,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'modifyInfo' => $modifyInfo,
|
||||
'date' => $date,
|
||||
'try_cnt' => '',
|
||||
];
|
||||
} else {
|
||||
return array(
|
||||
'atclNo' => $atclNo,
|
||||
'success' => $success,
|
||||
'checkList' => $checkList,
|
||||
'charger' => $charger,
|
||||
'date' => $date,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -704,4 +704,19 @@ class M710Model extends Model
|
||||
}
|
||||
|
||||
|
||||
public function get_send_yn($type)
|
||||
{
|
||||
$sql = "SELECT stop_yn
|
||||
FROM v2_stop_api_chg_stat
|
||||
WHERE TYPE = ?
|
||||
ORDER BY pk DESC
|
||||
LIMIT 1";
|
||||
$date = array(
|
||||
$type
|
||||
);
|
||||
$query = $this->db->query($sql, $date);
|
||||
$return = $query->getRowArray();
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -163,7 +163,7 @@
|
||||
style="max-width: 320px;">
|
||||
<input type="text" class="form-control"
|
||||
name="atcl_no" id="atcl_no"
|
||||
value="<?= $data['atcl_no'] ?>" maxlength="10"
|
||||
value="<?= $data['fax_sq'] ?>" maxlength="10"
|
||||
placeholder="매물번호 입력">
|
||||
<button type="button"
|
||||
class="btn btn-outline-primary"
|
||||
@@ -1578,7 +1578,7 @@
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
title: "매물조회 실패",
|
||||
icon: "error"
|
||||
})
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user