This commit is contained in:
@@ -5,8 +5,11 @@ use App\Controllers\BaseController;
|
||||
|
||||
use App\Libraries\Common;
|
||||
use App\Libraries\MyUpload;
|
||||
use App\Libraries\NaverApiClient;
|
||||
use App\Models\article\DeptModel;
|
||||
use App\Models\article\ReceiptModel;
|
||||
use App\Models\common\CodeModel;
|
||||
use Exception;
|
||||
|
||||
class Receipt extends BaseController
|
||||
{
|
||||
@@ -143,6 +146,7 @@ class Receipt extends BaseController
|
||||
// 상세화면
|
||||
public function detail($id)
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
$id = (string) $id;
|
||||
|
||||
if ($id === '') {
|
||||
@@ -161,6 +165,10 @@ class Receipt extends BaseController
|
||||
$team = $this->model->getTeamList();
|
||||
log_message('info', '[Receipt::detail] getTeamList {ms}ms', ['ms' => (int) ((microtime(true) - $t2) * 1000)]);
|
||||
|
||||
$damdang = $this->model->getUserList();
|
||||
|
||||
|
||||
|
||||
// sms 코드
|
||||
$sms = [];
|
||||
foreach ($codes as $c) {
|
||||
@@ -209,6 +217,9 @@ class Receipt extends BaseController
|
||||
$tmCount = $this->model->getUsrRsrvDateTmCount($id);
|
||||
log_message('info', '[Receipt::detail] getUsrRsrvDateTmCount {ms}ms', ['ms' => (int) ((microtime(true) - $t10) * 1000)]);
|
||||
|
||||
// 당일 방문예정 매물.
|
||||
$assignList = $this->model->getAssignReceiptListByUser($data['rsrv_date'], $data['usr_sq'], array($id));
|
||||
|
||||
// 체크리스트 조회
|
||||
$t11 = microtime(true);
|
||||
if ($data['exp_photo_yn'] === "N") {
|
||||
@@ -217,13 +228,30 @@ class Receipt extends BaseController
|
||||
$result_check = [];
|
||||
}
|
||||
|
||||
$pdept = '';
|
||||
if (!empty($data['dept_sq'])) {
|
||||
$pdept = $this->model->getDeptDetail($data['dept_sq']);
|
||||
} else {
|
||||
$pdept = $this->model->getDeptDetail($data['region_dept_sq']);
|
||||
}
|
||||
|
||||
$complexList = [];
|
||||
$ptpList = [];
|
||||
|
||||
// print_r($data);
|
||||
// exit;
|
||||
|
||||
if ($data['comp_sq'] == '2') {
|
||||
// $callApi = new CallApi();
|
||||
// 아파트단지목록
|
||||
$complexList = $naver->complexList($data['rcpt_dong']);
|
||||
|
||||
// 평형목록
|
||||
$ptpList = $naver->ptpList($data['rcpt_hscp_no']);
|
||||
}
|
||||
|
||||
// print_r($ptpList);
|
||||
// exit;
|
||||
|
||||
log_message('info', '[Receipt::detail] getChecklist {ms}ms', ['ms' => (int) ((microtime(true) - $t11) * 1000)]);
|
||||
|
||||
log_message('info', '[Receipt::detail] total {ms}ms', ['ms' => (int) ((microtime(true) - $t0) * 1000)]);
|
||||
@@ -231,9 +259,13 @@ class Receipt extends BaseController
|
||||
$this->data['codes'] = $codes;
|
||||
$this->data['bonbu'] = $bonbu;
|
||||
$this->data['team'] = $team;
|
||||
$this->data['damdang'] = $damdang;
|
||||
$this->data['pdept'] = $pdept;
|
||||
|
||||
$this->data['sms'] = $sms;
|
||||
|
||||
$this->data['data'] = $data;
|
||||
$this->data['assignList'] = $assignList;
|
||||
$this->data['history'] = $history;
|
||||
|
||||
$this->data['dupleGroundPlan'] = $dupleGroundPlan;
|
||||
@@ -247,6 +279,9 @@ class Receipt extends BaseController
|
||||
$this->data['tmCount'] = $tmCount;
|
||||
$this->data['result_check'] = $result_check;
|
||||
|
||||
$this->data['complexList'] = $complexList;
|
||||
$this->data['ptpList'] = $ptpList;
|
||||
|
||||
|
||||
return view("pages/article/receipt/detail", $this->data);
|
||||
}
|
||||
@@ -275,6 +310,48 @@ class Receipt extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 거주여부 저장
|
||||
public function resDbYn()
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
try {
|
||||
|
||||
$rcpt_key = $this->request->getPost('rcpt_key');
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
$res_yn = $this->request->getPost('resYn');
|
||||
$dbUsageAgrYn = $this->request->getPost('dbUsageAgrYn');
|
||||
|
||||
$this->model->saveResDB($rcpt_sq, $rsrv_sq, $res_yn, $dbUsageAgrYn);
|
||||
|
||||
$receipt = $this->getDetail($rcpt_key);
|
||||
if ($res_yn == 'Y') {
|
||||
$isResidentsExist = true;
|
||||
} else {
|
||||
$isResidentsExist = false;
|
||||
}
|
||||
|
||||
$api_result = $naver->residentsExistence($rcpt_key, $isResidentsExist);
|
||||
|
||||
|
||||
if (!isset($api_result['result'])) {
|
||||
throw new \Exception('API 통신오류입니다.\n다시 저장하여 주십시요.');
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 평면도요청 저장
|
||||
public function resGround()
|
||||
{
|
||||
@@ -302,13 +379,42 @@ class Receipt extends BaseController
|
||||
// 예약확정 저장
|
||||
public function assignRegist()
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
$deptModel = new DeptModel();
|
||||
|
||||
try {
|
||||
|
||||
//전달받은 값
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rcpt_key = $this->request->getPost('rcpt_key');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
$rsrv_date = $this->request->getPost('rsrv_date');
|
||||
$rsrv_tm_ap = $this->request->getPost('rsrv_tm_ap');
|
||||
$rsrv_tm_hour = $this->request->getPost('rsrv_tm_hour');
|
||||
$bonbu = $this->request->getPost('bonbu');
|
||||
$dept_sq = $this->request->getPost('dept_sq');
|
||||
$usr_sq = $this->request->getPost('usr_sq');
|
||||
|
||||
$bonbuInfo = $deptModel->getDeptDetail($bonbu);
|
||||
$deptInfo = $deptModel->getDeptDetail($dept_sq);
|
||||
$userInfo = $this->model->getUserDetail($usr_sq);
|
||||
$receipt = $this->model->getDetail($rcpt_key);
|
||||
|
||||
/*** 네이버 연동[s] ***/
|
||||
$na_result = $naver->reserveSuccess($rcpt_key, 'Y', $bonbuInfo['dept_nm'], $deptInfo['dept_nm'], $userInfo['usr_nm'], $userInfo['usr_tel1'], $rsrv_date, $rsrv_tm_ap);
|
||||
/*** 네이버 연동[e] ***/
|
||||
|
||||
if (array_key_exists('result', $na_result)) { //네이버연동 상태변경 완료
|
||||
$result = $this->model->assignRegist($rcpt_sq, $rsrv_date, $rsrv_tm_ap, $rsrv_tm_hour, $dept_sq, $usr_sq, $receipt);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
} else {
|
||||
throw new \Exception($na_result['message']);
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
@@ -371,10 +477,44 @@ class Receipt extends BaseController
|
||||
// 예약취소
|
||||
public function rsrvcancel()
|
||||
{
|
||||
$naver = new NaverApiClient();
|
||||
|
||||
try {
|
||||
//전달받은 값
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
$rcpt_key = $this->request->getPost('rcpt_key');
|
||||
$result_cd2 = $this->request->getPost('result_cd2');
|
||||
$result_cd3 = $this->request->getPost('result_cd3');
|
||||
$result_msg = $this->request->getPost('result_msg');
|
||||
$rcpt_stat1 = $this->request->getPost('rcpt_stat1');
|
||||
|
||||
$receipt = $this->model->getDetail($rcpt_key);
|
||||
|
||||
/*** 네이버 연동[s] ***/
|
||||
if ($result_cd2 == '9010' || $result_cd2 == '9020') { //예약취소
|
||||
$na_result = $naver->reserveFail($rcpt_key, "E11", $result_msg);
|
||||
} else if ($result_cd2 == '9030') {
|
||||
if ($rcpt_stat1 == '70') {
|
||||
throw new \Exception('방문전 취소 할 수 없습니다.');
|
||||
} else {
|
||||
$na_result = $naver->shootFail($rcpt_key, "E21", $result_msg);
|
||||
}
|
||||
} else if ($result_cd2 == '9040') {
|
||||
$na_result = $naver->shootFail($rcpt_key, "E22", $result_msg);
|
||||
} else if ($result_cd2 == '9045') {
|
||||
$na_result = $naver->shootFail($rcpt_key, "E23", $result_msg);
|
||||
} else if ($result_cd2 == '9050') {
|
||||
$na_result = $naver->inspectFail($rcpt_key, 'E31', $result_msg);
|
||||
}
|
||||
/*** 네이버 연동[e] ***/
|
||||
|
||||
if (array_key_exists('result', $na_result)) { //네이버연동 상태변경 완료
|
||||
$result = $this->model->rsrvcancel($rcpt_sq, $rsrv_sq, $result_cd2, $result_cd3, $result_msg, $receipt);
|
||||
|
||||
} else {
|
||||
throw new \Exception($na_result['message']);
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
@@ -389,6 +529,55 @@ class Receipt extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 상태변경
|
||||
public function chgStatus()
|
||||
{
|
||||
try {
|
||||
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rcpt_key = $this->request->getPost('rcpt_key');
|
||||
$rcpt_stat = $this->request->getGet('rcpt_stat');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
$req_rec_yn = $this->request->getGet('reqRecYn');
|
||||
|
||||
$rsrv_date = $this->request->getPost('rsrv_date');
|
||||
$rsrv_tm_ap = $this->request->getPost('rsrv_tm_ap');
|
||||
$rsrv_tm_hour = $this->request->getPost('rsrv_tm_hour');
|
||||
$bonbu = $this->request->getPost('bonbu');
|
||||
$dept_sq = $this->request->getPost('dept_sq');
|
||||
$usr_sq = $this->request->getPost('usr_sq');
|
||||
|
||||
$rletTypeCd = $this->request->getGet('rletTypeCd');
|
||||
|
||||
// 파라미터 디버그 로깅
|
||||
$p = [
|
||||
'rcpt_sq' => $rcpt_sq,
|
||||
'rcpt_key' => $rcpt_key,
|
||||
'rcpt_stat' => $rcpt_stat,
|
||||
'rsrv_sq' => $rsrv_sq,
|
||||
'req_rec_yn' => $req_rec_yn,
|
||||
'rsrv_date' => $rsrv_date,
|
||||
'rsrv_tm_ap' => $rsrv_tm_ap,
|
||||
'rsrv_tm_hour' => $rsrv_tm_hour,
|
||||
'bonbu' => $bonbu,
|
||||
'dept_sq' => $dept_sq,
|
||||
'usr_sq' => $usr_sq,
|
||||
'rletTypeCd' => $rletTypeCd,
|
||||
];
|
||||
|
||||
|
||||
print_r($p);
|
||||
exit;
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 문자발송
|
||||
public function sendSms()
|
||||
|
||||
Reference in New Issue
Block a user