From b0a0d319ef12e5d935c65ebb9e5b16904340e88a Mon Sep 17 00:00:00 2001 From: yangsh Date: Fri, 12 Dec 2025 10:30:50 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=B8=EC=9E=90=EB=B0=9C=EC=86=A1=EB=82=B4?= =?UTF-8?q?=EC=97=AD=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 | 6 +- app/Controllers/manage/Sms.php | 59 +++++ app/Models/manage/SmsModel.php | 268 ++++++++++++++++++++++ app/Views/pages/manage/areas/lists.php | 8 + app/Views/pages/manage/dept/lists.php | 8 + app/Views/pages/manage/dept/users.php | 8 + app/Views/pages/manage/log/lists.php | 8 + app/Views/pages/manage/scomplex/lists.php | 8 + app/Views/pages/manage/sms/lists.php | 246 ++++++++++++++++++++ app/Views/pages/manage/user/lists.php | 8 + 10 files changed, 626 insertions(+), 1 deletion(-) create mode 100644 app/Controllers/manage/Sms.php create mode 100644 app/Models/manage/SmsModel.php create mode 100644 app/Views/pages/manage/sms/lists.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6d906a6..cca94dc 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -45,10 +45,11 @@ $routes->group('board', ['namespace' => 'App\Controllers\Board'], function ($rou $routes->group('manage', ['namespace' => 'App\Controllers\Manage'], function ($routes) { /** 화면 */ + + $routes->get('sms/lists', 'Sms::lists'); $routes->get('user/lists', 'User::user'); $routes->get('dept/lists', 'Dept::dept'); $routes->get('dept/getchkuser', 'Dept::getchkuser'); - $routes->get('menu/lists', 'Menu::lists'); $routes->get('permit/lists', 'Permit::lists'); $routes->get('areas/lists', 'Areas::lists'); @@ -56,6 +57,9 @@ $routes->group('manage', ['namespace' => 'App\Controllers\Manage'], function ($r $routes->get('scomplex/lists', 'Scomplex::lists'); $routes->get('loginlog/lists', 'LoginLog::lists'); + /** API - SMS관리 */ + $routes->get('sms/getSmsList', 'Sms::getSmsList'); + $routes->get('sms/excel', 'Sms::excel'); /** API - 사용자관리 */ $routes->get('user/getUserList', 'User::getUserList'); diff --git a/app/Controllers/manage/Sms.php b/app/Controllers/manage/Sms.php new file mode 100644 index 0000000..9616efe --- /dev/null +++ b/app/Controllers/manage/Sms.php @@ -0,0 +1,59 @@ +smsModel = new SmsModel(); + } + + public function lists(): string + { + return view("pages/manage/sms/lists"); + } + + + public function getSmsList() + { + $start = (int) $this->request->getGet('start') ?: 0; + $end = (int) $this->request->getGet('length') ?: 10; + + $data = [ + 'start_dt' => $this->request->getGet('start_dt'), + 'end_dt' => $this->request->getGet('end_dt'), + 'srchType' => $this->request->getGet('srchType'), + 'srchTxt' => $this->request->getGet('srchTxt'), + ]; + + $totalCount = $this->smsModel->getTotalCount($data); + $datas = $this->smsModel->getSmsList($start, $end, $data); + + return $this->response->setJSON(body: [ + 'recordsTotal' => $totalCount, + 'recordsFiltered' => $totalCount, + 'data' => $datas, + ]); + } + + // 엑셀다운로드 - 내역 + public function excel() + { + $data = [ + 'start_dt' => $this->request->getGet('start_dt'), + 'end_dt' => $this->request->getGet('end_dt'), + 'srchType' => $this->request->getGet('srchType'), + 'srchTxt' => $this->request->getGet('srchTxt'), + ]; + + $datas = $this->smsModel->getExcelList($data); + + return $this->response->setJSON(body: [ + 'data' => $datas, + ]); + } +} \ No newline at end of file diff --git a/app/Models/manage/SmsModel.php b/app/Models/manage/SmsModel.php new file mode 100644 index 0000000..1ae8aea --- /dev/null +++ b/app/Models/manage/SmsModel.php @@ -0,0 +1,268 @@ += ? "; + $sql .= " AND a.send_time < ? "; + + array_push($params, $data['start_dt'] . " 00:00:00"); + array_push($params, $nextDay . " 00:00:00"); + } else { + if (!empty($data['start_dt'])) { + $sql .= "AND a.send_time >= DATE(?) "; + + array_push($params, $data['start_dt'] . " 00:00:00"); + } + + if (!empty($data['end_dt'])) { + $nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day')); + + $sql .= " AND a.send_time < ? "; + array_push($params, $nextDay . " 00:00:00"); + } + } + + + if (!empty($data['srchTxt'])) { + switch ($data['srchType']) { + + case '1': + $sql .= "AND a.send_name LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + case '2': + $sql .= "AND a.dest_name LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + case '3': + $sql .= "AND a.dest_phone LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + default: + $sql .= "AND ( + a.send_name LIKE CONCAT('%', ?, '%') + OR a.dest_name LIKE CONCAT('%', ?, '%') + OR a.dest_phone LIKE CONCAT('%', ?, '%') + )"; + + array_push($params, $data['srchTxt']); + array_push($params, $data['srchTxt']); + array_push($params, $data['srchTxt']); + break; + + } + } + + $query = $this->db->query($sql, $params ?: []); + + return $query->getRow()->cnt; + } + + public function getSmsList($start, $end, $data) + { + $params = []; + + $sql = "SELECT + a.cmid + , a.dest_phone + , a.dest_name + , a.send_phone + , a.send_name + , a.request_time + , a.send_time + , a.report_time + , a.subject + , a.msg_body + , (select cd_nm from codes where category = 'SMS_STATUS' AND cd = a.status) as status_nm + , (CASE WHEN a.status = 1 THEN '성공' ELSE '실패' END) AS status_nm + , status + , a.etc1 + , a.etc2 + , (SELECT category_nm FROM codes WHERE category = 'SMS_MSG_TYPE' AND cd = a.etc2) as cate_nm + , a.etc3 + , b.rsrv_sq + , c.dept_nm + , d.usr_nm + FROM + ums_log a + LEFT OUTER JOIN result b ON a.etc1 = b.rsrv_sq + LEFT OUTER JOIN departments c ON b.dept_sq = c.dept_sq + LEFT OUTER JOIN users d ON b.usr_sq = d.usr_sq + WHERE + a.`status` IS NOT NULL "; + + + if (!empty($data['start_dt']) && !empty($data['end_dt'])) { + $nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day')); + + $sql .= " AND a.send_time >= ? "; + $sql .= " AND a.send_time < ? "; + + array_push($params, $data['start_dt'] . " 00:00:00"); + array_push($params, $nextDay . " 00:00:00"); + } else { + if (!empty($data['start_dt'])) { + $sql .= "AND a.send_time >= DATE(?) "; + + array_push($params, $data['start_dt'] . " 00:00:00"); + } + + if (!empty($data['end_dt'])) { + $nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day')); + + $sql .= " AND a.send_time < ? "; + array_push($params, $nextDay . " 00:00:00"); + } + } + + + if (!empty($data['srchTxt'])) { + switch ($data['srchType']) { + + case '1': + $sql .= "AND a.send_name LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + case '2': + $sql .= "AND a.dest_name LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + case '3': + $sql .= "AND a.dest_phone LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + default: + $sql .= "AND ( + a.send_name LIKE CONCAT('%', ?, '%') + OR a.dest_name LIKE CONCAT('%', ?, '%') + OR a.dest_phone LIKE CONCAT('%', ?, '%') + )"; + + array_push($params, $data['srchTxt']); + array_push($params, $data['srchTxt']); + array_push($params, $data['srchTxt']); + break; + + } + } + + + $sql .= " + ORDER BY a.request_time DESC + LIMIT ?, ? "; + + $params[] = (int) $start; + $params[] = (int) $end; + + $query = $this->db->query($sql, $params ?: []); + + return $query->getResultArray(); + } + + + public function getExcelList($data) + { + $params = []; + + $sql = "SELECT + a.send_name AS '발신자' + , a.dest_name AS '수신자' + , a.send_time AS '발송일자' + , (SELECT category_nm FROM codes WHERE category = 'SMS_MSG_TYPE' AND cd = a.etc2) AS '발송구분' + , a.send_phone AS '발신번호' + , a.dest_phone AS '수신번호' + , (select cd_nm from codes where category = 'SMS_STATUS' AND cd = a.status) AS '발송상태' + FROM + ums_log a + LEFT OUTER JOIN result b ON a.etc1 = b.rsrv_sq + LEFT OUTER JOIN departments c ON b.dept_sq = c.dept_sq + LEFT OUTER JOIN users d ON b.usr_sq = d.usr_sq + WHERE + a.`status` IS NOT NULL "; + + + if (!empty($data['start_dt']) && !empty($data['end_dt'])) { + $nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day')); + + $sql .= " AND a.send_time >= ? "; + $sql .= " AND a.send_time < ? "; + + array_push($params, $data['start_dt'] . " 00:00:00"); + array_push($params, $nextDay . " 00:00:00"); + } else { + if (!empty($data['start_dt'])) { + $sql .= "AND a.send_time >= DATE(?) "; + + array_push($params, $data['start_dt'] . " 00:00:00"); + } + + if (!empty($data['end_dt'])) { + $nextDay = date('Y-m-d', strtotime($data['end_dt'] . ' +1 day')); + + $sql .= " AND a.send_time < ? "; + array_push($params, $nextDay . " 00:00:00"); + } + } + + + if (!empty($data['srchTxt'])) { + switch ($data['srchType']) { + + case '1': + $sql .= "AND a.send_name LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + case '2': + $sql .= "AND a.dest_name LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + case '3': + $sql .= "AND a.dest_phone LIKE CONCAT('%', ?, '%') "; + array_push($params, $data['srchTxt']); + break; + default: + $sql .= "AND ( + a.send_name LIKE CONCAT('%', ?, '%') + OR a.dest_name LIKE CONCAT('%', ?, '%') + OR a.dest_phone LIKE CONCAT('%', ?, '%') + )"; + + array_push($params, $data['srchTxt']); + array_push($params, $data['srchTxt']); + array_push($params, $data['srchTxt']); + break; + + } + } + + + $sql .= " + ORDER BY a.request_time DESC + "; + + $query = $this->db->query($sql, $params ?: []); + + return $query->getResultArray(); + } +} \ No newline at end of file diff --git a/app/Views/pages/manage/areas/lists.php b/app/Views/pages/manage/areas/lists.php index 72a13a1..73e6781 100644 --- a/app/Views/pages/manage/areas/lists.php +++ b/app/Views/pages/manage/areas/lists.php @@ -316,6 +316,14 @@ ajax: { url: '/manage/areas/getSvcArea', type: 'GET', + beforeSend: function () { + blockUI.blockPage({ + message: tpl + }) + }, + complete: function () { + blockUI.unblockPage() + }, data: function (d) { d.srcSido = $("#frm_srch_info [name=srcSido]").val() d.srcGugun = $("#frm_srch_info [name=srcGugun]").val() diff --git a/app/Views/pages/manage/dept/lists.php b/app/Views/pages/manage/dept/lists.php index 886c0d1..3fd7749 100644 --- a/app/Views/pages/manage/dept/lists.php +++ b/app/Views/pages/manage/dept/lists.php @@ -235,6 +235,14 @@ ajax: { url: '/manage/dept/getDeptList', type: 'GET', + beforeSend: function () { + blockUI.blockPage({ + message: tpl + }) + }, + complete: function () { + blockUI.unblockPage() + }, data: function (d) { d.srchDepth = $("#frm_srch_info [name=srchDepth]").val() d.srcDeptNm = $("#frm_srch_info [name=srcDeptNm]").val() diff --git a/app/Views/pages/manage/dept/users.php b/app/Views/pages/manage/dept/users.php index 30ca895..d8e3ea4 100644 --- a/app/Views/pages/manage/dept/users.php +++ b/app/Views/pages/manage/dept/users.php @@ -107,6 +107,14 @@ ajax: { url: '/manage/dept/getUserList', type: 'GET', + beforeSend: function () { + blockUI.blockPage({ + message: tpl + }) + }, + complete: function () { + blockUI.unblockPage() + }, data: function (d) { d.start = d.start || 0 d.length = d.length || 10 diff --git a/app/Views/pages/manage/log/lists.php b/app/Views/pages/manage/log/lists.php index 172c3b6..aa09589 100644 --- a/app/Views/pages/manage/log/lists.php +++ b/app/Views/pages/manage/log/lists.php @@ -73,6 +73,14 @@ ajax: { url: '/manage/loginlog/getLogList', type: 'GET', + beforeSend: function () { + blockUI.blockPage({ + message: tpl + }) + }, + complete: function () { + blockUI.unblockPage() + }, data: function (d) { d.start = d.start || 0 d.length = d.length || 10 diff --git a/app/Views/pages/manage/scomplex/lists.php b/app/Views/pages/manage/scomplex/lists.php index fe99589..4af28e6 100644 --- a/app/Views/pages/manage/scomplex/lists.php +++ b/app/Views/pages/manage/scomplex/lists.php @@ -229,6 +229,14 @@ ajax: { url: '/manage/scomplex/getScomplexList', type: 'GET', + beforeSend: function () { + blockUI.blockPage({ + message: tpl + }) + }, + complete: function () { + blockUI.unblockPage() + }, data: function (d) { d.name = $("#frm_srch_info [name=name]").val() d.apporval_date = $("#frm_srch_info [name=apporval_date]").val() diff --git a/app/Views/pages/manage/sms/lists.php b/app/Views/pages/manage/sms/lists.php new file mode 100644 index 0000000..e95ad5d --- /dev/null +++ b/app/Views/pages/manage/sms/lists.php @@ -0,0 +1,246 @@ +extend('layouts/main') ?> + +section('content') ?> + + +

SMS발송내역 관리

+ +
+
+
+
+ +
+ +
+
+ +
+
~
+
+ +
+
+
+ +
+ + +
+ +
+ + +
+ + + +
+ +
+ +
+
+
+
+ +
+
+
+

SMS발송내역 목록

+
+ +
+
+
+ + + + + + + + + + + + + + + +
순번발신자수신자발송일자발송구분발신번호수신번호발송상태
+
+
+
+ + + + + + +endSection() ?> \ No newline at end of file diff --git a/app/Views/pages/manage/user/lists.php b/app/Views/pages/manage/user/lists.php index 9f2e4f5..899dabf 100644 --- a/app/Views/pages/manage/user/lists.php +++ b/app/Views/pages/manage/user/lists.php @@ -342,6 +342,14 @@ ajax: { url: '/manage/user/getUserList', type: 'GET', + beforeSend: function () { + blockUI.blockPage({ + message: tpl + }) + }, + complete: function () { + blockUI.unblockPage() + }, data: function (d) { d.srchLevel = $("#frm_srch_info [name=srchLevel]").val() d.srchBonbu = $("#frm_srch_info [name=srchBonbu]").val()