diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 3acf5fb..01a1f76 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -258,6 +258,7 @@ $routes->group('admin', ['filter' => 'adminAuth'], static function ($routes): vo $routes->get('feedback/file/(:num)', 'Admin\Feedback::file/$1'); $routes->get('feedback/(:num)', 'Admin\Feedback::show/$1'); $routes->post('feedback/(:num)/status', 'Admin\Feedback::updateStatus/$1'); + $routes->post('feedback/(:num)/content', 'Admin\Feedback::updateContent/$1'); $routes->get('/', 'Admin\Dashboard::index'); $routes->get('users', 'Admin\User::index'); $routes->get('users/create', 'Admin\User::create'); diff --git a/app/Controllers/Admin/Feedback.php b/app/Controllers/Admin/Feedback.php index 2cf229d..4a3d859 100644 --- a/app/Controllers/Admin/Feedback.php +++ b/app/Controllers/Admin/Feedback.php @@ -142,6 +142,30 @@ class Feedback extends BaseController return redirect()->to(site_url('admin/feedback/' . $id))->with('success', '처리 상태를 저장했습니다.'); } + /** 문의 글(본문) 수정 */ + public function updateContent(int $id): ResponseInterface + { + $model = model(FeedbackModel::class); + $row = $model->find($id); + $scope = $this->scopeLgIdx(); + if ($row === null || ($scope !== null && (int) $row->fb_lg_idx !== $scope)) { + return redirect()->to(site_url('admin/feedback'))->with('error', '의견을 찾을 수 없습니다.'); + } + + $content = trim((string) $this->request->getPost('fb_content')); + if ($content === '') { + return redirect()->to(site_url('admin/feedback/' . $id))->with('error', '내용을 입력해 주세요.'); + } + $model->update($id, ['fb_content' => mb_substr($content, 0, 2000)]); + + $returnTo = (string) $this->request->getPost('return_to'); + if ($returnTo === 'all') { + return redirect()->to(site_url('admin/feedback/all') . '#fb-' . $id)->with('success', '문의 내용을 수정했습니다.'); + } + + return redirect()->to(site_url('admin/feedback/' . $id))->with('success', '문의 내용을 수정했습니다.'); + } + /** 스크린샷 이미지 서빙 (관리자만, writable 보호 유지) */ public function image(int $id): ResponseInterface { diff --git a/app/Views/admin/feedback/show.php b/app/Views/admin/feedback/show.php index 861cd8e..33a8379 100644 --- a/app/Views/admin/feedback/show.php +++ b/app/Views/admin/feedback/show.php @@ -20,9 +20,24 @@ use App\Models\FeedbackModel;
-
의견 내용
+
+ 의견 내용 + +
-

fb_content) ?>

+ +
+

fb_content) ?>

+
+ +
+ +