httpd 코드 수정 202-> 200

This commit is contained in:
2026-01-02 14:50:27 +09:00
parent 094fa7c640
commit 8338df57c9
6 changed files with 306 additions and 27 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class NaverWorkerLogModel extends Model
{
protected $table = 'naver_worker_logs';
protected $primaryKey = 'seq'; // 'id'가 아니므로 명시 필요
protected $useAutoIncrement = true;
protected $returnType = 'array'; // 또는 'object'
protected $useSoftDeletes = false;
// 대량 입력을 허용할 필드들
protected $allowedFields = [
'atcl_no', 'raw_payload', 'status',
'retry_cnt', 'error_msg', 'target_db_id'
];
// 날짜 자동 업데이트 설정
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@@ -0,0 +1,97 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class ReceiptModel extends Model
{
protected $table = 'receipt';
protected $primaryKey = 'rcpt_sq';
public function getReceiptList($params, $pageNum = 1, $pageSize = 20, $total = false)
{
$builder = $this->db->table('receipt a');
// 1. SELECT 문 구성
$builder->select("
a.rcpt_sq, a.comp_sq, a.rcpt_rating, ... (중략) ...,
DATE_FORMAT(COALESCE(b.rsrv_date, a.rsrv_date), '%Y-%m-%d') AS rsrv_date,
get_code_name('RECEIPT_STATUS1', LEFT(a.rcpt_stat, 2)) AS rcpt_stat_nm,
CASE WHEN imgs.has_I1 = 1 THEN 'Y' ELSE 'N' END AS conf_img_yn
", false);
// 2. JOIN 설정
$builder->join('result b', 'a.rcpt_sq = b.rcpt_sq', 'left outer');
$builder->join('region_codes c', 'a.rcpt_dong = c.region_cd', 'inner');
$builder->join('departments d', 'b.dept_sq = d.dept_sq', 'left outer');
$builder->join('users u', 'b.usr_sq = u.usr_sq', 'left outer');
// 서브쿼리 조인 (imgs)
$subQuery = $this->db->table('result_imgs')
->select("rsrv_sq")
->selectMax("CASE WHEN img_type = 'I5' AND use_yn = 'Y' THEN 1 ELSE 0 END", "has_I5")
->selectMax("CASE WHEN img_type = 'I1' AND use_yn = 'Y' THEN 1 ELSE 0 END", "has_I1")
->groupBy("rsrv_sq")
->getCompiledSelect();
$builder->join("($subQuery) imgs", "imgs.rsrv_sq = b.rsrv_sq", "left", false);
// 3. WHERE 조건 (권한 및 기본 필터)
if (in_array($params['usr_level'], ['4', '40'])) {
if (!empty($params['child_dept'])) {
$builder->whereIn('b.dept_sq', $params['child_dept']);
} else {
$builder->where('b.usr_sq', $params['usr_sq']);
}
}
// 기본 3개월 데이터 제한
$builder->where('a.insert_tm >= DATE_ADD(CURDATE(), INTERVAL -3 MONTH)', null, false);
// 4. 검색 조건 동적 생성
if (!empty($params['rcpt_atclno'])) {
$builder->where('a.rcpt_atclno', $params['rcpt_atclno']);
} else {
if (!empty($params['sdate'])) {
$builder->where('a.insert_tm >=', $params['sdate'] . ' 00:00:00');
$builder->where('a.insert_tm <', date('Y-m-d', strtotime($params['edate'] . ' +1 day')));
}
// 중개사/매도자 통합 검색 (Group Start/End 사용)
if (!empty($params['agent_nm'])) {
$builder->groupStart()
->like('a.agent_nm', $params['agent_nm'])
->orLike('a.sellr_nm', $params['agent_nm'])
->groupEnd();
}
// 상태(Status) 다중 체크
if ($params['stat_all'] !== 'Y' && !empty($params['stat_arr'])) {
$builder->groupStart();
foreach ($params['stat_arr'] as $stat) {
$builder->orLike('a.rcpt_stat', $stat, 'after');
}
$builder->groupEnd();
}
}
// 5. 정렬 및 페이징
$builder->orderBy('a.rcpt_atclno', 'desc');
// 데이터 수 조회를 위해 복제 또는 countAllResults 활용
$totalCount = 0;
if ($total) {
$countBuilder = clone $builder;
$totalCount = $countBuilder->countAllResults(false);
}
$offset = ($pageNum - 1) * $pageSize;
$result = $builder->get($pageSize, $offset)->getResultArray();
return [
'data' => $result,
'total' => $totalCount
];
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class VrfcReqModel extends Model {
// Model implementation here
protected $table = 'v2_vrfc_req';
protected $primaryKey = 'vr_sq';
// 기본값 (명시 안 해도 됨)
protected $useAutoIncrement = true;
// public function insertV2Article(array $articleInfo): bool
// {
// // Insert data into the database
// // This is a placeholder implementation
// $articleNumber = $articleInfo['articleNumber']; // 매물 번호와 동일
// $cpId = $articleInfo['cpId']; // CPID
// $cpArticleNumber = $articleInfo['cpArticleNumber']; // CP 매물번호
// $rcpt_product = $articleInfo['realEstateTypeCode']; // 매물종류(코드)
// $rcpt_product_nm = $articleInfo['realEstateType']; // 매물종류(한글명) // 아파트... ......
// $rcpt_deal_type = $articleInfo['tradeTypeCode']; // 거래구분(코드) A1, B1, B2
// $rcpt_product_info1 = $articleInfo['tradeType']; // 거래구분(한글명) 매매, 전세, 월세
// $statusTypeCode = $articleInfo['statusTypeCode']; // E12 ...매물 상태 코드
// $vrfc_type_code = $articleInfo['verificationTypeCode']; // 확인유형코드 S, D, N, M, T, O
// $owenrTypeCode = $articleInfo['ownerTypeCode'] ?? ''; // 소유자 유형 코드
// $isUnregisteredVerificationRequested = $articleInfo['isUnregisteredVerificationRequested'] ?? false; // 미등기 확인요청 여부
// $isBuildingRegisterAreaCheckRequested = $articleInfo['isBuildingRegisterAreaCheckRequested'] ?? false; // 건축물대장 면적확인 요청 여부
// $isAutoVerificationRequested = $articleInfo['isAutoVerificationRequested'] ?? false; // 자동확인 요청 여부
// // $verificationReference = $articleInfo['verificationReference'] ?? ''; // 확인참고사항
// $exposureStartDateTime = $articleInfo['exposureStartDateTime'] ?? ''; // 노출시작일시
// $facilities['roomCount'] = $articleInfo['facilities']['roomCount'] ?? 0;
// $facilities['bathroomCount'] = $articleInfo['facilities']['bathroomCount'] ?? 0;
// $address['legalDivision']['cityNumber'] = $articleInfo['address']['legalDivision']['cityNumber'] ?? '';
// $address['legalDivision']['divisionNumber'] = $articleInfo['address']['legalDivision']['divisionNumber'] ?? '';
// $address['legalDivision']['sectorNumber'] = $articleInfo['address']['legalDivision']['sectorNumber'] ?? '';
// $address['legalDivision']['legalDivisionAddress'] = $articleInfo['address']['legalDivision']['legalDivisionAddress'] ?? '';
// $address['complexNumber'] = $articleInfo['address']['complexNumber'] ?? null;
// $address['complexName'] = $articleInfo['address']['complexName'] ?? null;
// $address['pyeongTypeNumber'] = $articleInfo['address']['pyeongTypeNumber'] ?? null;
// $address['hoName'] = $articleInfo['address']['hoName'] ?? null;
// $address['isVirtualAddress'] = $articleInfo['address']['isVirtualAddress'] ?? false;
// $address['correspondenceFloorCount'] = $articleInfo['address']['correspondenceFloorCount'] ?? 0;
// $address['longitude'] = $articleInfo['address']['longitude'] ?? 0;
// $address['latitude'] = $articleInfo['address']['latitude'] ?? 0;
// $address['isDongHoChecked'] = $articleInfo['address']['isDongHoChecked'] ?? null;
// $address['inquiryLevel'] = $articleInfo['address']['inquiryLevel'] ?? null;
// $space['totalSpace'] = $articleInfo['space']['totalSpace'] ?? null;
// $space['groundSpace'] = $articleInfo['space']['groundSpace'] ?? null;
// $space['buildingSpace'] = $articleInfo['space']['buildingSpace'] ?? null;
// $space['supplySpace'] = $articleInfo['space']['supplySpace'] ?? 0;
// $space['exclusiveSpace'] = $articleInfo['space']['exclusiveSpace'] ?? 0;
// $price['dealAmount'] = $articleInfo['price']['dealAmount'] ?? 0;
// $price['warrantyAmount'] = $articleInfo['price']['warrantyAmount'] ?? 0;
// $price['leaseAmount'] = $articleInfo['price']['leaseAmount'] ?? 0;
// $floor['correspondenceFloorCount'] = $articleInfo['floor']['correspondenceFloorCount'] ?? 0;
// $floor['correspondenceFloorType'] = $articleInfo['floor']['correspondenceFloorType'] ?? null;
// $floor['totalFloorCount'] = $articleInfo['floor']['totalFloorCount'] ?? 0;
// $floor['undergroundFloorCount'] = $articleInfo['floor']['undergroundFloorCount'] ?? 0;
// $seller['sellerTelephoneNumber'] = $articleInfo['seller']['sellerTelephoneNumber'] ?? null;
// $seller['sellerName'] = $articleInfo['seller']['sellerName'] ?? null;
// $seller['ownerTelephoneNumber'] = $articleInfo['seller']['ownerTelephoneNumber'] ?? null;
// $seller['ownerName'] = $articleInfo['seller']['ownerName'] ?? null;
// $seller['isOwnerCertificationAgree'] = $articleInfo['seller']['isOwnerCertificationAgree'] ?? null;
// $seller['isDirectTrade'] = $articleInfo['seller']['isDirectTrade'] ?? null;
// $realtor['realtorName'] = $articleInfo['realtor']['realtorName'] ?? null;
// $realtor['representativeCellphoneNumber'] = $articleInfo['realtor']['representativeCellphoneNumber'] ?? null;
// $realtor['representativeTelephoneNumber'] = $articleInfo['realtor']['representativeTelephoneNumber'] ?? null;
// $files = $articleInfo['files'] ?? [];
// return true;
// }
}