워커 수정

This commit is contained in:
2026-04-27 15:03:36 +09:00
parent b0ec75ae56
commit f8c26acea8
30 changed files with 1317 additions and 1142 deletions

View File

@@ -26,6 +26,14 @@ class NaverWorker extends BaseCommand
helper(['log', 'redis']); // redis helper 추가
$this->db = \Config\Database::connect();
// 워커 시작 시점에 선제적으로 연결 상태를 보정
try {
$this->db->initialize();
} catch (\Throwable $e) {
CLI::error('Database connection init failed: ' . $e->getMessage());
}
$logModel = model(NaverWorkerLogModel::class);
$naverService = new \App\Services\NaverService(); // 서비스 생성
@@ -107,12 +115,13 @@ class NaverWorker extends BaseCommand
'raw_payload' => $rawData,
'status' => 'INIT'
]);
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
// MySQL gone away 에러 시 재연결 후 재시도
if (strpos($e->getMessage(), 'MySQL server has gone away') !== false) {
} catch (\Throwable $e) {
// MySQL 연결 계열 에러 시 재연결 후 재시도
if ($this->isMySqlConnectionError($e)) {
CLI::write(CLI::color('⚠️ MySQL gone away, reconnecting...', 'yellow'));
$this->db->close();
$this->db = \Config\Database::connect();
$this->db->initialize();
$logModel = model(NaverWorkerLogModel::class);
// 재시도
@@ -188,17 +197,18 @@ class NaverWorker extends BaseCommand
}
/**
* MySQL gone away 에러 발생 시 재연결 후 재시도하는 안전한 update
* MySQL 연결 계열 에러 발생 시 재연결 후 재시도하는 안전한 update
*/
protected function safeUpdateLog($logModel, $logId, $data)
{
try {
return $logModel->update($logId, $data);
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
if (strpos($e->getMessage(), 'MySQL server has gone away') !== false) {
} catch (\Throwable $e) {
if ($this->isMySqlConnectionError($e)) {
CLI::write(CLI::color('⚠️ MySQL gone away on update, reconnecting...', 'yellow'));
$this->db->close();
$this->db = \Config\Database::connect();
$this->db->initialize();
$logModel = model(\App\Models\Entities\NaverWorkerLogModel::class);
// 재시도
@@ -209,6 +219,18 @@ class NaverWorker extends BaseCommand
}
}
/**
* MySQL 연결 끊김 계열 에러 여부 판별
*/
protected function isMySqlConnectionError(\Throwable $e): bool
{
$message = strtolower($e->getMessage());
return str_contains($message, 'mysql server has gone away')
|| str_contains($message, 'lost connection to mysql server')
|| str_contains($message, 'server has gone away');
}
/**
* 폴백 파일에서 데이터 읽기 (Redis 장애 시 파일에서 직접 처리)
*

View File

@@ -28,6 +28,8 @@ $routes->group('common', ['namespace' => 'App\Controllers\Common'], function ($r
$routes->post('common/changeUserPass', 'Common::changeUserPass'); // 비밀번호변경
$routes->get('getComplexList', 'Common::getComplexList'); // 단지목록조회
$routes->get('getPyeongInfo', 'Common::getPyeongInfo'); // 평형정보조회
});
@@ -84,6 +86,8 @@ $routes->group('', ['namespace' => 'App\Controllers\Article'], static function (
$routes->post('updateImageOrder', 'Receipt::updateImageOrder'); // 이미지 순서 업데이트
$routes->get('downloadAllImages', 'Receipt::downloadAllImages'); // 이미지 일괄 다운로드
$routes->post('saveImgLocation', 'Receipt::saveImgLocation'); // 촬영위치 저장
$routes->post('modifyPriceInfo', 'Receipt::modifyPriceInfo'); // 가격정보 수정
});
/**

View File

@@ -9,27 +9,64 @@ use App\Libraries\NaverApiClient;
use App\Models\article\DeptModel;
use App\Models\article\ReceiptModel;
use App\Models\common\CodeModel;
use App\Models\Entities\ReceiptModel as ReceiptEntity;
use App\Models\Entities\ChangedHistoryModel as ChangedHistoryEntity;
use Exception;
class Receipt extends BaseController
{
private $model, $codeModel;
private $model, $entityModel, $codeModel, $changedHistoryEntity;
private $naverApiClient;
private const SEARCH_FILTER_KEYS = [
'rcpt_atclno',
'schDateGb',
'sdate',
'edate',
'bonbu',
'team',
'user',
'sido',
'gugun',
'dong',
'rcpt_stat1',
'rcpt_stat2',
'rcpt_stat3',
'rcpt_product_info1',
'exp_movie_yn',
'conf_img_yn',
'parcel_out_yn',
'rcpt_cpid',
'rcpt_product',
'exp_spc_yn',
'check_list_img_yn',
'ground_plan_yn',
'ground_plan',
'direct_trad_yn',
'image_360_yn',
'srchType',
'srchTxt',
];
public function __construct()
{
$this->model = new ReceiptModel();
$this->entityModel = new ReceiptEntity();
$this->codeModel = new CodeModel();
$this->changedHistoryEntity = new ChangedHistoryEntity();
$this->naverApiClient = new NaverApiClient();
}
public function lists(): string
{
log_message('error', '========== Receipt::lists() CALLED ==========');
log_message('info', '========== Receipt::lists() CALLED ==========');
$usr_id = $this->request->getGet('usr_id') ?: '';
$sBonbu = $this->request->getGet('bonbu') ?: '';
$sTeanm = $this->request->getGet('dept_sq') ?: '';
$sTeam = $this->request->getGet('dept_sq') ?: '';
$codes = $this->codeModel->getCodeLists(['NHN_DEAL_TYPE', 'CP_ID', 'ARTICLE_TYPE', 'VRFCREQ_WAY', 'STEP_VERIFICATION']); // 코드조회
$sido = $this->model->getAreaList(); // 지역조회
$bonbu = $this->model->getBonbuList();
$team = $this->model->getTeamList();
@@ -48,7 +85,8 @@ class Receipt extends BaseController
}
$this->data['sBonbu'] = $sBonbu;
$this->data['sTeanm'] = $sTeanm;
$this->data['sTeam'] = $sTeam;
$this->data['sTeanm'] = $sTeam;
return view("pages/article/receipt/lists", $this->data);
@@ -61,40 +99,7 @@ class Receipt extends BaseController
$start = (int) $this->request->getGet('start') ?: 0;
$end = (int) $this->request->getGet('length') ?: 10;
$data = [
'rcpt_atclno' => $this->request->getGet('rcpt_atclno'), // 매물ID
'schDateGb' => $this->request->getGet('schDateGb'), // 일자유형
'sdate' => $this->request->getGet('sdate'), // 시작일
'edate' => $this->request->getGet('edate'), // 종료일
'bonbu' => $this->request->getGet('bonbu'), // 본부
'team' => $this->request->getGet('team'), // 팀
'user' => $this->request->getGet('user'), // 담당자
'sido' => $this->request->getGet('sido'), // 시도
'gugun' => $this->request->getGet('gugun'), // 시군구
'dong' => $this->request->getGet('dong'), // 읍면동
'rcpt_stat1' => $this->request->getGet('rcpt_stat1'), // 상태1
'rcpt_stat2' => $this->request->getGet('rcpt_stat2'), // 상태2
'rcpt_stat3' => $this->request->getGet('rcpt_stat3'), // 상태3
'rcpt_product_info1' => $this->request->getGet('rcpt_product_info1'), // 거래구분
'exp_movie_yn' => $this->request->getGet('exp_movie_yn'), // 동영상촬영여부
'conf_img_yn' => $this->request->getGet('conf_img_yn'), // 홍보확인서여부
'parcel_out_yn' => $this->request->getGet('parcel_out_yn'), // 분양권
'rcpt_cpid' => $this->request->getGet('rcpt_cpid'), // CPID
'rcpt_product' => $this->request->getGet('rcpt_product'), // 매물종류
'exp_spc_yn' => $this->request->getGet('exp_spc_yn'), // 면적확인
'check_list_img_yn' => $this->request->getGet('check_list_img_yn'), // 체크리스트
'ground_plan_yn' => $this->request->getGet('ground_plan_yn'), // 평면도유무
'ground_plan' => $this->request->getGet('ground_plan'), // 평면도요청
'direct_trad_yn' => $this->request->getGet('direct_trad_yn'), // 직거래
'image_360_yn' => $this->request->getGet('image_360_yn'), // 360촬영여부
'srchType' => $this->request->getGet('srchType'), // 검색유형
'srchTxt' => $this->request->getGet('srchTxt'), // 검색어
];
$data = $this->getSearchFilterData();
log_message('info', '[Receipt::getResultList] START - start=' . $start . ' length=' . $end);
@@ -103,7 +108,7 @@ class Receipt extends BaseController
$datas = $this->model->getResultList($start, $end, $data);
log_message('info', '[Receipt::getResultList] END - returned ' . count($datas) . ' rows');
// echo db_connect()->getLastQuery();
return $this->response->setJSON(body: [
'recordsTotal' => $totalCount,
'recordsFiltered' => $totalCount,
@@ -116,41 +121,7 @@ class Receipt extends BaseController
public function excel()
{
try {
$data = [
'rcpt_atclno' => $this->request->getGet('rcpt_atclno'), // 매물ID
'schDateGb' => $this->request->getGet('schDateGb'), // 일자유형
'sdate' => $this->request->getGet('sdate'), // 시작일
'edate' => $this->request->getGet('edate'), // 종료일
'bonbu' => $this->request->getGet('bonbu'), // 본부
'team' => $this->request->getGet('team'), // 팀
'user' => $this->request->getGet('user'), // 담당자
'sido' => $this->request->getGet('sido'), // 시도
'gugun' => $this->request->getGet('gugun'), // 시군구
'dong' => $this->request->getGet('dong'), // 읍면동
'rcpt_stat1' => $this->request->getGet('rcpt_stat1'), // 상태1
'rcpt_stat2' => $this->request->getGet('rcpt_stat2'), // 상태2
'rcpt_stat3' => $this->request->getGet('rcpt_stat3'), // 상태3
'rcpt_product_info1' => $this->request->getGet('rcpt_product_info1'), // 거래구분
'exp_movie_yn' => $this->request->getGet('exp_movie_yn'), // 동영상촬영여부
'conf_img_yn' => $this->request->getGet('conf_img_yn'), // 홍보확인서여부
'parcel_out_yn' => $this->request->getGet('parcel_out_yn'), // 분양권
'rcpt_cpid' => $this->request->getGet('rcpt_cpid'), // CPID
'rcpt_product' => $this->request->getGet('rcpt_product'), // 매물종류
'exp_spc_yn' => $this->request->getGet('exp_spc_yn'), // 면적확인
'check_list_img_yn' => $this->request->getGet('check_list_img_yn'), // 체크리스트
'ground_plan_yn' => $this->request->getGet('ground_plan_yn'), // 평면도유무
'ground_plan' => $this->request->getGet('ground_plan'), // 평면도요청
'direct_trad_yn' => $this->request->getGet('direct_trad_yn'), // 직거래
'image_360_yn' => $this->request->getGet('image_360_yn'), // 360촬영여부
'srchType' => $this->request->getGet('srchType'), // 검색유형
'srchTxt' => $this->request->getGet('srchTxt'), // 검색어
];
$data = $this->getSearchFilterData();
$datas = $this->model->getExcelList($data);
@@ -159,15 +130,28 @@ class Receipt extends BaseController
]);
} catch (\Exception $e) {
$e->getPrevious()->getTraceAsString();
log_message('error', '[Receipt::excel] Error: ' . $e->getMessage());
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
private function getSearchFilterData(): array
{
$data = [];
foreach (self::SEARCH_FILTER_KEYS as $key) {
$data[$key] = $this->request->getGet($key);
}
return $data;
}
// 상세화면
public function detail($id)
{
$naver = new NaverApiClient();
$id = (string) $id;
if ($id === '') {
@@ -188,13 +172,16 @@ class Receipt extends BaseController
$damdang = $this->model->getUserList();
$complexList = $this->naverApiClient->complexList($id);
// sms 코드
$sms = [];
foreach ($codes as $c) {
if ($c['category'] === "SMS_MSG_TYPE2")
array_push($sms, $c);
foreach (($codes['SMS_MSG_TYPE2']['items'] ?? []) as $cd => $cdNm) {
$sms[] = [
'category' => 'SMS_MSG_TYPE2',
'cd' => $cd,
'cd_nm' => $cdNm,
];
}
$t3 = microtime(true);
@@ -265,10 +252,10 @@ class Receipt extends BaseController
if ($data['comp_sq'] == '2') {
// 아파트단지목록
$complexList = $naver->complexList($data['rcpt_dong']);
$complexList = $this->naverApiClient->complexList($data['rcpt_dong']);
// 평형목록
$ptpList = $naver->ptpList($data['rcpt_hscp_no']);
$ptpList = $this->naverApiClient->ptpList($data['rcpt_hscp_no']);
}
// print_r($ptpList);
@@ -313,10 +300,13 @@ class Receipt extends BaseController
public function saveTel()
{
try {
$tel = $this->request->getPost('agent_tel');
$this->model->saveTel($tel);
$tel = (string) $this->request->getPost('agent_tel');
$rcpt_sq = (string) $this->request->getPost('rcpt_sq');
if (empty($tel)) {
throw new Exception("전화번호가 입력되지 않았습니다.");
}
$this->model->saveTel($rcpt_sq , $tel);
return $this->response->setJSON([
@@ -335,8 +325,6 @@ class Receipt extends BaseController
// 거주여부 저장
public function resDbYn()
{
$naver = new NaverApiClient();
try {
$rcpt_key = $this->request->getPost('rcpt_key');
@@ -362,7 +350,7 @@ class Receipt extends BaseController
log_message('info', '[resDbYn] 네이버 API 호출 시작 - rcpt_key: ' . $rcpt_key . ', charger: ' . $charger . ', updateData: ' . json_encode($updateData, JSON_UNESCAPED_UNICODE));
$api_result = $naver->updateArticleInfo($rcpt_key, $updateData, $charger);
$api_result = $this->naverApiClient->updateArticleInfo($rcpt_key, $updateData, $charger);
log_message('info', '[resDbYn] 네이버 API 응답 - result: ' . json_encode($api_result, JSON_UNESCAPED_UNICODE) . ' (type: ' . gettype($api_result) . ')');
@@ -429,7 +417,6 @@ class Receipt extends BaseController
// 예약확정 저장
public function assignRegist()
{
$naver = new NaverApiClient();
$deptModel = new DeptModel();
try {
@@ -451,7 +438,7 @@ class Receipt extends BaseController
$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);
$na_result = $this->naverApiClient->reserveSuccess($rcpt_key, 'Y', $bonbuInfo['dept_nm'], $deptInfo['dept_nm'], $userInfo['usr_nm'], $userInfo['usr_tel1'], $rsrv_date, $rsrv_tm_ap);
/*** 네이버 연동[e] ***/
if (isset($na_result['code']) && $na_result['code'] === 'success') { //네이버연동 상태변경 완료
@@ -527,8 +514,6 @@ class Receipt extends BaseController
// 예약취소
public function rsrvcancel()
{
$naver = new NaverApiClient();
try {
//전달받은 값
$rcpt_sq = $this->request->getPost('rcpt_sq');
@@ -543,19 +528,19 @@ class Receipt extends BaseController
/*** 네이버 연동[s] ***/
if ($result_cd2 == '9010' || $result_cd2 == '9020') { //예약취소
$na_result = $naver->reserveFail($rcpt_key, "E11", $result_msg);
$na_result = $this->naverApiClient->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);
$na_result = $this->naverApiClient->shootFail($rcpt_key, "E21", $result_msg);
}
} else if ($result_cd2 == '9040') {
$na_result = $naver->shootFail($rcpt_key, "E22", $result_msg);
$na_result = $this->naverApiClient->shootFail($rcpt_key, "E22", $result_msg);
} else if ($result_cd2 == '9045') {
$na_result = $naver->shootFail($rcpt_key, "E23", $result_msg);
$na_result = $this->naverApiClient->shootFail($rcpt_key, "E23", $result_msg);
} else if ($result_cd2 == '9050') {
$na_result = $naver->inspectFail($rcpt_key, 'E31', $result_msg);
$na_result = $this->naverApiClient->inspectFail($rcpt_key, 'E31', $result_msg);
}
/*** 네이버 연동[e] ***/
@@ -599,7 +584,7 @@ class Receipt extends BaseController
$rletTypeCd = $this->request->getGet('rletTypeCd');
// 파라미터 디버그 로깅
// 파라미터 로깅
$p = [
'rcpt_sq' => $rcpt_sq,
'rcpt_key' => $rcpt_key,
@@ -615,9 +600,10 @@ class Receipt extends BaseController
'rletTypeCd' => $rletTypeCd,
];
log_message('info', '[Receipt::chgStatus] params: ' . json_encode($p, JSON_UNESCAPED_UNICODE));
print_r($p);
exit;
// TODO: 기존 비즈니스 로직 복원 필요
throw new \Exception('상태변경 로직 점검 중입니다. 잠시 후 다시 시도해주세요.');
} catch (\Exception $e) {
@@ -1339,59 +1325,129 @@ class Receipt extends BaseController
}
}
public function modifyPriceInfo(){
public function modifyPriceInfo()
{
try {
$rcpt_sq = $this->request->getPost('rcpt_sq'); // 필수
$rcpt_key = $this->request->getPost('rcpt_key'); // 필수
$rcpt_no = $this->request->getPost('rcpt_no'); // 선택
$trade_type = $this->request->getPost('trade_type'); // 거래구분
$rcpt_product_info2 = $this->request->getPost('rcpt_product_info2'); // 보증금
$rcpt_product_info3 = $this->request->getPost('rcpt_product_info3'); // 월세
$rcpt_product_info4 = $this->request->getPost('rcpt_product_info4'); // 분양가
$rcpt_product_info5 = $this->request->getPost('rcpt_product_info5'); // 프리미엄
$rcpt_ptp_no = $this->request->getPost('rcpt_ptp_no'); // 단지정보
$rcpt_hscp_no = $this->request->getPost('rcpt_hscp_no'); // 평형정보
$rcpt_sq = $this->request->getPost('rcpt_sq');
$rcpt_key = $this->request->getPost('rcpt_key');
$trade_type = $this->request->getPost('trade_type');
$rcpt_product_info2 = $this->request->getPost('rcpt_product_info2');
$rcpt_product_info3 = $this->request->getPost('rcpt_product_info3');
$rcpt_product_info4 = $this->request->getPost('rcpt_product_info4');
$rcpt_product_info5 = $this->request->getPost('rcpt_product_info5');
$rcpt_product_info6 = $this->request->getPost('rcpt_product_info6');
// 거래유형에 따른 가격 정보 제한
$return = limitHscpMarketPriceInfo($trade_type, $rcpt_hscp_no, $rcpt_ptp_no, $rcpt_product_info2);
if (empty($return)){
}
if (empty($rcpt_sq) || empty($trade_type)) {
$rcpt_ptp_no = $this->request->getPost('rcpt_ptp_no');
$rcpt_hscp_no = $this->request->getPost('rcpt_hscp_no');
$dealAmount = $this->request->getPost('dealAmount') ?: 0;
$warrantyAmount = $this->request->getPost('warrantyAmount') ?: 0;
$leaseAmount = $this->request->getPost('leaseAmount') ?: 0;
$preSaleAmount = $this->request->getPost('preSaleAmount') ?: 0;
$premiumAmount = $this->request->getPost('premiumAmount') ?: 0;
$preSaleOptionAmount = $this->request->getPost('preSaleOptionAmount') ?: 0;
if (empty($rcpt_sq) || empty($rcpt_key) || empty($trade_type)) {
return $this->response->setJSON([
'code' => '1',
'msg' => '필수 파라미터가 누락되었습니다.'
]);
}
$params = [
'rcpt_sq' => $rcpt_sq,
'rcpt_key' => $rcpt_key,
'rcpt_no' => $rcpt_no,
$receipt = $this->model->getDetail($rcpt_key);
if (empty($receipt)) {
return $this->response->setJSON([
'code' => '1',
'msg' => '매물 정보를 찾을 수 없습니다.'
]);
}
// 거래유형에 따른 가격 정보 제한
$limitCheck = limitHscpMarketPriceInfo($trade_type, $rcpt_hscp_no, $rcpt_ptp_no, $rcpt_product_info2);
if (!empty($limitCheck)) {
return $this->response->setJSON([
'code' => '1',
'msg' => $limitCheck['message'] ?? '가격 범위를 벗어났습니다.'
]);
}
$data = [
'trade_type' => $trade_type,
'rcpt_product_info2' => $rcpt_product_info2,
'rcpt_product_info3' => $rcpt_product_info3,
'rcpt_product_info4' => $rcpt_product_info4,
'rcpt_product_info5' => $rcpt_product_info5,
'rcpt_product_info6' => $rcpt_product_info6,
'rcpt_ptp_no' => $rcpt_ptp_no,
'rcpt_hscp_no' => $rcpt_hscp_no,
'dealAmount' => $dealAmount,
'warrantyAmount' => $warrantyAmount,
'leaseAmount' => $leaseAmount,
'preSaleAmount' => $preSaleAmount,
'premiumAmount' => $premiumAmount,
'preSaleOptionAmount' => $preSaleOptionAmount,
];
$result = $this->model->modifyPriceInfo($params);
if (!$result['success']) {
$updated = $this->entityModel->update($rcpt_sq, $data);
if (!$updated) {
$errors = $this->entityModel->errors();
log_message('error', 'Failed to update modifyPriceInfo info for rcpt_sq: ' . $rcpt_sq . '. Errors: ' . json_encode($errors));
return $this->response->setJSON([
'code' => '1',
'msg' => $result['msg'] ?? '가격 정보 수정 실패'
'msg' => !empty($errors) ? implode(', ', $errors) : '가격 정보 수정 실패'
]);
}
$affectedRows = $this->entityModel->db->affectedRows();
$isChanged = ($affectedRows > 0);
if (!$isChanged) {
return $this->response->setJSON([
'code' => '0',
'changed' => false,
'msg' => '변경사항이 없습니다.'
]);
}
log_message('info', 'Price info updated for rcpt_sq: ' . $rcpt_sq . '. Affected rows: ' . $affectedRows);
$changed = what_is_changed($receipt, $data);
log_message('info', 'what_is_changed result for rcpt_sq: ' . $rcpt_sq . '. Changes: ' . $changed);
if (!empty($changed)) {
$this->changedHistoryEntity->addHistory(
$rcpt_sq,
$receipt['result_cd3'] ?? '',
'C25',
session('usr_id'),
$changed
);
}
$usr_id = session('usr_id');
$atcl_no = $receipt['rcpt_atclno'] ?? null;
if (!empty($atcl_no)) {
$params = [
'dealAmount' => $dealAmount,
'warrantyAmount' => $warrantyAmount,
'leaseAmount' => $leaseAmount,
];
if (in_array($receipt['rcpt_product'] ?? '', ['B01', 'B02', 'B03'], true)) {
$params['preSaleAmount'] = $preSaleAmount;
$params['premiumAmount'] = $premiumAmount;
$params['preSaleOptionAmount'] = $preSaleOptionAmount;
}
$priceInfo = $this->naverApiClient->postArticlePriceUpdate($atcl_no, $params, $usr_id);
log_message('info', 'postArticlePriceUpdate response for atcl_no: ' . $atcl_no . '. Response: ' . json_encode($priceInfo));
}
return $this->response->setJSON([
'code' => '0',
'changed' => true,
'msg' => '가격 정보가 수정되었습니다.'
]);
} catch (\Exception $e) {
log_message('error', 'modifyPriceInfo error: ' . $e->getMessage());
return $this->response->setJSON([

View File

@@ -4,16 +4,19 @@ namespace App\Controllers\Common;
use App\Controllers\BaseController;
use App\Models\common\CommonModel;
use App\Models\manage\UserModel;
use App\Libraries\NaverApiClient;
class Common extends BaseController
{
private $model;
private $userModel;
private $naverApiClient;
public function __construct()
{
$this->model = new CommonModel();
$this->userModel = new UserModel();
$this->naverApiClient = new NaverApiClient();
}
public function getVrfcCode()
@@ -118,4 +121,54 @@ class Common extends BaseController
]);
}
}
// 단지 조회
public function getComplexList()
{
$legalDivisionNumber = $this->request->getGet("legalDivisionNumber");
$realEstateType = $this->request->getGet("realEstateType") ?? null;
try {
$complexList = $this->naverApiClient->getComplexList($legalDivisionNumber , $realEstateType);
return $this->response->setJSON($complexList);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
/**
* 평형 조회
*
* complexNumber : 단지 번호
* realEstateType : 매물 종류 (APT, OFFICETEL, VILLA 등)
*/
public function getPyeongInfo()
{
$complexNumber = $this->request->getGet("complexNumber");
$realEstateType = $this->request->getGet("realEstateType");
try {
if ( $realEstateType == 'A01' || $realEstateType == 'A02' || $realEstateType == 'A03' ) {
$pyeongInfo = $this->naverApiClient->getPyeongTypeList($complexNumber);
} else if ( $realEstateType == 'A05' || $realEstateType == 'A06' ) {
$pyeongInfo = $this->naverApiClient->getVillaPyeongTypeList($complexNumber);
} else {
return $this->response->setJSON([
'code' => '9',
'msg' => '지원하지 않는 매물 종류입니다.',
]);
}
return $this->response->setJSON($pyeongInfo);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
}

View File

@@ -18,6 +18,7 @@ class M710 extends BaseController
public function lists(): string
{
$codes = $this->codeModel->getCodeLists(['STEP_VERIFICATION', 'VRFCREQ_WAY', 'CP_ID', 'ARTICLE_TYPE']); // 코드조회
$sido = $this->model->getAreaList(); // 지역조회
$bonbu = $this->model->getBonbuList();
$team = $this->model->getTeamList();

View File

@@ -14,34 +14,26 @@ if (!function_exists('limitHscpMarketPriceInfo')) {
if (!empty($hscp_no) && !empty($ptp_no)) {
$naver = new \App\Libraries\NaverApiClient();
$hscpMarketPriceInfo = $naver->hscpMarketPriceInfo($hscp_no, $ptp_no);
$hscpMarketPriceInfo = $naver->getComplexPriceByUnitType((int)$hscp_no, (int)$ptp_no);
if (isset($hscpMarketPriceInfo['error'])) { //결과값 확인
if ($hscpMarketPriceInfo['error']['code'] == 'VC027') {
$return = array();
} else {
$return = $hscpMarketPriceInfo['error'];
}
if (isset($hscpMarketPriceInfo['error']) && $hscpMarketPriceInfo['error']) { //결과값 확인
log_message('error', '네이버 시세 API 호출 실패: ' . json_encode($hscpMarketPriceInfo));
return array();
} else {
$limitH = 0;
$limitL = 0;
$sise = array();
$sise = $hscpMarketPriceInfo['data'];
// 상한가, 하한가 체크 ( 상한가 * 2, 하한가 * 0.7) 이내의 범위에 가격이 있어야 함.
if ($trade_type == 'A1') {
// 매매
if (isset($hscpMarketPriceInfo['result']['deal_uplmt_prc'])) {
$limitH = $hscpMarketPriceInfo['result']['deal_uplmt_prc'];
}
if (isset($hscpMarketPriceInfo['result']['deal_lwlmt_prc'])) {
$limitL = $hscpMarketPriceInfo['result']['deal_lwlmt_prc'];
}
$limitH = $sise['dealCeilingPrice'] ?? 0;
$limitL = $sise['dealFloorPrice'] ?? 0;
} elseif ($trade_type == 'B1') {
// 전세
if (isset($hscpMarketPriceInfo['result']['lease_uplmt_prc'])) {
$limitH = $hscpMarketPriceInfo['result']['lease_uplmt_prc'];
}
if (isset($hscpMarketPriceInfo['result']['lease_lwlmt_prc'])) {
$limitL = $hscpMarketPriceInfo['result']['lease_lwlmt_prc'];
}
$limitH = $sise['leaseCeilingPrice'] ?? 0;
$limitL = $sise['leaseFloorPrice'] ?? 0;
}
if (!empty($limitH)) {
@@ -317,3 +309,146 @@ function getOwnerTypeCodeNo($code)
break;
}
}
/**
* 무엇이 변경되었는지 확인한다.
* $table(DB의 원래 데이터), data (변경된 내용) ==> array
*/
function what_is_changed($table, $data){
$return = '';
if (empty($table) || empty($data)){
log_message('warning', 'what_is_changed 함수에 빈 데이터 전달 | table: ' . json_encode($table) . ', data: ' . json_encode($data));
return $return;
}
foreach ( $data as $key => $value ) {
if (!array_key_exists($key, $table)) {
$table[$key] = '';
}
if (strcmp(trim((string) $table[$key]), trim((string) $value)) != 0){
switch ( $key ) {
case 'trade_type': // 거래구분
$return .= ', 거래구분 : ';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_product_info2': // 매매, 전세, 월세보증금
$return .= ', 거래가 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_product_info3': // 월세
$return .= ', 월세 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_dtl_addr': // 상세주소
$return .= ', 상세주소 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_li_addr': //리 주소
$return .= ', 리 주소 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_jibun_addr': //지번 주소
$return .= ', 지번 주소 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_etc_addr': //기타 주소
$return .= ', 기타 주소 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_ref_addr': // 상세주소
$return .= ', 기타주소2 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_ho': // 기타주소
$return .= ', 기타주소 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_hscp_no': // 단지
$return .= ', 단지번호 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_ptp_no': // 평형
$return .= ', 평형 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'rcpt_floor': // 층
$return .= ', 층 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'exp_spc_yn': // 층
$return .= ', 면적확인여부 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'excls_spc1': // 층
$return .= ', 전용면적 첫번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'excls_spc2': // 층
$return .= ', 전용면적 두번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'room_cnt': // 층
$return .= ', 방개수 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'sply_spc': // 층
$return .= ', 공급면적 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'share_spc': // 층
$return .= ', 공용면적 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'tot_spc': // 층
$return .= ', 연면적 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'tot_spc1': // 층
$return .= ', 연면적 첫번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'tot_spc2': // 층
$return .= ', 연면적 두번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'grnd_spc1': // 층
$return .= ', 대지면적 첫번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'grnd_spc2': // 층
$return .= ', 대지면적 두번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'grnd_spc3': // 층
$return .= ', 대지면적 세번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'grnd_spc4': // 층
$return .= ', 대지면적 네번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'grnd_spc5': // 층
$return .= ', 대지면적 다섯번째 값 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'spc_stat': // 층
$return .= ', 면적구분 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
case 'request_msg': // 층
$return .= ', 메모변경 :';
$return .= $table[$key] . ' => ' . $value . "\n";
break;
// case 'rcpt_x': // 좌표 x 12x.xxxxx (경도: longitude)
// $return .= '거래구분 :';
// break;
// case 'rcpt_y': // 좌표 y 3x.xxxx (위도: latitude)
// $return .= '거래구분 :';
// break;
}
}
}
return trim(substr($return, 1));
}

View File

@@ -131,7 +131,7 @@ class NaverApiClient
$this->charger = $charger;
$url = "{$this->baseUrl}/kiso/center/verification-article/price/{$articleNumber}?charger={$this->charger}";
return $this->request('POST', $url, $priceData);
return $this->request('PATCH', $url, $priceData);
}
/**
@@ -176,21 +176,85 @@ class NaverApiClient
/**
* 특정 단지/평형 시세조회()
* @param string hscpNo 단지번호
* @param string ptpNo 평형번호
* @param Long hscpNo 단지번호
* @param int ptpNo 평형번호
* API: GET /confirms/hscpMarketPriceInfo.nhn?hscpNo={단지번호}&ptpNo={평형번호}
*/
public function hscpMarketPriceInfo($hscpNo, $ptpNo){
$url = '/confirms/hscpMarketPriceInfo.nhn';
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . $url;
$data = [
'hscpNo' => $hscpNo,
'ptpNo' => $ptpNo
];
// public function hscpMarketPriceInfo($hscpNo, $ptpNo){
// $url = '/confirms/hscpMarketPriceInfo.nhn';
// $url = $this->commonModel->getCompanyInfo(3);
// $url = $url['api_server'] . $url;
// $data = [
// 'hscpNo' => $hscpNo,
// 'ptpNo' => $ptpNo
// ];
return $this->request('GET', $url, $data);
}
// return $this->request('GET', $url, $data);
// }
public function getComplexPriceByUnitType(int $hscpNo, int $ptpNo): ?array
{
$url = $this->baseUrl . "/kiso/marketprice/complex/{$hscpNo}/pyeong-type/{$ptpNo}";
return $this->request('GET', $url);
}
/**
* 법정동 기준 단지 목록 조회
* API: GET /kiso/complex/legal-division/{법정동코드}
* legalDivisionNumber : 법정동 코드
*/
public function getComplexList($legalDivisionNumber, $realEstateType = null)
{
$url = $this->baseUrl . "/kiso/complex/legal-division/{$legalDivisionNumber}";
if ($realEstateType !== null) {
$url .= "?realEstateType={$realEstateType}";
}
return $this->request('GET', $url);
}
/**
* 단지평형목록 조회(아파트/오피스텔)
*/
public function getPyeongTypeList($complexNumber){
$url = $this->baseUrl . "/kiso/complex/{$complexNumber}/pyeongs";
return $this->request('GET', $url);
}
/**
* 빌라 단지 평형 목록 조회
*/
public function getVillaPyeongTypeList($complexNumber){
$url = $this->baseUrl . "/kiso/complex/villa/{$complexNumber}/pyeongs";
return $this->request('GET', $url);
}
/**
* 단지 상세 조회
*/
public function getComplexDetail($complexNumber){
$url = $this->baseUrl . "/kiso/complex/{$complexNumber}";
return $this->request('GET', $url);
}
/**
* 빌라 단지 상세 조회
*/
public function getVillaComplexDetail($complexNumber){
$url = $this->baseUrl . "/kiso/complex/villa/{$complexNumber}";
return $this->request('GET', $url);
}
/**
* 빌라 단지 동호수 조회
*/
public function getVillaBuildingList($complexNumber){
$url = $this->baseUrl . "/kiso/complex/villa/{$complexNumber}/buildings";
return $this->request('GET', $url);
}
/**
* 현장확인 동기화 결과 전송
* API: GET /site/submitSyncResult.nhn?reserveNoList={예약번호리스트}
* @param string reserveNoList 예약번호 리스트 (쉼표로 구분된 문자열, 예: "12345,67890,54321")
*/
public function submitSyncResult(string $reserveNoList): ?array

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Models\Entities;
use CodeIgniter\Model;
class ChangedHistoryModel extends Model
{
protected $table = 'changed_history';
protected $primaryKey = 'seq';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $protectFields = true;
protected $allowedFields = [
'rcpt_sq',
'rcpt_stat',
'changed_type',
'changed_id',
'changed_tm',
'remark',
];
/**
* 정보변경 이력 1건 저장
*/
public function addHistory(
int $rcptSq,
?string $rcptStat,
?string $changedType,
?string $changedId,
?string $remark,
?string $changedTm = null
): bool {
$data = [
'rcpt_sq' => $rcptSq,
'rcpt_stat' => $rcptStat,
'changed_type' => $changedType,
'changed_id' => $changedId,
'changed_tm' => $changedTm ?? date('Y-m-d H:i:s'),
'remark' => $remark,
];
return $this->insert($data) !== false;
}
}

View File

@@ -13,7 +13,10 @@ class ReceiptModel extends Model
protected $allowedFields = [
'comp_sq', 'rcpt_rating', 'rcpt_key', 'rcpt_atclno', 'rcpt_type',
'rcpt_product', 'rcpt_product_nm', 'rcpt_product_info1', 'rcpt_product_info2',
'rcpt_product_info3', 'rcpt_office', 'rcpt_agent', 'rcpt_sido', 'rcpt_hscp_nm',
'rcpt_product_info3', 'rcpt_product_info4', 'rcpt_product_info5', 'rcpt_product_info6',
'trade_type', 'rcpt_ptp_no', 'rcpt_hscp_no',
'dealAmount', 'warrantyAmount', 'leaseAmount', 'preSaleAmount', 'premiumAmount', 'preSaleOptionAmount',
'rcpt_office', 'rcpt_agent', 'rcpt_sido', 'rcpt_hscp_nm',
'rcpt_dtl_addr', 'rcpt_etc_addr', 'rcpt_floor', 'rcpt_floor2', 'rcpt_tm',
'rcpt_stat', 'rcpt_x', 'rcpt_y', 'agent_nm', 'agent_head_tel', 'rsrv_date',
'insert_tm', 'rcpt_cpid', 'room_cnt', 'isSiteVRVerification'
@@ -104,4 +107,5 @@ class ReceiptModel extends Model
'total' => $totalCount
];
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Models\article;
use App\Models\common\CodeModel;
use App\Models\Entities\ChangedHistoryModel;
use CodeIgniter\Model;
class ReceiptModel extends Model
@@ -205,209 +206,8 @@ class ReceiptModel extends Model
$builder->join('receipt_transimage_log l', 'a.rcpt_key = l.rcpt_key', 'left');
$login_dept_info = $this->getDeptDetail($dept_sq); // 로그인 사용자 소속부서정보
$child_dept = []; // 하위조직 목록
if (strcmp($usr_level, '40') == 0) {
$child = $this->getChildDept($login_dept_info);
if (!empty($child)) {
foreach ($child as $child) {
$child_dept[] = $child['dept_sq'];
}
}
}
if ((int) $usr_level >= 4 && $usr_level != '45') {
if (!empty($child_dept)) {
$builder->whereIn('b.dept_sq', $child_dept);
} else {
$builder->where('b.usr_sq', $usr_sq);
}
}
$builder->where('a.rcpt_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH)', null, false);
$builder->where('b.use_yn', 'Y');
if (!empty($data['rcpt_atclno'])) {
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
} else {
if ($data['schDateGb'] == '2') {
$builder->where('a.rcpt_tm >=', $data['sdate'] . ' 00:00:00');
$builder->where('a.rcpt_tm <=', $data['edate'] . ' 23:59:59');
} else {
$builder->where('b.rsrv_date >=', $data['sdate'] . ' 00:00:00');
$builder->where('b.rsrv_date <=', $data['edate'] . ' 23:59:59');
}
// 지역
if (!empty($data['dong'])) {
$builder->where('a.rcpt_dong', $data['dong']);
} else {
if (!empty($data['gugun'])) {
$builder->like('a.rcpt_gugun', substr($data['gugun'], 0, 5), 'after');
} else {
if (!empty($data['sido'])) {
$builder->like('a.rcpt_gugun', substr($data['sido'], 0, 2), 'after');
}
}
}
// 관할조직
if (!empty($data['bonbu'])) {
$builder->where('d.pdept_sq', $data['bonbu']);
}
if (!empty($data['team'])) {
$builder->where('d.dept_sq', $data['team']);
}
if (!empty($data['user'])) {
$builder->where('d.usr_sq', $data['user']);
}
// 거래구분
if (!empty($data['rcpt_product_info1'])) {
$builder->where('a.rcpt_product_info1', $data['rcpt_product_info1']);
}
// 현재상태
if (!empty($data['rcpt_stat1'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat1'], 'after');
}
if (!empty($data['rcpt_stat2'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat2'], 'after');
}
if (!empty($data['rcpt_stat3'])) {
$builder->where('a.rcpt_stat', $data['rcpt_stat3']);
}
// 중개사명
if (!empty($data['agent_nm'])) {
$builder->like('a.agent_nm', $data['agent_nm'], 'both');
}
// 동영상촬영여부
if (!empty($data['exp_movie_yn'])) {
$builder->where('a.exp_movie_yn', $data['exp_movie_yn']);
}
// 홍보확인서여부
if ($data['conf_img_yn'] == 'Y') {
$builder->where('e.rsrv_sq IS NOT NULL', null, false);
} else if ($data['conf_img_yn'] == 'N') {
$builder->where('e.rsrv_sq IS NULL', null, false);
}
// 분양권
if ($data['parcel_out_yn'] == 'Y') {
$builder->where('a.parcel_out_yn', 'Y');
} else if ($data['parcel_out_yn'] == 'N') {
$builder->where('a.parcel_out_yn', 'N');
}
// CP ID
if (!empty($data['rcpt_cpid'])) {
if (strcmp($data['rcpt_cpid'], 'naver') == 0) {
$builder->where('a.rcpt_cpid =', '');
} else if (strcmp($data['rcpt_cpid'], 'cleancente') == 0) {
$builder->where("a.rcpt_cpid !=", "");
} else {
$builder->where('a.rcpt_cpid', $data['rcpt_cpid']);
}
}
// 매물종류
if (!empty($data['rcpt_product'])) {
$builder->where('a.parcel_out_yn', $data['rcpt_product']);
}
// 면적확인
if ($data['exp_spc_yn'] == 'Y') {
$builder->where('a.parcel_out_yn', 'Y');
} else if ($data['exp_spc_yn'] == 'N') {
$builder->where('a.parcel_out_yn', 'N');
}
// 체크리스트
if ($data['check_list_img_yn'] == 'Y') {
$builder->where('a.check_list_img_yn', 'Y');
} else if ($data['check_list_img_yn'] == 'N') {
$builder->where('a.check_list_img_yn', 'N');
}
// 평면도유무
if ($data['ground_plan_yn'] == 'Y') {
$builder->where('exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
} else if ($data['ground_plan_yn'] == 'N') {
$builder->where('not exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
}
// 평면도요청
if (!empty($data['ground_plan'])) {
$builder->where('a.ground_plan', $data['ground_plan']);
}
// 직거래
if ($data['direct_trad_yn'] == "Y") {
$builder->where('a.direct_trad_yn', 'Y');
} else if ($data['direct_trad_yn'] == "N") {
$builder->where('a.direct_trad_yn', 'N');
}
// 360촬영여부
if ($data['image_360_yn'] == "Y") {
$builder->where('a.image_360_yn', 'Y');
} else if ($data['image_360_yn'] == "N") {
$builder->where('a.image_360_yn', 'N');
}
// 검증방식
if (!empty($data['isSiteVRVerification'])) {
$builder->where('a.isSiteVRVerification', $data['isSiteVRVerification']);
}
// 프로모션
if (!empty($data['isPromotionApply'])) {
$builder->where('a.isPromotionApply', $data['isPromotionApply']);
}
if (!empty($data['srchTxt'])) {
// 중개사
if ($data['srchType'] == '1') {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
// 주소
} else if ($data['srchType'] == '2') {
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
// 사업자번호
} else if ($data['srchType'] == '3') {
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
} else {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
}
}
}
$this->applyListUserScope($builder, $usr_level, $usr_sq, $dept_sq);
$this->applyListSearchFilters($builder, $data);
$row = $builder->get()->getRowArray();
// log_message('debug', '[getTotalCount] SQL = ' . $this->db->getLastQuery());
@@ -542,9 +342,28 @@ class ReceiptModel extends Model
$builder->join('result_imgs e', "e.rsrv_sq = b.rsrv_sq AND e.img_type = 'I1' AND e.use_yn = 'Y'", 'left outer');
$builder->join('receipt_transimage_log l', 'a.rcpt_key = l.rcpt_key', 'left outer');
$this->applyListUserScope($builder, $usr_level, $usr_sq, $dept_sq);
$this->applyListSearchFilters($builder, $data);
$builder->orderBy('a.rcpt_atclno', 'DESC');
$builder->limit($end, $start);
$result = $builder->get()->getResultArray();
// log_message('debug', '[getResultList] SQL = ' . $this->db->getLastQuery());
// log_message('info', '[getResultList] Result count = ' . count($result));
return $result;
}
private function applyListUserScope($builder, $usr_level, $usr_sq, $dept_sq): void
{
$login_dept_info = $this->getDeptDetail($dept_sq);
$child_dept = [];
$login_dept_info = $this->getDeptDetail($dept_sq); // 로그인 사용자 소속부서정보
$child_dept = []; // 하위조직 목록
if (strcmp($usr_level, '40') == 0) {
$child = $this->getChildDept($login_dept_info);
if (!empty($child)) {
@@ -561,204 +380,167 @@ class ReceiptModel extends Model
$builder->where('b.usr_sq', $usr_sq);
}
}
}
private function applyListSearchFilters($builder, $data): void
{
$builder->where('a.rcpt_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH)', null, false);
$builder->where('b.use_yn', 'Y');
if (!empty($data['rcpt_atclno'])) {
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
} else {
if ($data['schDateGb'] == '2') {
$builder->where('a.rcpt_tm >=', $data['sdate'] . ' 00:00:00');
$builder->where('a.rcpt_tm <=', $data['edate'] . ' 23:59:59');
} else {
$builder->where('b.rsrv_date >=', $data['sdate'] );
$builder->where('b.rsrv_date <=', $data['edate'] );
}
// 지역
if (!empty($data['dong'])) {
$builder->where('a.rcpt_dong', $data['dong']);
} else {
if (!empty($data['gugun'])) {
$builder->like('a.rcpt_gugun', substr($data['gugun'], 0, 5), 'after');
} else {
if (!empty($data['sido'])) {
$builder->like('a.rcpt_gugun', substr($data['sido'], 0, 2), 'after');
}
}
}
// 관할조직
if (!empty($data['bonbu'])) {
$builder->where('d.pdept_sq', $data['bonbu']);
}
if (!empty($data['team'])) {
$builder->where('d.dept_sq', $data['team']);
}
if (!empty($data['user'])) {
$builder->where('d.usr_sq', $data['user']);
}
// 거래구분
if (!empty($data['rcpt_product_info1'])) {
$builder->where('a.rcpt_product_info1', $data['rcpt_product_info1']);
}
// 현재상태
if (!empty($data['rcpt_stat1'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat1'], 'after');
}
if (!empty($data['rcpt_stat2'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat2'], 'after');
}
if (!empty($data['rcpt_stat3'])) {
$builder->where('a.rcpt_stat', $data['rcpt_stat3']);
}
// 중개사명
if (!empty($data['agent_nm'])) {
$builder->like('a.agent_nm', $data['agent_nm'], 'both');
}
// 동영상촬영여부
if (!empty($data['exp_movie_yn'])) {
$builder->where('a.exp_movie_yn', $data['exp_movie_yn']);
}
// 홍보확인서여부
if ($data['conf_img_yn'] == 'Y') {
$builder->where('e.rsrv_sq IS NOT NULL', null, false);
} else if ($data['conf_img_yn'] == 'N') {
$builder->where('e.rsrv_sq IS NULL', null, false);
}
// 분양권
if ($data['parcel_out_yn'] == 'Y') {
$builder->where('a.parcel_out_yn', 'Y');
} else if ($data['parcel_out_yn'] == 'N') {
$builder->where('a.parcel_out_yn', 'N');
}
// CP ID
if (!empty($data['rcpt_cpid'])) {
if (strcmp($data['rcpt_cpid'], 'naver') == 0) {
$builder->where('a.rcpt_cpid =', '');
} else if (strcmp($data['rcpt_cpid'], 'cleancente') == 0) {
$builder->where("a.rcpt_cpid !=", "");
} else {
$builder->where('a.rcpt_cpid', $data['rcpt_cpid']);
}
}
// 매물종류
if (!empty($data['rcpt_product'])) {
$builder->where('a.parcel_out_yn', $data['rcpt_product']);
}
// 면적확인
if ($data['exp_spc_yn'] == 'Y') {
$builder->where('a.parcel_out_yn', 'Y');
} else if ($data['exp_spc_yn'] == 'N') {
$builder->where('a.parcel_out_yn', 'N');
}
// 체크리스트
if ($data['check_list_img_yn'] == 'Y') {
$builder->where('a.check_list_img_yn', 'Y');
} else if ($data['check_list_img_yn'] == 'N') {
$builder->where('a.check_list_img_yn', 'N');
}
// 평면도유무
if ($data['ground_plan_yn'] == 'Y') {
$builder->where('exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
} else if ($data['ground_plan_yn'] == 'N') {
$builder->where('not exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
}
// 평면도요청
if (!empty($data['ground_plan'])) {
$builder->where('a.ground_plan', $data['ground_plan']);
}
// 직거래
if ($data['direct_trad_yn'] == "Y") {
$builder->where('a.direct_trad_yn', 'Y');
} else if ($data['direct_trad_yn'] == "N") {
$builder->where('a.direct_trad_yn', 'N');
}
// 360촬영여부
if ($data['image_360_yn'] == "Y") {
$builder->where('a.image_360_yn', 'Y');
} else if ($data['image_360_yn'] == "N") {
$builder->where('a.image_360_yn', 'N');
}
// 검증방식
if (!empty($data['isSiteVRVerification'])) {
$builder->where('a.isSiteVRVerification', $data['isSiteVRVerification']);
}
// 프로모션
if (!empty($data['isPromotionApply'])) {
$builder->where('a.isPromotionApply', $data['isPromotionApply']);
}
if (!empty($data['srchTxt'])) {
// 중개사
if ($data['srchType'] == '1') {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
// 주소
} else if ($data['srchType'] == '2') {
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
// 사업자번호
} else if ($data['srchType'] == '3') {
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
} else {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
}
}
return;
}
if ($data['schDateGb'] == '2') {
$builder->where('a.rcpt_tm >=', $data['sdate'] . ' 00:00:00');
$builder->where('a.rcpt_tm <=', $data['edate'] . ' 23:59:59');
} else {
$builder->where('b.rsrv_date >=', $data['sdate']);
$builder->where('b.rsrv_date <=', $data['edate']);
}
$builder->orderBy('a.rcpt_atclno', 'DESC');
if (!empty($data['dong'])) {
$builder->where('a.rcpt_dong', $data['dong']);
} else if (!empty($data['gugun'])) {
$builder->like('a.rcpt_gugun', substr($data['gugun'], 0, 5), 'after');
} else if (!empty($data['sido'])) {
$builder->like('a.rcpt_gugun', substr($data['sido'], 0, 2), 'after');
}
$builder->limit($end, $start);
if (!empty($data['bonbu'])) {
$builder->where('d.pdept_sq', $data['bonbu']);
}
$result = $builder->get()->getResultArray();
// log_message('debug', '[getResultList] SQL = ' . $this->db->getLastQuery());
// log_message('info', '[getResultList] Result count = ' . count($result));
if (!empty($data['team'])) {
$builder->where('d.dept_sq', $data['team']);
}
return $result;
if (!empty($data['user'])) {
$builder->where('d.usr_sq', $data['user']);
}
if (!empty($data['rcpt_product_info1'])) {
$builder->where('a.rcpt_product_info1', $data['rcpt_product_info1']);
}
if (!empty($data['rcpt_stat1'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat1'], 'after');
}
if (!empty($data['rcpt_stat2'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat2'], 'after');
}
if (!empty($data['rcpt_stat3'])) {
$builder->where('a.rcpt_stat', $data['rcpt_stat3']);
}
if (!empty($data['agent_nm'])) {
$builder->like('a.agent_nm', $data['agent_nm'], 'both');
}
if (!empty($data['exp_movie_yn'])) {
$builder->where('a.exp_movie_yn', $data['exp_movie_yn']);
}
if ($data['conf_img_yn'] == 'Y') {
$builder->where('e.rsrv_sq IS NOT NULL', null, false);
} else if ($data['conf_img_yn'] == 'N') {
$builder->where('e.rsrv_sq IS NULL', null, false);
}
if ($data['parcel_out_yn'] == 'Y') {
$builder->where('a.parcel_out_yn', 'Y');
} else if ($data['parcel_out_yn'] == 'N') {
$builder->where('a.parcel_out_yn', 'N');
}
if (!empty($data['rcpt_cpid'])) {
if (strcmp($data['rcpt_cpid'], 'naver') == 0) {
$builder->where('a.rcpt_cpid =', '');
} else if (strcmp($data['rcpt_cpid'], 'cleancente') == 0) {
$builder->where('a.rcpt_cpid !=', '');
} else {
$builder->where('a.rcpt_cpid', $data['rcpt_cpid']);
}
}
if (!empty($data['rcpt_product'])) {
$builder->where('a.rcpt_product', $data['rcpt_product']);
}
if ($data['exp_spc_yn'] == 'Y') {
$builder->where('a.exp_spc_yn', 'Y');
} else if ($data['exp_spc_yn'] == 'N') {
$builder->where('a.exp_spc_yn', 'N');
}
if ($data['check_list_img_yn'] == 'Y') {
$builder->where('a.check_list_img_yn', 'Y');
} else if ($data['check_list_img_yn'] == 'N') {
$builder->where('a.check_list_img_yn', 'N');
}
if ($data['ground_plan_yn'] == 'Y') {
$builder->where('exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', null, false);
} else if ($data['ground_plan_yn'] == 'N') {
$builder->where('not exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', null, false);
}
if (!empty($data['ground_plan'])) {
$builder->where('a.ground_plan', $data['ground_plan']);
}
if ($data['direct_trad_yn'] == 'Y') {
$builder->where('a.direct_trad_yn', 'Y');
} else if ($data['direct_trad_yn'] == 'N') {
$builder->where('a.direct_trad_yn', 'N');
}
if ($data['image_360_yn'] == 'Y') {
$builder->where('a.image_360_yn', 'Y');
} else if ($data['image_360_yn'] == 'N') {
$builder->where('a.image_360_yn', 'N');
}
if (!empty($data['isSiteVRVerification'])) {
$builder->where('a.isSiteVRVerification', $data['isSiteVRVerification']);
}
if (!empty($data['isPromotionApply'])) {
$builder->where('a.isPromotionApply', $data['isPromotionApply']);
}
if (!empty($data['srchTxt'])) {
if ($data['srchType'] == '1') {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
} else if ($data['srchType'] == '2') {
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
} else if ($data['srchType'] == '3') {
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
} else {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
}
}
}
@@ -833,209 +615,8 @@ class ReceiptModel extends Model
$builder->join('receipt_transimage_log l', 'a.rcpt_key = l.rcpt_key', 'left');
$login_dept_info = $this->getDeptDetail($dept_sq); // 로그인 사용자 소속부서정보
$child_dept = []; // 하위조직 목록
if (strcmp($usr_level, '40') == 0) {
$child = $this->getChildDept($login_dept_info);
if (!empty($child)) {
foreach ($child as $child) {
$child_dept[] = $child['dept_sq'];
}
}
}
if ((int) $usr_level >= 4 && $usr_level != '45') {
if (!empty($child_dept)) {
$builder->whereIn('b.dept_sq', $child_dept);
} else {
$builder->where('b.usr_sq', $usr_sq);
}
}
$builder->where('a.rcpt_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH)', null, false);
$builder->where('b.use_yn', 'Y');
if (!empty($data['rcpt_atclno'])) {
$builder->where('a.rcpt_atclno', $data['rcpt_atclno']);
} else {
if ($data['schDateGb'] == '2') {
$builder->where('a.rcpt_tm >=', $data['sdate'] . ' 00:00:00');
$builder->where('a.rcpt_tm <=', $data['edate'] . ' 23:59:59');
} else {
$builder->where('b.rsrv_date >=', $data['sdate'] . ' 00:00:00');
$builder->where('b.rsrv_date <=', $data['edate'] . ' 23:59:59');
}
// 지역
if (!empty($data['dong'])) {
$builder->where('a.rcpt_dong', $data['dong']);
} else {
if (!empty($data['gugun'])) {
$builder->like('a.rcpt_gugun', substr($data['gugun'], 0, 5), 'after');
} else {
if (!empty($data['sido'])) {
$builder->like('a.rcpt_gugun', substr($data['sido'], 0, 2), 'after');
}
}
}
// 관할조직
if (!empty($data['bonbu'])) {
$builder->where('d.pdept_sq', $data['bonbu']);
}
if (!empty($data['team'])) {
$builder->where('d.dept_sq', $data['team']);
}
if (!empty($data['user'])) {
$builder->where('d.usr_sq', $data['user']);
}
// 거래구분
if (!empty($data['rcpt_product_info1'])) {
$builder->where('a.rcpt_product_info1', $data['rcpt_product_info1']);
}
// 현재상태
if (!empty($data['rcpt_stat1'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat1'], 'after');
}
if (!empty($data['rcpt_stat2'])) {
$builder->like('a.rcpt_stat', $data['rcpt_stat2'], 'after');
}
if (!empty($data['rcpt_stat3'])) {
$builder->where('a.rcpt_stat', $data['rcpt_stat3']);
}
// 중개사명
if (!empty($data['agent_nm'])) {
$builder->like('a.agent_nm', $data['agent_nm'], 'both');
}
// 동영상촬영여부
if (!empty($data['exp_movie_yn'])) {
$builder->where('a.exp_movie_yn', $data['exp_movie_yn']);
}
// 홍보확인서여부
if ($data['conf_img_yn'] == 'Y') {
$builder->where('e.rsrv_sq IS NOT NULL', null, false);
} else if ($data['conf_img_yn'] == 'N') {
$builder->where('e.rsrv_sq IS NULL', null, false);
}
// 분양권
if ($data['parcel_out_yn'] == 'Y') {
$builder->where('a.parcel_out_yn', 'Y');
} else if ($data['parcel_out_yn'] == 'N') {
$builder->where('a.parcel_out_yn', 'N');
}
// CP ID
if (!empty($data['rcpt_cpid'])) {
if (strcmp($data['rcpt_cpid'], 'naver') == 0) {
$builder->where('a.rcpt_cpid =', '');
} else if (strcmp($data['rcpt_cpid'], 'cleancente') == 0) {
$builder->where("a.rcpt_cpid !=", "");
} else {
$builder->where('a.rcpt_cpid', $data['rcpt_cpid']);
}
}
// 매물종류
if (!empty($data['rcpt_product'])) {
$builder->where('a.parcel_out_yn', $data['rcpt_product']);
}
// 면적확인
if ($data['exp_spc_yn'] == 'Y') {
$builder->where('a.parcel_out_yn', 'Y');
} else if ($data['exp_spc_yn'] == 'N') {
$builder->where('a.parcel_out_yn', 'N');
}
// 체크리스트
if ($data['check_list_img_yn'] == 'Y') {
$builder->where('a.check_list_img_yn', 'Y');
} else if ($data['check_list_img_yn'] == 'N') {
$builder->where('a.check_list_img_yn', 'N');
}
// 평면도유무
if ($data['ground_plan_yn'] == 'Y') {
$builder->where('exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
} else if ($data['ground_plan_yn'] == 'N') {
$builder->where('not exists (select \'x\' from result_imgs imgs where imgs.rsrv_sq = b.rsrv_sq and imgs.img_type = \'I5\' and imgs.use_yn=\'Y\')', NULL, FALSE);
}
// 평면도요청
if (!empty($data['ground_plan'])) {
$builder->where('a.ground_plan', $data['ground_plan']);
}
// 직거래
if ($data['direct_trad_yn'] == "Y") {
$builder->where('a.direct_trad_yn', 'Y');
} else if ($data['direct_trad_yn'] == "N") {
$builder->where('a.direct_trad_yn', 'N');
}
// 360촬영여부
if ($data['image_360_yn'] == "Y") {
$builder->where('a.image_360_yn', 'Y');
} else if ($data['image_360_yn'] == "N") {
$builder->where('a.image_360_yn', 'N');
}
// 검증방식
if (!empty($data['isSiteVRVerification'])) {
$builder->where('a.isSiteVRVerification', $data['isSiteVRVerification']);
}
// 프로모션
if (!empty($data['isPromotionApply'])) {
$builder->where('a.isPromotionApply', $data['isPromotionApply']);
}
if (!empty($data['srchTxt'])) {
// 중개사
if ($data['srchType'] == '1') {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
// 주소
} else if ($data['srchType'] == '2') {
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
// 사업자번호
} else if ($data['srchType'] == '3') {
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
} else {
$builder->groupStart()
->like('a.agent_nm', $data['srchTxt'])
->orLike('a.sellr_nm', $data['srchTxt'])
->groupEnd();
$builder->groupStart()
->like('a.rcpt_dtl_addr', $data['srchTxt'])
->orLike('a.rcpt_hscp_nm', $data['srchTxt'])
->orLike('a.rcpt_jibun_addr', $data['srchTxt'])
->groupEnd();
$builder->like('a.image_360_yn', $data['srchTxt'], 'both');
}
}
}
$this->applyListUserScope($builder, $usr_level, $usr_sq, $dept_sq);
$this->applyListSearchFilters($builder, $data);
$builder->orderBy('a.rcpt_atclno', 'DESC');
@@ -1070,6 +651,7 @@ class ReceiptModel extends Model
,a.rcpt_product_info3
,a.rcpt_product_info4
,a.rcpt_product_info5
,a.rcpt_product_info6
,a.rcpt_office
,(CASE WHEN a.rcpt_agent IS NULL THEN 'N' ELSE 'Y' END) as rcpt_agent
,a.rcpt_sido
@@ -1210,13 +792,19 @@ class ReceiptModel extends Model
,a.isPromotionApply
,DATE_FORMAT(b.vr_check_cplt_dt, '%Y-%m-%d') as vr_check_cplt_dt_dt
,DATE_FORMAT(b.vr_check_cplt_dt, '%H:%i:%s') as vr_check_cplt_dt_dm
,a.dealAmount
,a.warrantyAmount
,a.leaseAmount
,a.preSaleAmount
,a.premiumAmount
,a.preSaleOptionAmount
", false);
$builder->join('result b', 'b.rcpt_sq = a.rcpt_sq', 'inner');
$builder->join('region_codes c', 'a.rcpt_dong = c.region_cd', 'left');
$builder->join('departments d', 'b.dept_sq = d.dept_sq', 'left');
$builder->where('a.rcpt_key', $id);
return $builder->get()->getRowArray();
}
@@ -1733,18 +1321,14 @@ class ReceiptModel extends Model
public function saveChangedHistory($rcpt_sq, $rcpt_stat, $changed_type, $usr_id, $remark)
{
$sql = "INSERT INTO changed_history" .
" (rcpt_sq, rcpt_stat, changed_type, changed_id, changed_tm, remark)" .
" VALUES" .
" (?, ?, ?, ?, now(), ?)";
$data = [
$rcpt_sq,
$changedHistoryModel = new ChangedHistoryModel();
return $changedHistoryModel->addHistory(
(int) $rcpt_sq,
$rcpt_stat,
$changed_type,
$usr_id,
$remark
];
$res = $this->db->query($sql, $data);
);
}

View File

@@ -8,64 +8,85 @@ class CodeModel extends Model
/**
* 코드목록 읽어오기(Y만)
*/
public function getCodeList($category)
{
$sql = "SELECT category, category_nm, cd, cd_nm FROM codes" .
" WHERE category = ?" .
" AND use_yn = 'Y'" .
" ORDER BY view_odr";
$data = [$category];
$query = $this->db->query($sql, $data);
return $query->getResultArray();
}
public function getCodeLists($data): array
public function getCodeList(string $category): array
{
return $this->db->table('codes')
->select('category, category_nm, cd, cd_nm')
->whereIn('category', $data)
->where('category', $category)
->where('use_yn', 'Y')
->orderBy('view_odr')
->orderBy('view_odr', 'asc')
->get()
->getResultArray();
}
public function getCategoryCodeList($category = [], $useYn = '')
public function getCodeLists(array $categories): array
{
$this->db->select('category, cd, cd_nm, use_yn');
$this->db->from('codes');
$this->db->where_in('category', $category);
if (!empty($useYn)) {
$this->db->where('use_yn', $useYn);
if (empty($categories)) {
return [];
}
$this->db->order_by('category', 'asc');
$this->db->order_by('view_odr', 'asc');
$query = $this->db->get();
$result = $this->db->table('codes')
->select('category, category_nm, cd, cd_nm')
->whereIn('category', $categories)
->where('use_yn', 'Y')
->orderBy('category', 'asc')
->orderBy('view_odr', 'asc')
->get()
->getResultArray();
//echo $this->db->last_query()."<br>";
$groupedData = [];
foreach ($result as $item) {
$category = $item['category'];
if (!isset($groupedData[$category])) {
$groupedData[$category] = [
'name' => $item['category_nm'],
'items' => []
];
}
$groupedData[$category]['items'][$item['cd']] = $item['cd_nm'];
}
return $groupedData;
}
public function getCategoryCodeList(array $category = [], string $useYn = ''): array
{
if (empty($category)) {
return [];
}
$builder = $this->db->table('codes');
$builder->select('category, cd, cd_nm, use_yn');
$builder->whereIn('category', $category);
if (!empty($useYn)) {
$builder->where('use_yn', $useYn);
}
$builder->orderBy('category', 'asc');
$builder->orderBy('view_odr', 'asc');
$query = $builder->get();
//여기 아래부분을 해줘야 배열을 카테고리로 뽑아쓸수있다 위에는 배열에 배열이담김
$codes = [];
foreach ($query->getResultArray() as $row) {
$codes[$row['category']][] = ['cd' => $row['cd'], 'cd_nm' => $row['cd_nm']];
}
return $codes;
}
/**
* 코드 상세
*/
public function getCodeDetail($category, $code)
public function getCodeDetail(string $category, string $code): array
{
$sql = "SELECT category, category_nm, cd, cd_nm FROM codes" .
" WHERE category = ? and cd = ?";
$data = [$category, $code];
$query = $this->db->query($sql, $data);
$row = $query->getResultArray();
return $row;
return $this->db->table('codes')
->select('category, category_nm, cd, cd_nm')
->where('category', $category)
->where('cd', $code)
->get()
->getResultArray();
}
}

View File

@@ -46,6 +46,7 @@ class TypeSParameterMapper extends BaseParameterMapper
'rcpt_product_info2' => $price['dealAmount'] ?? '0',
'rcpt_product_info4' => $price['preSaleAmount'] ?? '0',
'rcpt_product_info5' => $price['premiumAmount'] ?? '0',
'rcpt_product_info6' => $price['preSaleOptionAmount'] ?? '0',
'rcpt_living_yn' => ($rawData['site']['isRegistration'] ?? false) ? 'Y' : 'N',
'rcpt_agent' => $realtor['realtorName'] ?? null,
'rcpt_sido' => $address['legalDivision']['cityNumber'] ?? null,
@@ -95,6 +96,11 @@ class TypeSParameterMapper extends BaseParameterMapper
'rcpt_cpid' => $rawData['cpId'] ?? 'naver',
'isSiteVRVerification' => ($rawData['site']['isVrVerification'] ?? false) ? 'Y' : 'N',
'isPromotionApply' => ($rawData['site']['isVrRepresentativeApply'] ?? false) ? 'Y' : 'N',
'dealAmount' => $price['dealAmount'] ?? null,
'warrantyAmount' => $price['warrantyAmount'] ?? null,
'leaseAmount' => $price['leaseAmount'] ?? null,
'preSaleAmount' => $price['preSaleAmount'] ?? null,
'premiumAmount' => $price['premiumAmount'] ?? null
];
}

View File

@@ -90,6 +90,7 @@ class TypeV2ParameterMapper extends BaseParameterMapper
'lease_amt' => $price['leaseAmount'] ?? 0,
'isale_amt' => $price['preSaleAmount'] ?? 0,
'prem_amt' => $price['premiumAmount'] ?? 0,
'preopt_amt' => $price['preSaleOptionAmount'] ?? 0,
'sise' => null,
'floor' => $floor['correspondenceFloorCount'] ?? null,
'floor2' => $floor['totalFloorCount'] ?? null,

View File

@@ -96,6 +96,12 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
<input type="hidden" name="rcpt_atclno" value="<?= $data['rcpt_atclno'] ?>" />
<input type="hidden" name="rcpt_key" value="<?= $data['rcpt_key'] ?>" />
<input type="hidden" name="rcpt_product" id="rcpt_product" value="<?= $data['rcpt_product'] ?>" />
<input type="hidden" name="rcpt_sido" value="<?= $data['rcpt_sido'] ?? '' ?>" />
<input type="hidden" name="rcpt_gugun" value="<?= $data['rcpt_gugun'] ?? '' ?>" />
<input type="hidden" name="rcpt_dong" value="<?= $data['rcpt_dong'] ?? '' ?>" />
<input type="hidden" name="rcpt_hscp_no" value="<?= $data['rcpt_hscp_no'] ?? '' ?>" />
<input type="hidden" name="rcpt_ptp_no" value="<?= $data['rcpt_ptp_no'] ?? '' ?>" />
<div class="main-card mb-3 card">
<div class="card-body">
<h5 class="card-title">매물 정보</h5>
@@ -140,15 +146,14 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
<td>
<select class="form-select" id="trade_type" onchange="trade_type_onchange();" disabled>
<option value="">거래구분</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "TRADE_TYPE"): ?>
<option value="<?= $c['cd'] ?>" <?php if ($c['cd'] === $data['trade_type']) {
echo "selected";
} ?>>
<?= $c['cd_nm'] ?>
</option>
<?php endif; ?>
<?php foreach ( $codes['TRADE_TYPE']['items'] as $cd => $cdNm): ?>
<option value="<?= $cd ?>" <?php if ($cd === $data['trade_type']) {
echo "selected";
} ?>>
<?= $cdNm ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
@@ -202,7 +207,12 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
</tr>
<tr>
<th>단지명</th>
<td></td>
<td>
<select class="form-select" id="rcpt_hscp_nm" onchange="hscp_nm_onchange();" disabled>
<option value="">단지명</option>
</select>
</td>
<th>가격</th>
<td>
<?php
@@ -211,14 +221,18 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
$v3 = str_replace(',', '', $data['rcpt_product_info3'] ?? '');
$v4 = str_replace(',', '', $data['rcpt_product_info4'] ?? '');
$v5 = str_replace(',', '', $data['rcpt_product_info5'] ?? '');
$v6 = str_replace(',', '', $data['rcpt_product_info6'] ?? '');
// 분양가/프리미엄 노출 조건
$chk_array = ['B01', 'B02', 'B03'];
$show_sale_premium = (in_array(($data['rcpt_product'] ?? ''), $chk_array) || ($data['trade_type'] ?? '') === 'A1');
$hasAmount = ($data['dealAmount'] + $data['warrantyAmount'] + $data['leaseAmount'] + $data['preSaleAmount'] + $data['premiumAmount'] + $data['preSaleOptionAmount']) > 0;
?>
<?php if (!$hasAmount): ?>
<!-- 보증금/금액 -->
<!-- 기존 금액 입력 (데이터 없을 때만 표시) -->
<div style="border: 1px solid #dee2e6; border-radius: 4px; padding: 10px; margin-bottom: 15px;">
<div class="d-flex flex-column gap-1">
<div class="d-flex align-items-center gap-1 flex-wrap">
<input type="text" class="form-control form-control-sm" name="rcpt_product_info2"
@@ -230,35 +244,95 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
<div id="div_trade_type_price_monthly">
<div class="d-flex align-items-center gap-1 flex-wrap">
<input type="text" class="form-control form-control-sm" name="rcpt_product_info3"
id="rcpt_product_info3" value="<?= esc($v3) ?>" style="width: 110px;" disabled />
id="rcpt_product_info3" value="<?= esc($v3) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원 (월)</span>
</div>
</div>
<!-- 분양가 / 프리미엄 -->
<?php if ($show_sale_premium): ?>
<div class="d-flex align-items-center gap-2 flex-wrap mt-1">
<div class="d-flex align-items-center gap-1 flex-wrap mt-1">
<span class="small text-nowrap">분양가</span>
<input type="text" class="form-control form-control-sm" name="rcpt_product_info4"
id="rcpt_product_info4" value="<?= esc($v4) ?>" style="width: 110px;" disabled />
<input type="text" class="form-control form-control-sm" name="rcpt_product_info4" id="rcpt_product_info4" value="<?= esc($v4) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
<span class="small text-muted">/</span>
<span class="small text-muted mx-2">/</span>
<span class="small text-nowrap">프리미엄</span>
<input type="text" class="form-control form-control-sm" name="rcpt_product_info5"
id="rcpt_product_info5" value="<?= esc($v5) ?>" style="width: 110px;" disabled />
<input type="text" class="form-control form-control-sm" name="rcpt_product_info5" id="rcpt_product_info5" value="<?= esc($v5) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
<span class="small text-muted mx-2">/</span>
<span class="small text-nowrap">옵션금액</span>
<input type="text" class="form-control form-control-sm" name="rcpt_product_info6" id="rcpt_product_info6" value="<?= esc($v6) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<!-- 모든 금액 필드 (hidden으로 초기화) -->
<input type="hidden" name="dealAmount" id="dealAmount" value="<?= $data['dealAmount'] ?>">
<input type="hidden" name="warrantyAmount" id="warrantyAmount" value="<?= $data['warrantyAmount'] ?>">
<input type="hidden" name="leaseAmount" id="leaseAmount" value="<?= $data['leaseAmount'] ?>">
<input type="hidden" name="preSaleAmount" id="preSaleAmount" value="<?= $data['preSaleAmount'] ?>">
<input type="hidden" name="premiumAmount" id="premiumAmount" value="<?= $data['premiumAmount'] ?>">
<input type="hidden" name="preSaleOptionAmount" id="preSaleOptionAmount" value="<?= $data['preSaleOptionAmount'] ?>">
<!-- 거래구분별 가격 표시 (disabled이므로 form submit에 포함 안됨 - hidden input이 대신 전송) -->
<?php switch ($data['rcpt_product_info1']):
case '단기임대':
case '월세':
?>
<div class="d-flex align-items-center gap-1 flex-wrap">
<span class="small text-nowrap">보증금</span>
<input type="text" id="displayWarrantyAmount" class="form-control form-control-sm display-price-input" value="<?= esc($data['warrantyAmount']) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
<span class="small text-muted mx-2">/</span>
<span class="small text-nowrap">임대료</span>
<input type="text" id="displayLeaseAmount" class="form-control form-control-sm display-price-input" value="<?= esc($data['leaseAmount']) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
</div>
<?php break; ?>
<?php case '전세': ?>
<div class="d-flex align-items-center gap-1 flex-wrap">
<span class="small text-nowrap">보증금</span>
<input type="text" id="displayWarrantyAmount" class="form-control form-control-sm display-price-input" value="<?= esc($data['warrantyAmount']) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
</div>
<?php break; ?>
<?php case '매매': ?>
<div class="d-flex align-items-center gap-1 flex-wrap">
<span class="small text-nowrap">매매가</span>
<input type="text" id="displayDealAmount" class="form-control form-control-sm display-price-input" value="<?= esc($data['dealAmount']) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
</div>
<?php break; ?>
<?php endswitch; ?>
<?php if ( in_array($data['rcpt_product'] , ['B01','B02','B03'] ) ) : ?>
<div class="d-flex align-items-center gap-1 flex-wrap mt-1">
<span class="small text-nowrap">분양가</span>
<input type="text" id="displayPresaleAmount" class="form-control form-control-sm display-price-input" value="<?= esc($data['preSaleAmount']) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
<span class="small text-muted mx-2">/</span>
<span class="small text-nowrap">프리미엄</span>
<input type="text" id="displayPremiumAmount" class="form-control form-control-sm display-price-input" value="<?= esc($data['premiumAmount']) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
<span class="small text-muted mx-2">/</span>
<span class="small text-nowrap">옵션금액</span>
<input type="text" id="displayOptionAmount" class="form-control form-control-sm display-price-input" value="<?= esc($data['preSaleOptionAmount']) ?>" style="width: 90px;" disabled />
<span class="small text-nowrap">만원</span>
</div>
<?php endif; ?>
<!-- 버튼 -->
<div class="d-flex align-items-center justify-content-end gap-1 mt-2">
<button type="button" class="btn btn-sm btn-outline-light btn-edit"
onclick="editPriceInfo();">수정</button>
onclick="editPriceInfo();">가격수정</button>
<button type="button" class="btn btn-sm btn-outline-success btn-save"
data-hscp_no="<?php echo $data['rcpt_hscp_no'];?>" data-ptp_no="<?php echo $data['rcpt_ptp_no'];?>"
onclick="modifyPriceInfo(this);">가격수정</button>
onclick="modifyPriceInfo(this);">저장</button>
<button type="button" class="btn btn-sm btn-outline-secondary btn-cancel"
onclick="location.reload();" style="display: none;">취소</button>
</div>
</div>
</td>
@@ -266,7 +340,11 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
<tr>
<th>평형</th>
<td></td>
<td>
<select class="form-select" id="rcpt_ptp_nm" disabled>
<option value="">평형 선택</option>
</select>
</td>
<?php
$chk_product_nm = [
'C04', // 전원주택
@@ -295,8 +373,55 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
</td>
</tr>
<tr class="spc">
<th></th>
<td></td>
<th>
<select id="spc_name" class="form-select" disabled="disabled" >
<option value="1" <?php echo ($data['spc_stat'] == '1') ? 'selected' : ''; ?>>전용/공용</option>
<option value="2" <?php echo ($data['spc_stat'] == '2') ? 'selected' : ''; ?>>연면적/대지</option>
<option value="3" <?php echo ($data['spc_stat'] == '3') ? 'selected' : ''; ?>>면적확인불가</option>
</select>
</th>
<td>
<?php
$data['excls_spc1'] ??= $data['excls_spc'];
$data['share_spc1'] ??= $data['share_spc'];
?>
<div class="d-flex align-items-center justify-content-start mt-2" style="gap:88px;">
<span id="exclsspc">전용면적 값 : <?=$data['excls_spc']?>m&#178;</span>
<span id="splyspc">공급면적 값 : <?=$data['sply_spc']?>m&#178;</span>
</div>
<div class="d-flex align-items-center justify-content-end gap-1 mt-2">
<input type="text" class="form-control form-control-sm" name="exclsspc1" id="exclsspc1" value="<?=$data['excls_spc1']?>" size="6" disabled />
<input type="text" class="form-control form-control-sm" name="exclsspc2" id="exclsspc2" value="<?=$data['excls_spc2']?>" size="6" disabled />
<span id="slash1">/</span>
<input type="text" class="form-control form-control-sm" name="sharespc1" id="sharespc1" value="<?=$data['share_spc1']?>" size="4" disabled />
<input type="text" class="form-control form-control-sm" name="sharespc2" id="sharespc2" value="<?=$data['share_spc2']?>" size="4" disabled />
<input type="text" class="form-control form-control-sm" name="sharespc3" id="sharespc3" value="<?=$data['share_spc3']?>" size="4" disabled />
<input type="text" class="form-control form-control-sm" name="sharespc4" id="sharespc4" value="<?=$data['share_spc4']?>" size="4" disabled />
<input type="text" class="form-control form-control-sm" name="sharespc5" id="sharespc5" value="<?=$data['share_spc5']?>" size="4" disabled />
<!-- Hidden fields for additional space info -->
<input type="hidden" name="totspc1" id="totspc1" value="<?=$data['tot_spc1']?>" />
<input type="hidden" name="totspc2" id="totspc2" value="<?=$data['tot_spc2']?>" />
<span id="slash2" style="display:none">/</span>
<input type="hidden" name="grndspc1" id="grndspc1" value="<?=$data['grnd_spc1']?>" />
<input type="hidden" name="grndspc2" id="grndspc2" value="<?=$data['grnd_spc2']?>" />
<input type="hidden" name="grndspc3" id="grndspc3" value="<?=$data['grnd_spc3']?>" />
<input type="hidden" name="grndspc4" id="grndspc4" value="<?=$data['grnd_spc4']?>" />
<input type="hidden" name="grndspc5" id="grndspc5" value="<?=$data['grnd_spc5']?>" />
<input type="hidden" name="nonspc1" id="nonspc1" value="" />
<input type="hidden" name="nonspc2" id="nonspc2" value="" />
<span id="slash3" style="display:none">/</span>
<input type="hidden" name="nonspc3" id="nonspc3" value="" />
<input type="hidden" name="nonspc4" id="nonspc4" value="" />
<input type="hidden" name="nonspc5" id="nonspc5" value="" />
<input type="hidden" name="nonspc6" id="nonspc6" value="" />
<input type="hidden" name="nonspc7" id="nonspc7" value="" />
</div>
</td>
<th>면적확인파일1</th>
<td>
<?php
@@ -417,7 +542,7 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
</td>
<th></th>
<td colspan="2" class="d-flex gap-1 justify-content-end">
<button type="button" class="btn btn-sm btn-outline-light" id="btnSilverReadLatLng" onclick="">
<button type="button" class="btn btn-sm btn-outline-light" id="btnSilverReadLatLng" onclick="editInfo.call(this);">
수정
</button>
@@ -710,17 +835,16 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
<td class="d-flex gap-1">
<select class="form-select" name="result_cd2" id="result_cd2" style="width: 100px;">
<option value="">분류1</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "RECEIPT_STATUS2"): ?>
<?php if (substr($c['cd'], 0, 2) == "90"): ?>
<option value="<?= $c['cd'] ?>" <?php if ($c['cd'] === $data['result_cd2']) {
echo "selected";
} ?>>
<?= $c['cd_nm'] ?>
</option>
<?php endif; ?>
<?php foreach( $codes['RECEIPT_STATUS2']['items'] as $cd => $cdNm): ?>
<?php if (substr($cd, 0, 2) == "90"): ?>
<option value="<?= $cd ?>" <?php if ($cd === $data['result_cd2']) {
echo "selected";
} ?>>
<?= $cdNm ?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<select class="form-select" name="result_cd3" id="result_cd3" style="width: 100px;">
<option value="">분류2</option>
@@ -1026,10 +1150,8 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
<table class="table table-bordered table-sm tbl_basic2 apt-info-table">
<?php
$smsList = [];
foreach ($codes as $c) {
if ($c['category'] === "SMS_MSG_TYPE") {
array_push($smsList, $c);
}
foreach ($codes['SMS_MSG_TYPE']['items'] as $cd => $cdNm) {
array_push($smsList, ['cd' => $cd, 'cd_nm' => $cdNm]);
}
$smsTot = sizeof($smsList);
@@ -1048,7 +1170,7 @@ $isV2 = (($data['isSiteVRVerification'] ?? '') === 'Y');
?>
<td style="text-align:center">
<a href="javascript:viewSmsPop('<?= $sms1['cd'] ?>');">
<?= $sms1['category_nm'] ?>
<?= $sms1['cd_nm'] ?>
</a>
</td>
<?php

View File

@@ -225,10 +225,8 @@ $usr_nm = session('usr_nm');
<select name="rcpt_stat1" class="form-select form-select-sm">
<option value="">선택</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
<!-- <select name="rcpt_stat2" id="srcGugun" class="form-select form-select-sm">
@@ -244,10 +242,8 @@ $usr_nm = session('usr_nm');
<label class="form-label mb-1">거래구분</label>
<select class="form-select form-select-sm" name="rcpt_product_info1">
<option value="">전체</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "NHN_DEAL_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['NHN_DEAL_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cdNm ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -283,10 +279,8 @@ $usr_nm = session('usr_nm');
<label class="form-label mb-1">CP ID</label>
<select class="form-select form-select-sm" name="rcpt_cpid">
<option value="">전체</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -295,10 +289,8 @@ $usr_nm = session('usr_nm');
<label class="form-label mb-1">매물종류</label>
<select class="form-select form-select-sm" name="rcpt_product">
<option value="">전체</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -452,13 +444,12 @@ $usr_nm = session('usr_nm');
const bonbuArr = <?= json_encode($bonbu, JSON_UNESCAPED_UNICODE); ?>;
const teamArr = <?= json_encode($team, JSON_UNESCAPED_UNICODE); ?>;
const userArr = <?= json_encode($user, JSON_UNESCAPED_UNICODE); ?>;
<?php if (isset($srchUser) && !empty($srchUser)): ?>
const srchUser = <?= json_encode($srchUser, JSON_UNESCAPED_UNICODE); ?>;
<?php else: ?>
const srchUser = null;
<?php endif; ?>
const srchUser = <?= json_encode((!empty($srchUser) ? $srchUser : null), JSON_UNESCAPED_UNICODE); ?>;
const sBonbu = "<?= $sBonbu ?? '' ?>";
const sTeam = "<?= $sTeanm ?? '' ?>";
const sTeam = "<?= $sTeam ?? '' ?>";
const userColumns = <?= ($usr_level != '45')
? "[{ data: 'dept_nm' }, { data: 'usr_nm' }]"
: "[]" ?>;
const date = new Date();
var table;
@@ -703,19 +694,15 @@ $usr_nm = session('usr_nm');
{ data: null, render: fn_agent_render , className: 'tw-150' },
{ data: null, render: fn_addr_render },
{ data: null, render: fn_prd_render },
{ data: 'rcpt_product_info1' },
<?php if ($usr_level != "45"):
echo "{ data: 'dept_nm' },
{ data: 'usr_nm' },";
endif; ?>
{ data: 'rcpt_product_info1' }
].concat(userColumns, [
{ data: 'parcel_out_yn' },
{ data: 'conf_img_yn' },
{ data: 'exp_movie_yn' },
{ data: 'ground_plan_yn' },
{ data: 'ground_plan' },
{ data: 'exp_spc_yn' },
],
{ data: 'exp_spc_yn' }
]),
// 옵션들 예시
destroy: true,
deferRender: true,

View File

@@ -225,10 +225,8 @@ $usr_nm = session('usr_nm');
<div class="d-flex gap-1">
<select name="rcpt_stat1" class="form-select form-select-sm">
<option value="">예약확인지연</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
<select name="rcpt_stat2" id="srcGugun" class="form-select form-select-sm">
@@ -244,10 +242,8 @@ $usr_nm = session('usr_nm');
<label class="form-label mb-1">거래구분</label>
<select class="form-select" name="rcpt_product_info1">
<option value="">전체</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "NHN_DEAL_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['NHN_DEAL_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cdNm ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -283,10 +279,8 @@ $usr_nm = session('usr_nm');
<label class="form-label mb-1">CP ID</label>
<select class="form-select" name="rcpt_cpid">
<option value="">전체</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -295,10 +289,8 @@ $usr_nm = session('usr_nm');
<label class="form-label mb-1">매물종류</label>
<select class="form-select" name="rcpt_product">
<option value="">전체</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -469,6 +461,9 @@ $usr_nm = session('usr_nm');
const bonbuArr = <?= json_encode($bonbu, JSON_UNESCAPED_UNICODE); ?>;
const teamArr = <?= json_encode($team, JSON_UNESCAPED_UNICODE); ?>;
const userArr = <?= json_encode($user, JSON_UNESCAPED_UNICODE); ?>;
const userColumns = <?= ($usr_level != '45')
? "[{ data: 'dept_nm' }, { data: 'usr_nm' }]"
: "[]" ?>;
const date = new Date();
var table;
@@ -709,14 +704,11 @@ $usr_nm = session('usr_nm');
{ data: null, render: fn_agent_render },
{ data: null, render: fn_addr_render },
{ data: null, render: fn_prd_render },
{ data: 'rcpt_product_info1' },
<?php if ($usr_level != "45"): ?>
{ data: 'dept_nm' },
{ data: 'usr_nm' },
<?php endif; ?>
{ data: 'rcpt_product_info1' }
].concat(userColumns, [
{ data: 'parcel_out_yn' },
{ data: 'conf_img_yn' },
],
{ data: 'conf_img_yn' }
]),
// 옵션들 예시
destroy: true,
deferRender: true,

View File

@@ -2276,6 +2276,7 @@ $usr_level = session('usr_level');
}
}
}
// 가격수정 저장
function modifyPriceInfo() {

View File

@@ -160,12 +160,10 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
<select class="form-select form-select-sm" name="atcl_vrtc_way"
id="atcl_vrtc_way" disabled>
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "VRFCREQ_WAY"): ?>
<option value="<?= $c['cd'] ?>" <?= ($c['cd'] === $data['vrfc_type_cd']) ? 'selected' : '' ?>>
<?= $c['cd_nm'] ?>
<?php foreach (($codes['VRFCREQ_WAY']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>" <?= ($cd === $data['vrfc_type_cd']) ? 'selected' : '' ?>>
<?= $cdNm ?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<?= $data['update_res_tm'] ?>
@@ -597,11 +595,9 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
<div class="main-card mb-2 card">
<div class="card-body ">
<h5 class="card-title">상태변경</h5>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<button class="mb-2 me-2 btn btn-light"
onclick="fn_status_change(<?= $data['vr_sq'] ?>, '<?= $c['cd'] ?>', '<?= $c['cd_nm'] ?>');"><?= $c['cd_nm'] ?></button>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<button class="mb-2 me-2 btn btn-light"
onclick="fn_status_change(<?= $data['vr_sq'] ?>, '<?= $cd ?>', '<?= $cdNm ?>');"><?= $cdNm ?></button>
<?php endforeach; ?>
</div>
</div>
@@ -706,12 +702,10 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
<select class="form-select" id="fax_conf_res_d11"
name="fax_conf_res_d11">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CONFIRM_RESULT_D11"): ?>
<option value="<?= $c['cd'] ?>" <?= ($c['cd'] === $data['result_d11']) ? 'selected' : '' ?>>
<?= $c['cd_nm'] ?>
<?php foreach (($codes['CONFIRM_RESULT_D11']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>" <?= ($cd === $data['result_d11']) ? 'selected' : '' ?>>
<?= $cdNm ?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</td>
@@ -735,12 +729,7 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
];
$nCnt = 0;
$code_comment = [];
foreach ($codes as $c) {
if ($c['category'] === "CONSULTANT_COMMENT") {
array_push($code_comment, $c);
}
}
$code_comment = $codes['CONSULTANT_COMMENT']['items'] ?? [];
foreach ($code_comment as $key => $value) {
if ($nCnt % 2 == 0 && $nCnt != 0) {
@@ -760,7 +749,7 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
id="comment_<?= $key ?>" disabled>
<label class="form-check-label ms-1 small"
for="price_ignore1">
<?= $value['cd_nm'] ?>
<?= $value ?>
</label>
</div>
</td>
@@ -883,12 +872,10 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
<td>
<select class="form-select" name="tel_agree" id="tel_agree">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CONFIRM_RESULT_T11"): ?>
<option value="<?= $c['cd'] ?>" <?php if ($c['cd'] === $data['tel_agree']) {
<?php foreach (($codes['CONFIRM_RESULT_T11']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>" <?php if ($cd === $data['tel_agree']) {
echo "selected";
} ?>><?= $c['cd_nm'] ?></option>
<?php endif; ?>
} ?>><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</td>
@@ -1031,7 +1018,7 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
<tr>
<th>메모</th>
<td>
<div class="d-flex flex-column gap-1" style="">
<div class="d-flex flex-column gap-1">
<textarea class="form-control" name="memo_tel" id="memo_tel" rows="2"
style="resize: none;"><?= $memo['memo'] ?></textarea>
@@ -1045,14 +1032,11 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
<th>통화실패사유</th>
<td class="d-flex gap-2">
<select class="form-select" name="tel_fail_cause" id="tel_fail_cause">
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "TEL_FAIL_CAUSE"): ?>
<option value="<?= $c['cd'] ?>" <?php if ($c['cd'] === $data['tel_fail_cause']) {
echo 'selected';
} ?>><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['TEL_FAIL_CAUSE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>" <?php if ($cd === $data['tel_fail_cause']) {
echo 'selected';
} ?>><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>

View File

@@ -38,10 +38,8 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -134,11 +132,9 @@
<div class="d-flex gap-2">
<select name="vrfcreq_way" id="vrfcreq_way" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "VRFCREQ_WAY"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['VRFCREQ_WAY']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
<select name="vrfc_type_sub" id="vrfc_type_sub" class="form-select form-select-sm">
<option value="">-선택-</option>
@@ -151,10 +147,8 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -164,10 +158,8 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -36,10 +36,8 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -132,11 +130,9 @@
<div class="d-flex gap-2">
<select name="vrfcreq_way" id="vrfcreq_way" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "VRFCREQ_WAY"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['VRFCREQ_WAY']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
<select name="vrfc_type_sub" id="vrfc_type_sub" class="form-select form-select-sm">
<option value="">-선택-</option>
@@ -149,10 +145,8 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -162,10 +156,8 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -53,11 +53,9 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -159,11 +157,9 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -183,11 +179,9 @@
<label class="form-label mb-1">팩스업체</label>
<select name="fax_corp" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "FAX_CORP"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['FAX_CORP']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -38,10 +38,8 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -85,12 +83,10 @@
<div class="input-group input-group-sm">
<select name="stat_complete_date" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>">
<?= $c['cd_nm'] ?>
</option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>">
<?= $cdNm ?>
</option>
<?php endforeach; ?>
</select>
<input type="date" class="form-control" name="complete_sdate" id="complete_sdate" placeholder="시작일">
@@ -145,10 +141,8 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -158,10 +152,8 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -38,13 +38,11 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>" <?php if ($c['cd'] == "40") {
echo "selected";
} ?>><?= $c['cd_nm'] ?>
</option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>" <?php if ($cd == "40") {
echo "selected";
} ?>><?= $cdNm ?>
</option>
<?php endforeach; ?>
</select>
</div>
@@ -137,10 +135,8 @@
<div class="d-flex gap-2">
<select name="vrfcreq_way" id="vrfcreq_way" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "VRFCREQ_WAY"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['VRFCREQ_WAY']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
<select name="vrfc_type_sub" id="vrfc_type_sub" class="form-select form-select-sm">
@@ -154,10 +150,8 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -167,10 +161,8 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -74,11 +74,9 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -170,10 +168,8 @@
<div class="d-flex gap-2">
<select name="vrfcreq_way" id="vrfcreq_way" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "VRFCREQ_WAY"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['VRFCREQ_WAY']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -184,11 +180,9 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -103,11 +103,9 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -212,11 +210,9 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -225,11 +221,9 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -48,11 +48,9 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -157,11 +155,9 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -170,11 +166,9 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -79,11 +79,9 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -175,10 +173,8 @@
<div class="d-flex gap-2">
<select name="vrfcreq_way" id="vrfcreq_way" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "VRFCREQ_WAY"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['VRFCREQ_WAY']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
<select name="vrfc_type_sub" id="vrfc_type_sub" class="form-select form-select-sm">
@@ -192,11 +188,9 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -205,11 +199,9 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -40,11 +40,9 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -135,11 +133,9 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -148,11 +144,9 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -40,10 +40,8 @@
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['STEP_VERIFICATION']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -76,12 +74,10 @@
<div class="d-flex gap-2">
<select name="vrfcreq_way" id="vrfcreq_way" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "VRFCREQ_WAY"): ?>
<option value="<?= $c['cd'] ?>">
<?= $c['cd_nm'] ?>
</option>
<?php endif; ?>
<?php foreach (($codes['VRFCREQ_WAY']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>">
<?= $cdNm ?>
</option>
<?php endforeach; ?>
</select>
<select name="vrfc_type_sub" id="vrfc_type_sub" class="form-select form-select-sm">
@@ -155,10 +151,8 @@
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['CP_ID']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -168,10 +162,8 @@
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php foreach (($codes['ARTICLE_TYPE']['items'] ?? []) as $cd => $cdNm): ?>
<option value="<?= $cd ?>"><?= $cdNm ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -7,7 +7,7 @@ var sortable = null; // Sortable 인스턴스
$(function () {
trade_type_onchange();
// trade_type_onchange();
if (isDefined(window.rcpt_hscp_nm)) {
$(".spc").hide();
@@ -846,32 +846,67 @@ function savePropertyImageOrder() {
});
}
function trade_type_onchange() {
var trade_type = $('#trade_type').val();
if (trade_type == 'B2' || trade_type == 'B3') {
// 월세...
$('#div_trade_type_price_monthly').show();
} else {
$('#div_trade_type_price_monthly').hide();
}
function editPriceInfo() {
// 1. 이미 내가 풀어서 '도장'이 찍힌 요소가 있는지 확인 (이미 수정 모드인지 체크)
const $manuallyOpened = $('#rcptFrm').find('[data-was-disabled="true"]');
if ($manuallyOpened.length > 0) {
// --- [다시 잠그기 모드] ---
$manuallyOpened.prop("disabled", true).removeAttr("data-was-disabled");
console.log("임시로 풀었던 필드들을 다시 잠갔습니다.");
} else {
// --- [잠금 풀기 모드] ---
// 2. 풀 대상들을 모읍니다. (기존 로직 포함)
let targets = [
"#trade_type",
"#rcpt_product_info2",
"#rcpt_product_info3",
".display-price-input" // 클래스 대상 추가
];
var rcpt_product = $('#rcpt_product').val();
var trade_type = $('#trade_type').val();
if (trade_type == "A1") {
if (['A01', 'A02', 'A03', 'B01', 'B02', 'B03'].includes(rcpt_product)) {
targets.push("#rcpt_product_info4", "#rcpt_product_info5", "#rcpt_product_info6");
}
}
// 3. 대상들 중에서 '현재 잠겨있는 것만' 골라서 도장 찍고 풀기
const $targetElements = $(targets.join(', '));
const $toOpen = $targetElements.filter(':disabled');
$toOpen.attr('data-was-disabled', 'true').prop('disabled', false);
console.log($toOpen.length + "개의 필드를 수정 가능하게 풀었습니다.");
if($toOpen.length > 0) $toOpen.first().focus();
}
}
// 가격수정 btn
function editPriceInfo() {
var rcpt_product = $('#rcpt_product').val();
var trade_type = $('#trade_type').val();
// 수정 버튼 클릭 시 정보 수정 가능하도록
function editInfo() {
const $form = $('#rcptFrm');
// 1. 이미 내가 풀어서 '도장(data-was-disabled)'이 찍힌 요소가 있는지 확인
const $manuallyOpened = $form.find('[data-was-disabled="true"]');
$("#trade_type").prop("disabled", false);
if ($manuallyOpened.length > 0) {
// [다시 잠그기]
// 도장이 찍힌 놈들만 다시 잠그고 도장을 지웁니다.
$manuallyOpened.prop('disabled', true).removeAttr('data-was-disabled');
console.log("임시로 풀었던 요소들을 다시 잠갔습니다.");
} else {
// [잠금 풀기]
// 현재 disabled 상태인 요소들만 찾아서 도장을 찍고 풀어줍니다.
const $toOpen = $form.find('input:disabled, select:disabled');
$("#rcpt_product_info2").prop("disabled", false);
$("#rcpt_product_info3").prop("disabled", false);
if (trade_type == "A1") {
if (rcpt_product == 'A01' || rcpt_product == 'A02' || rcpt_product == 'A03' || rcpt_product == 'B01' || rcpt_product == 'B02' || rcpt_product == 'B03') {
$("#rcpt_product_info4").prop("disabled", false);
$("#rcpt_product_info5").prop("disabled", false);
if ($toOpen.length > 0) {
$toOpen.attr('data-was-disabled', 'true').prop('disabled', false);
$toOpen.first().focus();
console.log("잠겨있던 요소들을 수정 가능하게 풀었습니다.");
}
}
}
}
// 가격수정 저장
@@ -897,23 +932,50 @@ function modifyPriceInfo(btn) {
cancelButtonColor: "#d33",
}).then((result) => {
if (result.isConfirmed) {
// Display input에서 수정된 값 읽기
var dealAmount = $("#displayDealAmount").val() || 0;
var warrantyAmount = $("#displayWarrantyAmount").val() || 0;
var leaseAmount = $("#displayLeaseAmount").val() || 0;
var preSaleAmount = $("#displayPresaleAmount").val() || 0;
var premiumAmount = $("#displayPremiumAmount").val() || 0;
var preSaleOptionAmount = $("#displayOptionAmount").val() || 0;
// Hidden input에 값 동기화
$("#dealAmount").val(dealAmount);
$("#warrantyAmount").val(warrantyAmount);
$("#leaseAmount").val(leaseAmount);
$("#preSaleAmount").val(preSaleAmount);
$("#premiumAmount").val(premiumAmount);
$("#preSaleOptionAmount").val(preSaleOptionAmount);
var params = {
'rcpt_sq': window.rcpt_sq,
'rcpt_key': $("#rcpt_key").val(),
'rcpt_no': $("#rcpt_atclno").val(),
'rcpt_sq': $("#rcptFrm [name=rcpt_sq]").val() || $("input[name=rcpt_sq]").val(),
'rcpt_key': $("#rcptFrm [name=rcpt_key]").val(),
'rcpt_atclno': $("#rcptFrm [name=rcpt_atclno]").val(),
'trade_type': tradeType,
'rcpt_product_info2': $("#rcpt_product_info2").val(),
'rcpt_product_info3': $("#rcpt_product_info3").val(),
'rcpt_product_info4': $("#rcpt_product_info4").val(),
'rcpt_product_info5': $("#rcpt_product_info5").val(),
'rcpt_product_info6': $("#rcpt_product_info6").val(),
'dealAmount': dealAmount,
'warrantyAmount': warrantyAmount,
'leaseAmount': leaseAmount,
'preSaleAmount': preSaleAmount,
'premiumAmount': premiumAmount,
'preSaleOptionAmount': preSaleOptionAmount,
'rcpt_ptp_no': $("#rcpt_ptp_no").val(),
'agent_tel': $("#agent_tel").val(),
'rcpt_hscp_no': $(btn).data('hscp_no'),
'rcpt_ptp_no': $(btn).data('ptp_no'),
};
console.log( params );
// callAjax("/article/receipt/modifyPriceInfo", params, fn_result);
callAjax("/article/receipt/modifyPriceInfo", params, fn_result);
// 저장 완료 후 display input 다시 비활성화
$(".display-price-input").prop("disabled", true);
$(".btn-edit").show();
$(".btn-save").hide();
}
});
}
@@ -931,7 +993,7 @@ function fn_save_tel() {
}).then((result) => {
if (result.isConfirmed) {
var params = {
'rcpt_sq': window.rcpt_sq,
'rcpt_sq': $("#rcptFrm [name=rcpt_sq]").val() || $("input[name=rcpt_sq]").val(),
'agent_tel': $("#agent_tel").val(),
};
@@ -2161,6 +2223,97 @@ function loadExistingImages(imgType, imgSubType) {
});
}
// 단지 목록 가져오기
function loadComplexList() {
console.log('[loadComplexList] 단지 목록 로드 시작');
var legalDivisionNumber = $('input[name="rcpt_dong"]').val() ?? '';
console.log('[loadComplexList] legalDivisionNumber:', legalDivisionNumber);
var realEstateType = $('input[name="rcpt_product"]').val() ?? '';
// 값이 없을때
if ( legalDivisionNumber == '' ) return;
let sendData = {
legalDivisionNumber: legalDivisionNumber,
};
if (realEstateType) {
sendData.realEstateType = realEstateType;
}
console.log('[loadComplexList] 요청 데이터:', sendData);
$.ajax({
url: '/common/getComplexList',
method: 'GET',
data : sendData,
success: function(result) {
console.log('[loadComplexList] 응답:', result);
if (result.code === 'success' && result.data) {
var options = '<option value="">단지 선택</option>';
result.data.forEach(function(complex) {
options += '<option value="' + complex.complexNumber + '">' + complex.name + '</option>';
});
$('#rcpt_hscp_nm').html(options);
// 현재 선택된 단지가 있으면 선택
var currentHscpNo = $('input[name="rcpt_hscp_no"]').val();
if (currentHscpNo) {
$('#rcpt_hscp_nm').val(currentHscpNo);
// 평형 정보도 로드
// loadPyeongInfo(currentHscpNo);
}
console.log('[loadComplexList] 단지 목록 로드 완료, 개수:', result.data.length);
} else {
console.warn('[loadComplexList] 단지 목록 응답이 올바르지 않습니다:', result);
}
},
error: function(xhr, status, error) {
console.error('[loadComplexList] 단지 목록 요청 실패:', error);
}
});
}
function loadPyeongInfo() {
var currentHscpNo = $('input[name="rcpt_hscp_no"]').val();
var currentPtpNo = $('input[name="rcpt_ptp_no"]').val();
var realEstateType = $('input[name="rcpt_product"]').val() ?? '';
console.log('[loadPyeongInfo] 평형 정보 로드 시작, hscpNo:', currentHscpNo);
$.ajax({
url: '/common/getPyeongInfo',
method: 'GET',
data: { complexNumber: currentHscpNo, realEstateType: realEstateType },
success: function(result) {
console.log('[loadPyeongInfo] 응답:', result);
if (result.code === 'success' && result.data) {
var options = '<option value="">평형 선택</option>';
result.data.forEach(function(pyeong) {
options += '<option value="' + pyeong.pyeongTypeNumber + '">' + pyeong.pyeongTypeName + '</option>';
});
$('#rcpt_ptp_nm').html(options);
if (currentPtpNo) {
$('#rcpt_ptp_nm').val(currentPtpNo);
}
console.log('[loadPyeongInfo] 평형 정보 로드 완료, 개수:', result.data.length);
} else {
console.warn('[loadPyeongInfo] 평형 정보 응답이 올바르지 않습니다:', result);
}
},
error: function(xhr, status, error) {
console.error('[loadPyeongInfo] 평형 정보 요청 실패:', error);
}
});
}
// 파일업로드 모달 오픈
function viewFilePop(imgType, imgSubType) {
console.log('[viewFilePop] 호출:', imgType, imgSubType);
@@ -2178,6 +2331,8 @@ function viewFilePop(imgType, imgSubType) {
$("#uploadModal").modal("show");
}
// 모달 닫힘 이벤트 처리
$(document).ready(function() {
// 중복 등록 방지를 위해 기존 핸들러 제거 후 재등록
@@ -2232,4 +2387,18 @@ $(document).ready(function() {
} else {
console.warn('[PageLoad] rsrv_sq가 없어서 이미지를 불러올 수 없습니다.');
}
// ========== 단지 목록 불러오기 ==========
// 페이지 로드 시 단지 목록을 가져와서 select 박스 채우기
loadComplexList();
// 평형 목록 불러 오기
loadPyeongInfo();
$(document).on('change', '#rcpt_hscp_nm', function() {
const selectedHscpNo = $(this).val();
console.log('[ComplexSelect] 단지 선택 변경, hscp_no:', selectedHscpNo);
$('input[name="rcpt_hscp_no"]').val(selectedHscpNo);
loadPyeongInfo();
});
});