From 01a65ee68c41d84623222e190039b81692971365 Mon Sep 17 00:00:00 2001 From: yangsh Date: Thu, 8 Jan 2026 15:19:14 +0900 Subject: [PATCH] =?UTF-8?q?=ED=99=8D=EB=B3=B4=ED=99=95=EC=9D=B8=EC=84=9C?= =?UTF-8?q?=20=ED=99=95=EC=9D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Config/Routes.php | 5 ++++ app/Controllers/V2/M703.php | 15 +++++++++++ app/Models/v2/M703Model.php | 52 +++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6899402..f253ddf 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -111,6 +111,11 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout $routes->post('m703a/getNextFaxImgs', 'M703::getNextFaxImgs'); // 다음매물정보조회 $routes->post('m703a/saveRequestMessage', 'M703::saveRequestMessage'); // 중개사요청사항저장 $routes->post('m703a/saveResult', 'M703::saveResult'); // 결과저장 + + /** + * 홍보확인서 확인 + */ + $routes->get('m703a/find', 'M703::find'); }); /** diff --git a/app/Controllers/V2/M703.php b/app/Controllers/V2/M703.php index a7611fa..5620d06 100644 --- a/app/Controllers/V2/M703.php +++ b/app/Controllers/V2/M703.php @@ -604,4 +604,19 @@ class M703 extends BaseController ]); } } + + + // 홍보확인서 확인 + public function find() + { + $fax = $this->model->getOneFax(); + + if (empty($fax)) { + return redirect()->back() + ->with('alert', '새로운 FAX가 존재하지 않습니다.'); + } + + + return redirect()->to('/m703/m703a/detail/' . $fax['fax_sq']); + } } \ No newline at end of file diff --git a/app/Models/v2/M703Model.php b/app/Models/v2/M703Model.php index 29b3893..6b5ebc0 100644 --- a/app/Models/v2/M703Model.php +++ b/app/Models/v2/M703Model.php @@ -2182,4 +2182,56 @@ class M703Model extends Model ]; $res = $this->db->query($sql, $data); } + + // 홍보확인서 확인 + public function getOneFax() + { + $this->db->transStart(); + + $usr_id = session('usr_id'); + $usr_sq = session('usr_sq'); + $h_y = $this->get_send_yn('H'); + + $sql = "SELECT + a.fax_sq, a.mid, a.file_name, a.file_path, a.thumbnail, a.img_width, a.img_height, a.img_size, a.img_sq, a.remark, a.work_type, a.atcl_no, a.cpid, a.realtor_nm, a.stat_cd, a.proc_tm, a.send_tm, a.address_code, a.address2, a.charger, a.reg_charger + FROM + fax_imgs a + WHERE + a.recv_time > DATE_ADD(NOW(), INTERVAL -7 DAY) + AND a.stat_cd = '10' + AND not exists ( SELECT 'x' from v2_vrfc_req v2 where a.vr_sq = v2.vr_sq AND v2.stat_cd = '40' ) + "; + + if ($h_y['stop_yn'] != 'N') { + $sql .= "AND a.recv_time < date_format(curdate( ), '%Y-%m-%d 17:30:00') "; + } + + $sql .= "AND a.fax_sq > '' "; + + $sql .= "ORDER BY a.fax_sq ASC LIMIT 1 FOR UPDATE SKIP LOCKED "; + + $query = $this->db->query($sql); + $row = $query->getRowArray(); + + $row_dept = $this->getDepartmentPath($usr_sq); + $dept1_sq = ''; + $dept2_sq = ''; + if (!empty($row_dept)) { + $dept1_sq = $row_dept['dept1_sq']; + $dept2_sq = $row_dept['dept2_sq']; + } + + if (!empty($row)) { + $sql = "UPDATE fax_imgs SET + stat_cd = '20', charger = '{$usr_id}', dept1_sq = '{$dept1_sq}', dept2_sq = '{$dept2_sq}' + WHERE fax_sq = {$row['fax_sq']} + "; + + $this->db->query($sql); + } + + $this->db->transComplete(); + + return $row; + } } \ No newline at end of file -- 2.49.1