아파트단지 상세 파일업로드 추가

This commit is contained in:
yangsh
2025-12-26 09:28:39 +09:00
parent 6b7e8ad386
commit db8e33f10d
6 changed files with 1114 additions and 82 deletions

View File

@@ -772,6 +772,7 @@ class AptModel extends Model
,b.memo, b.note, b.video_target, b.vdo_up_ynx, b.not_vdo_reson, b.apt_step, b.not_vdo_tm, b.check_yn, b.resend_yn, b.write_complete_yn, b.all_no_pho
,b.write_complete_tm, DATE_FORMAT(b.write_complete_tm, '%Y-%m-%d') as rdate_dt_cmpl ,DATE_FORMAT(b.write_complete_tm, '%H:%i:%s') as rdate_tm_cmpl
,b.charger, b.dept_sq ,(SELECT pdept_sq FROM departments WHERE dept_sq = b.dept_sq) bonbu
,IFNULL((SELECT CONCAT(file_path, '', filenm_up) FROM apt_photo WHERE rcpt_no = a.rcpt_no AND pho_cate1 = 'V' AND pho_cate2 = 'V01' ORDER BY pho_no DESC LIMIT 1), '') AS vdo_path
FROM
apt_receipt a
JOIN apt_result b ON a.rcpt_no = b.rcpt_no
@@ -1030,8 +1031,24 @@ class AptModel extends Model
'pho_cate2' => $params['pho_cate2'],
];
$this->db->where_in('pho_no', $params['pho_no']);
$result = $this->db->update('apt_photo', $data);
$phoNos = $params['pho_no'] ?? [];
if (!is_array($phoNos)) {
$phoNos = [$phoNos];
}
if (empty($phoNos)) {
return [
'success' => false,
'msg' => '대상 pho_no가 없습니다.',
];
}
$builder = $this->db->table('apt_photo');
$builder->whereIn('pho_no', $phoNos);
$result = $builder->update($data);
if ($result === false) {
return [
@@ -1182,6 +1199,31 @@ class AptModel extends Model
];
}
// 단지정보 작성완료
public function saveWriteComplete($rcpt_no)
{
$sql = " UPDATE apt_result" .
" SET write_complete_yn = 'Y'" .
" ,apt_step = CASE WHEN vdo_up_ynx = 'N' THEN 'S02' ELSE 'S04' END" .
" ,write_complete_tm = now()" .
" WHERE rcpt_no = ? ";
if ($this->db->query($sql, [$rcpt_no])) {
return [
'success' => false,
'msg' => '저장실패',
];
}
$now = $this->getDetail($rcpt_no);
$this->saveHistory($rcpt_no, $now['apt_step'], 'C', 'C1', session('usr_id'));
// 성공
return [
'success' => true,
];
}
// 단지실사 API 정보
public function new_api_photo_send_data($rcpt_no)
@@ -1246,4 +1288,153 @@ class AptModel extends Model
'success' => true,
];
}
// 업로드 파일정보 저장
public function saveImg($params)
{
$sql = "INSERT INTO apt_photo
(rcpt_no, pho_lati, pho_long, filenm, filenm_up, pho_view_yn, pho_date, insert_tm, file_path, use_yn, thumb_path, thumb_nm, cloud_upload_yn)
VALUES
(
{$params['rcpt_no']},
'{$params['gps_lat']}',
'{$params['gps_lon']}',
'{$params['origin_name']}',
'{$params['file_name']}',
'Y',
'{$params['cam_date']}',
NOW(),
'{$params['upload_path']}',
'Y',
'{$params['upload_path']}',
'{$params['thumb_name']}',
'Y'
)
";
if ($this->db->query($sql) === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
return [
'success' => true,
];
}
// 동영상 정보 저장
public function saveVideo($params)
{
$sql = "INSERT INTO apt_photo
(rcpt_no, pho_cate1, pho_cate2, filenm, filenm_up, insert_tm, file_path, use_yn, cloud_upload_yn)
VALUES
(
{$params['rcpt_no']},
'V',
'V01',
'{$params['origin_name']}',
'{$params['file_name']}',
NOW(),
'{$params['upload_path']}',
'Y',
'Y'
)
";
// print ($sql);
if ($this->db->query($sql) === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
$sql = "UPDATE apt_result" .
" SET vdo_up_ynx = 'Y'" .
" ,not_vdo_reson = ''" .
" ,video_target = 'Y'" .
" ,not_vdo_tm = NULL " .
" ,vdo_up_tm = NOW() " .
" ,apt_step = 'S03'" .
" WHERE rcpt_no = {$params['rcpt_no']}";
$this->db->query($sql);
// print ($sql);
//히스토리
$this->saveHistory($params['rcpt_no'], 'S03', 'F', 'F1', session('usr_id'));
return [
'success' => true,
];
}
// 업로드파일 일괄삭제
public function removeAllPho($rcpt_no)
{
$sql = "UPDATE apt_photo" .
" SET use_yn = 'N'" .
" WHERE rcpt_no = ? ";
if ($this->db->query($sql, [$rcpt_no]) === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
return [
'success' => true,
];
}
// 선택파일 삭제
public function removePho($params)
{
$builder = $this->db->table('apt_photo');
$builder->whereIn('pho_no', $params);
$result = $builder->update([
'use_yn' => 'N',
]);
if ($result === false) {
return [
'success' => false,
'msg' => 'DB 업데이트 실패',
];
}
return [
'success' => true,
];
}
// 카테고리 지정
public function updatePhoCate($data)
{
$sql = "UPDATE apt_photo SET
pho_cate1 = '{$data['code1']}',
pho_cate2 = '{$data['code2']}'
WHERE pho_no = {$data['pho_no']}
";
if ($this->db->query($sql) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
return [
'success' => true,
];
}
}

View File

@@ -32,7 +32,7 @@ class CodeModel extends Model
->getResultArray();
}
public function getCategoryCodeList($category = array(), $useYn = '')
public function getCategoryCodeList($category = [], $useYn = '')
{
$this->db->select('category, cd, cd_nm, use_yn');
$this->db->from('codes');