오류 수정

This commit is contained in:
2026-02-11 21:51:10 +09:00
parent b0e7cf0df0
commit 99a072f732
5 changed files with 80 additions and 20 deletions

View File

@@ -16,7 +16,7 @@ class App extends BaseConfig
* *
* E.g., http://example.com/ * E.g., http://example.com/
*/ */
public string $baseURL = 'http://test2-admin.confirms.co.kr'; public string $baseURL = 'http://localtest2-admin.confirms.co.kr';
/** /**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL. * Allowed Hostnames in the Site URL other than the hostname in the baseURL.
@@ -199,4 +199,37 @@ class App extends BaseConfig
* @see http://www.w3.org/TR/CSP/ * @see http://www.w3.org/TR/CSP/
*/ */
public bool $CSPEnabled = false; public bool $CSPEnabled = false;
/**
* --------------------------------------------------------------------------
* Constructor - .env 값 로드
* --------------------------------------------------------------------------
*/
public function __construct()
{
parent::__construct();
// .env 파일의 값으로 속성 오버라이드
if (env('app.baseURL')) {
$this->baseURL = env('app.baseURL');
}
if (env('app.appTimezone')) {
$this->appTimezone = env('app.appTimezone');
}
if (env('app.forceGlobalSecureRequests') !== null) {
$this->forceGlobalSecureRequests = filter_var(
env('app.forceGlobalSecureRequests'),
FILTER_VALIDATE_BOOLEAN
);
}
if (env('app.CSPEnabled') !== null) {
$this->CSPEnabled = filter_var(
env('app.CSPEnabled'),
FILTER_VALIDATE_BOOLEAN
);
}
}
} }

View File

@@ -84,7 +84,7 @@ defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automa
*/ */
// 환경별 버킷 설정 // 환경별 버킷 설정
$environment = getenv('CI_ENVIRONMENT') ?: 'production'; $environment = getenv('CI_ENVIRONMENT') ?: 'production';
// log_message('info', 'Current environment: ' . $environment);
if ($environment === 'development') { if ($environment === 'development') {
define('NCLOUD_S3_BUCKET', 'confirms-object-test'); define('NCLOUD_S3_BUCKET', 'confirms-object-test');
define('NCLOUD_OBJECT_STORAGE_URL', 'https://kr.object.ncloudstorage.com/confirms-object-test'); define('NCLOUD_OBJECT_STORAGE_URL', 'https://kr.object.ncloudstorage.com/confirms-object-test');
@@ -93,6 +93,7 @@ if ($environment === 'development') {
define('NCLOUD_OBJECT_STORAGE_URL', 'https://kr.object.ncloudstorage.com/confirms-object'); define('NCLOUD_OBJECT_STORAGE_URL', 'https://kr.object.ncloudstorage.com/confirms-object');
} }
define('NCLOUD_S3_KEY', 'ncp_iam_BPAMKR3l50hXJiQ6qpSP'); // .env 파일에서 NCLOUD 설정 읽기
define('NCLOUD_S3_SECRET', 'ncp_iam_BPKMKRW2GU59UE59I1QftVGst6NJgnmbSc'); define('NCLOUD_S3_KEY', getenv('ncloud.s3.key') ?: 'ncp_iam_BPAMKR3l50hXJiQ6qpSP');
define('NCLOUD_S3_ENDPOINT', 'https://kr.object.ncloudstorage.com'); define('NCLOUD_S3_SECRET', getenv('ncloud.s3.secret') ?: 'ncp_iam_BPKMKRW2GU59UE59I1QftVGst6NJgnmbSc');
define('NCLOUD_S3_ENDPOINT', getenv('ncloud.s3.endpoint') ?: 'https://kr.object.ncloudstorage.com');

View File

@@ -152,18 +152,24 @@ class Processible extends BaseController
$rows = $this->request->getPost('rows'); $rows = $this->request->getPost('rows');
$rows = json_decode($rows, true); $rows = json_decode($rows, true);
// dd($rows);
// exit;
if (count($rows) > 0) { if (count($rows) > 0) {
$results = [];
$hasError = false;
foreach ($rows as $row): foreach ($rows as $row):
$this->model->saveCount($row); $result = $this->model->saveCount($row);
$results[] = $result;
if (!$result['success']) {
$hasError = true;
}
endforeach; endforeach;
return $this->response->setJSON([ return $this->response->setJSON([
'code' => '0', 'code' => $hasError ? '9' : '0',
'msg' => 'success' 'msg' => $hasError ? '일부 저장 실패' : 'success',
'debug' => $results // 디버깅 정보 포함
]); ]);
} else { } else {

View File

@@ -249,7 +249,7 @@ class ProcessibleModel extends Model
public function saveCount($data) public function saveCount($data)
{ {
$this->db->transStart(); // $this->db->transStart();
$usr_sq = session('usr_sq'); $usr_sq = session('usr_sq');
@@ -257,7 +257,12 @@ class ProcessibleModel extends Model
(sc_date, region_cd, am_cnt, pm_cnt, day_cnt, insert_usr, insert_tm, update_usr, update_tm) (sc_date, region_cd, am_cnt, pm_cnt, day_cnt, insert_usr, insert_tm, update_usr, update_tm)
VALUES VALUES
(?, ?, ?, ?, ?, ?, NOW(), ?, NOW()) (?, ?, ?, ?, ?, ?, NOW(), ?, NOW())
ON DUPLICATE KEY UPDATE am_cnt=values(am_cnt), pm_cnt=values(pm_cnt), day_cnt=values(day_cnt), update_usr=values(update_usr) ON DUPLICATE KEY UPDATE
am_cnt = VALUES(am_cnt),
pm_cnt = VALUES(pm_cnt),
day_cnt = VALUES(day_cnt),
update_usr = VALUES(update_usr),
update_tm = NOW()
"; ";
$datas = [ $datas = [
@@ -270,17 +275,32 @@ class ProcessibleModel extends Model
$usr_sq $usr_sq
]; ];
if ($this->db->query($sql, $datas) === false) { // 쿼리 실행
$result = $this->db->query($sql, $datas);
// 실행된 쿼리 로그 출력
$lastQuery = $this->db->getLastQuery();
log_message('info', '[ProcessibleModel::saveCount] Query: ' . $lastQuery);
log_message('info', '[ProcessibleModel::saveCount] Affected Rows: ' . $this->db->affectedRows());
if ($result === false) {
$error = $this->db->error();
log_message('error', '[ProcessibleModel::saveCount] Error: ' . json_encode($error));
return [ return [
'success' => false, 'success' => false,
'msg' => '저장실패', 'msg' => '저장실패: ' . ($error['message'] ?? '알 수 없는 오류'),
'query' => (string) $lastQuery,
'error' => $error
]; ];
} }
$this->db->transComplete(); // $this->db->transComplete();
return [ return [
'success' => true, 'success' => true,
'query' => (string) $lastQuery,
'affected_rows' => $this->db->affectedRows()
]; ];
} }
} }

View File

@@ -513,7 +513,7 @@
data: null, render: function (data, type, row, meta) { data: null, render: function (data, type, row, meta) {
var str = ` var str = `
<div class="d-flex justify-content-center gap-1"> <div class="d-flex justify-content-center gap-1">
<input type="text" id="am_cnt2__${meta.row}" value="${row.am_cnt}"/ style="width: 80px;"> <input type="text" id="am_cnt2_${meta.row}" value="${row.am_cnt}"/ style="width: 80px;">
</div> </div>
`; `;
@@ -706,9 +706,9 @@
datas.push(data); datas.push(data);
}); });
} }
console.log(path); // console.log(path);
console.log(datas) console.log(datas)
return // return
if (datas.length == 0) { if (datas.length == 0) {
Swal.fire({ Swal.fire({