This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace App\Controllers\Article;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Libraries\MyUpload;
|
||||
use App\Models\article\ReceiptModel;
|
||||
use App\Models\common\CodeModel;
|
||||
|
||||
@@ -146,29 +147,65 @@ class Receipt extends BaseController
|
||||
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
$codes = $this->codeModel->getCodeLists(['TRADE_TYPE', 'RECEIPT_STATUS2', 'RECEIPT_STATUS3', 'SMS_MSG_TYPE']); // 코드조회
|
||||
$codes = $this->codeModel->getCodeLists(['TRADE_TYPE', 'RECEIPT_STATUS2', 'RECEIPT_STATUS3', 'SMS_MSG_TYPE', 'SMS_MSG_TYPE2']); // 코드조회
|
||||
$bonbu = $this->model->getBonbuList();
|
||||
$team = $this->model->getTeamList();
|
||||
|
||||
// sms 코드
|
||||
$sms = [];
|
||||
foreach ($codes as $c) {
|
||||
if ($c['category'] === "SMS_MSG_TYPE2")
|
||||
array_push($sms, $c);
|
||||
}
|
||||
|
||||
$data = $this->model->getDetail($id);
|
||||
$history = $this->model->getHistory($id);
|
||||
|
||||
$aptGround = $this->model->getAptGround($data['rcpt_dong']);
|
||||
if ($data['rcpt_jibun_addr']) {
|
||||
$dupleGroundPlan = $this->model->getDupleGP_na($id, $data['rcpt_sido'], $data['rcpt_gugun'], $data['rcpt_dong'], $data['rcpt_hscp_nm'], $data['rcpt_dtl_addr'], $data['rcpt_li_addr'], $data['rcpt_jibun_addr'], $data['rcpt_etc_addr']);
|
||||
} else {
|
||||
$dupleGroundPlan = $this->model->getDupleGP($id, $data['rcpt_sido'], $data['rcpt_gugun'], $data['rcpt_dong'], $data['rcpt_hscp_nm'], $data['rcpt_dtl_addr'], $data['rcpt_ho']);
|
||||
}
|
||||
|
||||
$aptGround = $this->model->getAptGround($data['rcpt_dong'] ?? '');
|
||||
|
||||
|
||||
// 이미지 파일리스트
|
||||
$images = $this->model->getImageList2($data['rsrv_sq']);
|
||||
$imgs_count = $this->model->getImageCountByType($data['rsrv_sq']);
|
||||
$imgs_count = convertArrayToHashTable($imgs_count, 'img_type', 'img_cnt');
|
||||
|
||||
//녹취파일
|
||||
$record = $this->model->getRecordInfo($data['rsrv_sq']);
|
||||
|
||||
// 시간대별통계
|
||||
$tmCount = $this->model->getUsrRsrvDateTmCount($id);
|
||||
|
||||
// 체크리스트 조회
|
||||
if ($data['exp_photo_yn'] === "N") {
|
||||
$result_check = $this->model->getChecklist($data['rsrv_sq']);
|
||||
} else {
|
||||
$result_check = [];
|
||||
}
|
||||
|
||||
$this->data['codes'] = $codes;
|
||||
$this->data['bonbu'] = $bonbu;
|
||||
$this->data['team'] = $team;
|
||||
$this->data['sms'] = $sms;
|
||||
|
||||
$this->data['data'] = $data;
|
||||
$this->data['history'] = $history;
|
||||
|
||||
$this->data['dupleGroundPlan'] = $dupleGroundPlan;
|
||||
$this->data['apt_ground'] = $aptGround;
|
||||
|
||||
$this->data['images'] = $images;
|
||||
$this->data['imgs_count'] = $imgs_count;
|
||||
|
||||
$this->data['record'] = $record;
|
||||
|
||||
$this->data['tmCount'] = $tmCount;
|
||||
$this->data['result_check'] = $result_check;
|
||||
|
||||
|
||||
return view("pages/article/receipt/detail", $this->data);
|
||||
@@ -185,6 +222,233 @@ class Receipt extends BaseController
|
||||
$this->model->saveTel($tel);
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 평면도요청 저장
|
||||
public function resGround()
|
||||
{
|
||||
try {
|
||||
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$ground_plan = $this->request->getPost('ground_plan');
|
||||
|
||||
$this->model->saveGround($rcpt_sq, $ground_plan);
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 예약확정 저장
|
||||
public function assignRegist()
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 동영상촬영여부 저장
|
||||
public function requestMovie()
|
||||
{
|
||||
try {
|
||||
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
$exp_movie_yn = $this->request->getPost('exp_movie_yn');
|
||||
|
||||
$this->model->saveRequestMovie($rcpt_sq, $rsrv_sq, $exp_movie_yn);
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 중개사메모 저장
|
||||
public function requestMessage()
|
||||
{
|
||||
try {
|
||||
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
$request_msg = $this->request->getPost('request_msg');
|
||||
|
||||
$this->model->saveRequestMessage($rcpt_sq, $rsrv_sq, $request_msg);
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 예약취소
|
||||
public function rsrvcancel()
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 문자발송
|
||||
public function sendSms()
|
||||
{
|
||||
try {
|
||||
$rcpt_key = $this->request->getPost('rcpt_key');
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
$cd = $this->request->getPost('cd');
|
||||
|
||||
$send_phone = "1600-5749";
|
||||
$phone = $this->request->getPost('phone');
|
||||
$content = $this->request->getPost('content');
|
||||
$send_nm = session('usr_nm');
|
||||
|
||||
$data = $this->model->getDetail($rcpt_key);
|
||||
|
||||
$dest_name = "";
|
||||
if ($cd == "S7" || $cd == "S14") {
|
||||
$dest_name = "(거주인)" . $data['rec_nm'];
|
||||
} else {
|
||||
$dest_name = "(중개인)" . $data['agent_nm'];
|
||||
}
|
||||
|
||||
$this->model->sendSms($phone, "", $send_phone, $send_nm, $dest_name, $rsrv_sq, $rcpt_sq, $cd, $data);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 거주인정보저장
|
||||
public function saveRecInfo()
|
||||
{
|
||||
$lib = new MyUpload();
|
||||
|
||||
try {
|
||||
|
||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||
$rcpt_key = $this->request->getPost('rcpt_key');
|
||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||
|
||||
$rec_tel1 = $this->request->getPost('rec_tel1');
|
||||
$rec_tel2 = $this->request->getPost('rec_tel2');
|
||||
$rec_tel3 = $this->request->getPost('rec_tel3');
|
||||
$rec_tel = $rec_tel1 . '-' . $rec_tel2 . '-' . $rec_tel3;
|
||||
|
||||
$rec_nm = $this->request->getPost('rec_nm');
|
||||
$rec_remark = $this->request->getPost('rec_remark');
|
||||
|
||||
$file = $this->request->getFile('rec_file');
|
||||
|
||||
$data = [
|
||||
'rcpt_sq' => $rcpt_sq,
|
||||
'rsrv_sq' => $rsrv_sq,
|
||||
'rcpt_key' => $rcpt_key,
|
||||
'rec_tel' => $rec_tel,
|
||||
'rec_nm' => $rec_nm,
|
||||
'rec_remark' => $rec_remark,
|
||||
];
|
||||
|
||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||
|
||||
$uploadPath = "/upload/result/" . $rsrv_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'] = [
|
||||
'orig_name' => $uploadFile['origin_name'],
|
||||
'new_name' => $uploadFile['file_name'],
|
||||
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
||||
'ext' => '.' . $uploadFile['ext'],
|
||||
'size' => $file->getSize(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->model->saveRecInfo($data);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
|
||||
Reference in New Issue
Block a user