홍보확인서 추가

This commit is contained in:
yangsh
2026-01-06 17:53:05 +09:00
parent de9b295e1c
commit 1c44058286
16 changed files with 10407 additions and 151 deletions

View File

@@ -682,6 +682,29 @@ class M701Model extends Model
return $query->getResultArray();
}
// 홍보확인서 정보
public function getRecordInfo($vr_sq, $file_type)
{
$sql = "SELECT seq, vr_sq, use_yn, file_type, view_odr, IFNULL(file_path , '') AS file_path, IFNULL(file_name, '') AS file_name, file_ext, file_size, img_width, img_height, meta_data, insert_user, insert_tm, cloud_upload_yn
FROM v2_files
WHERE vr_sq = ? AND use_yn = 'Y' AND file_type = ?
ORDER BY seq DESC ";
$query = $this->db->query($sql, [$vr_sq, $file_type]);
return $query->getRowArray();
}
// 메모확인
public function getMemo($vr_sq)
{
$sql = "SELECT memo FROM v2_vrfc_req where vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
return $query->getRowArray();
}
// 상세화면
public function getDetail($id)
@@ -692,7 +715,7 @@ class M701Model extends Model
a.hscplqry_lv,
b.tel_fail_cause,
a.reg_charger,
i2.usr_nm as reg_charger_nm,
i2.usr_nm AS reg_charger_nm,
a.atcl_no,
b.try_cnt,
a.cpid,
@@ -852,4 +875,103 @@ class M701Model extends Model
return $query->getResultArray();
}
// 상태변경
public function chgArticleStatus($data)
{
$usr_id = session('usr_id');
$this->db->transStart();
$sql = "INSERT INTO v2_chg_stat
(vr_sq, stat_cd, insert_user, insert_tm)
VALUES
({$data['vr_sq']}, '{$data['stat_cd']}', '{$usr_id}', NOW())
";
if ($this->db->query($sql) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$detail = $this->getDetail($data['vr_sq']);
$memo = "상태변경 : " . $detail['stat_cd'] . " => " . $data['stat_cd'];
$this->saveHistory($data['vr_sq'], $data['stat_cd'], 'C9', $usr_id, $memo);
$sql = "UPDATE v2_modify_info SET
modify_yn = 'Y'
WHERE vr_sq = {$data['vr_sq']}
";
$this->db->query($sql);
$sql = "UPDATE v2_vrfc_req SET
stat_cd = '{$data['stat_cd']}'
WHERE vr_sq = {$data['vr_sq']}
";
$this->db->query($sql);
$this->db->transComplete();
return [
'success' => true,
];
}
public function saveMemo($data)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_vrfc_req SET
memo = ?
WHERE vr_sq = ?
";
if ($this->db->query($sql, [$data['memo'], $data['vr_sq']]) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$detail = $this->getDetail($data['vr_sq']);
$memo = "메모변경 : " . $detail['memo'] . " => " . $data['memo'];
$this->saveHistory($data['vr_sq'], $data['pre_stat_cd'], 'C19', $usr_id, $memo);
return [
'success' => true,
];
}
// 변경이력 저장
public function saveHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)
{
$sql = "INSERT INTO v2_chg_history
(vr_sq, stat_cd, chg_type, insert_id, insert_tm, memo)
VALUES
(?, ?, ?, ?, NOW(), ?)
";
$data = [
$vr_sq,
$stat_cd,
$chg_type,
$usr_id,
$memo
];
$this->db->query($sql, $data);
}
}