변경 파일 목록
총 12개
변경 파일 코드
추가삭제
변경 전AdminLogDAO.php
| use Framework\Utility\StringUtils; | |
| use Origin\Service\Member\ManagerEditPolicy; | |
| use Origin\Enum\Policy\AccessLogAction; | |
| /** | |
| * Class AdminLogDAO | |
| * @return array | |
| */ | |
| public function setDisplayAdminLogList($data){ | |
| foreach ($data as $lKey => $lVal) { | |
| $data[$lKey]['displayDetailLogFl'] = 'n'; | |
| $fileName = end(explode('/', $lVal['baseUri'])); | |
| // 회원정보 조회를 할 경우에만 상세로그 노출 | |
| switch ($fileName) { | |
| */ | |
| public function setDisplayAdminLogInfo($data) | |
| { | |
| $fileUri = explode('/', $data['baseUri']); | |
| $fileName = end($fileUri); | |
| $result['searchCnt'] = $data['data']['searchCnt']; | |
| $result['searchData'] = $data['data']['searchData']; | |
| $result['key'] = $data['data']['GET']['key']; | |
| $result['keyword'] = $data['data']['GET']['keyword']; | |
| $result['viewCnt'] = gd_count(explode(',', $data['data']['searchData'])); | |
| if ($data['data']['searchCnt'] > 1) { | |
| if ($result['viewCnt'] > 1) { | |
| $searchData = $data['data']['searchData']; | |
| } else { | |
| if (empty($data['data']['POST']['excelDownloadReason']) === false) { | |
| $result['downloadReason'] = '사유 : ' . $data['data']['POST']['excelDownloadReason']; | |
| } | |
| if (empty($data['data']['POST']['totalCount']) === false) { | |
| $result['searchTargetMsg'] .= '<br>처리건수 : ' . number_format($data['data']['POST']['totalCount']) . '건'; | |
| } | |
| break; | |
| case 'crema_ps.php': | |
| if (empty($searchCondition) == false && $searchConditionMsgView === true) { | |
| $result['searchConditionMsg'] = '처리조건 : ' . $searchCondition; | |
| } | |
| if (empty($searchViewCnt) == false && $searchViewCntView === true) { | |
| $result['searchViewCnt'] = '처리건수 : ' . $searchViewCnt . '건'; | |
| } | |
| if ($searchTarget != '') { | |
| private function getActionName($pageData) | |
| { | |
| return $this->getValue('action', $pageData, '조회'); | |
| } | |
| private function getMenuName($menu) | |
변경 후AdminLogDAO.php
| use Framework\Utility\StringUtils; | |
| use Origin\Service\Member\ManagerEditPolicy; | |
| use Origin\Enum\Policy\AccessLogAction; | |
| use Origin\Enum\Admin\AdminLogAction; | |
| use Framework\Log\PrivacyLog\PrivacyLogResolverRegistry; | |
| /** | |
| * Class AdminLogDAO | |
| * @return array | |
| */ | |
| public function setDisplayAdminLogList($data){ | |
| $registry = App::getInstance(PrivacyLogResolverRegistry::class); | |
| foreach ($data as $lKey => $lVal) { | |
| $data[$lKey]['displayDetailLogFl'] = 'n'; | |
| // 개인정보접속기록 엑셀 다운로드 내역처럼 baseUri 없이 조회한 목록도 있다 | |
| $baseUri = (string) ($lVal['baseUri'] ?? ''); | |
| $logData = is_string($lVal['data'] ?? null) ? (json_decode($lVal['data'], true) ?: []) : []; | |
| if ($registry->findDisplayResolver($baseUri, $logData) !== null) { | |
| $data[$lKey]['displayDetailLogFl'] = 'y'; | |
| continue; | |
| } | |
| $fileName = basename($baseUri); | |
| // 회원정보 조회를 할 경우에만 상세로그 노출 | |
| switch ($fileName) { | |
| */ | |
| public function setDisplayAdminLogInfo($data) | |
| { | |
| $registry = App::getInstance(PrivacyLogResolverRegistry::class); | |
| $resolver = $registry->findDisplayResolver($data['baseUri']); | |
| if ($resolver !== null) { | |
| $result = $resolver->getDisplayData($data['baseUri'], $data['data']); | |
| $result['searchCnt'] = $data['data']['searchCnt'] ?? null; | |
| $result['searchData'] = htmlspecialchars($result['searchData'], ENT_QUOTES, 'UTF-8'); | |
| $result['searchConditionMsg'] = '처리조건 : ' . htmlspecialchars($result['keyValue'], ENT_QUOTES, 'UTF-8'); | |
| if ($result['keyword'] !== '') { | |
| $result['searchConditionMsg'] .= ' (' . htmlspecialchars($result['keyword'], ENT_QUOTES, 'UTF-8') . ')'; | |
| } | |
| $result['searchViewCnt'] = '처리건수 : ' . $result['viewCnt'] . '건'; | |
| $contents = [$result['searchConditionMsg'], $result['searchViewCnt']]; | |
| if ($result['searchData'] !== '') { | |
| $result['searchTargetMsg'] = '처리대상 : ' . $result['searchData']; | |
| $contents[] = $result['searchTargetMsg']; | |
| } | |
| $result['logContents'] = implode('<br />', $contents); | |
| return $result; | |
| } | |
| $data['data']['searchData'] = $data['data']['searchData'] ?? ''; | |
| $fileUri = explode('/', $data['baseUri']); | |
| $fileName = end($fileUri); | |
| $result['searchCnt'] = $data['data']['searchCnt']; | |
| $result['searchData'] = $data['data']['searchData']; | |
| $result['key'] = $data['data']['GET']['key']; | |
| $result['keyword'] = $data['data']['GET']['keyword']; | |
| $result['viewCnt'] = empty($data['data']['searchData']) ? 0 : count(explode(',', $data['data']['searchData'])); | |
| if ($result['viewCnt'] === 0) { | |
| $searchData = ''; | |
| } elseif ($data['data']['searchCnt'] > 1) { | |
| if ($result['viewCnt'] > 1) { | |
| $searchData = $data['data']['searchData']; | |
| } else { | |
| if (empty($data['data']['POST']['excelDownloadReason']) === false) { | |
| $result['downloadReason'] = '사유 : ' . $data['data']['POST']['excelDownloadReason']; | |
| } | |
| $totalCount = $data['data']['POST']['totalCount'] ?? null; | |
| if ($totalCount !== null && $totalCount !== '') { | |
| $result['searchTargetMsg'] .= '<br>처리건수 : ' . number_format($totalCount) . '건'; | |
| } | |
| break; | |
| case 'crema_ps.php': | |
| if (empty($searchCondition) == false && $searchConditionMsgView === true) { | |
| $result['searchConditionMsg'] = '처리조건 : ' . $searchCondition; | |
| } | |
| if ($searchViewCntView) { | |
| $result['searchViewCnt'] = '처리건수 : ' . $searchViewCnt . '건'; | |
| } | |
| if ($searchTarget != '') { | |
| private function getActionName($pageData) | |
| { | |
| return $this->getValue('action', $pageData, AdminLogAction::VIEW); | |
| } | |
| private function getMenuName($menu) | |
변경 전BankdaGhostDepositor.php
| /** | |
| * 미확인 입금자 디비 저장 | |
| * @param array $arrData 미확인 입금자 배열 | |
| */ | |
| public function registerGhostDepositor($arrData) { | |
| $insertData['depositPrice'] = isset($arrData['depositPrice']) ? $arrData['depositPrice'] : ''; | |
| $arrBind = $this->db->get_binding(DBTableField::tableGhostDepositor(), $insertData, 'insert'); | |
| $this->db->set_insert_db(DB_GHOST_DEPOSITOR, $arrBind['param'], $arrBind['bind'], 'y'); | |
| } | |
| /** | |
변경 후BankdaGhostDepositor.php
| /** | |
| * 미확인 입금자 디비 저장 | |
| * @param array $arrData 미확인 입금자 배열 | |
| * @return int|string 등록된 미확인 입금자 번호 | |
| */ | |
| public function registerGhostDepositor($arrData) { | |
| $insertData['depositPrice'] = isset($arrData['depositPrice']) ? $arrData['depositPrice'] : ''; | |
| $arrBind = $this->db->get_binding(DBTableField::tableGhostDepositor(), $insertData, 'insert'); | |
| $this->db->set_insert_db(DB_GHOST_DEPOSITOR, $arrBind['param'], $arrBind['bind'], 'y'); | |
| return $this->db->insert_id(); | |
| } | |
| /** | |
변경 전ExcelOrderConvert.php
| 'fail' => $failCnt, | |
| 'functionAuth' => $functionAuthCnt, | |
| 'message' => $failMessage, | |
| ]; | |
| } | |
변경 후ExcelOrderConvert.php
| 'fail' => $failCnt, | |
| 'functionAuth' => $functionAuthCnt, | |
| 'message' => $failMessage, | |
| 'groupCd' => $groupCd, | |
| ]; | |
| } | |
변경 전ExcelRequest.php
| */ | |
| } | |
| public function makeExcelFile(&$arrData) | |
| { | |
| $excleForm = \App::load('\\Component\\Excel\\ExcelForm'); | |
| $this->fileConfig['menu'] = $formData['menu']; | |
| $this->fileConfig['location'] = $formData['location']; | |
| if (!is_dir(UserFilePath::data('excel', $formData['menu'])->getPathName())) { | |
| mkdir(UserFilePath::data('excel', $formData['menu'])->getPathName(), 0707); | |
| } | |
| $tmpGetData = $this->getMemberMemberList(unserialize($arrData['whereCondition']), $formData['excelField'], $excelFieldName); | |
| } | |
| $getData = $tmpGetData['getData']; | |
| $arrData['totalCount'] = $tmpGetData['totalCount']; | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_manage') { | |
| $getData = $this->getPromotionCouponManage($arrData, $formData['excelField'], $excelFieldName); | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_offline_manage') { | |
| } | |
| if ($getData) { | |
| if (\is_array($getData)) { | |
| foreach ($getData as $k => $v) { | |
| $this->genarateFile($v); | |
| } | |
| } else { | |
| if (gd_isset($this->fileConfig['password'])) { | |
| $arrData['filePath'] = "excel" . DS . $formData['menu']; | |
| $arrData['fileName'] = gd_implode(STR_DIVISION, $this->fileConfig['fileName']); | |
| $arrData['state'] = "y"; | |
| $arrData['expiryDate'] = date("Y-m-d", strtotime("+7 day")); | |
| $setData = $setHedData = []; | |
| $setHedData[] = '<tr>'; | |
| foreach ($data as $k => $v) { | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $orderData = $orderAdmin->getOrderListForAdminExcel($whereCondition, $whereCondition['periodFl'], $isUserHandle, $orderType, $excelField, 0, $this->excelPageNum); | |
| //튜닝한 업체를 위해 데이터 맞춤 | |
| if (empty($orderData['totalCount']) === true && empty($orderData['orderList']) === true) { | |
| $isGenerator = false; | |
| $totalNum = gd_count($orderData); | |
| if ($this->excelPageNum) $orderList = array_chunk($orderData, $this->excelPageNum, true); | |
| $totalNum = gd_count($orderData['totalCount']); | |
| $orderList = $orderData['orderList']; | |
| if (gd_is_provider() && $orderType == 'goods') { | |
| $totalScmInfo = $orderData['totalScmInfo']; | |
| } | |
| } | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| $data = $orderList[$i]; | |
| } | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum == 1) ? 100 : round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))); | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } else { | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| } | |
| unset($tmpData); | |
| } | |
| //exit; | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| } | |
| $totalNum = gd_count($data); | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| $totalNum = gd_count($data); | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| $orderList = $orderData['orderList']; | |
| } | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| } else { | |
| $data = $orderList[$i]; | |
| } | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum - 1) > 0 ? round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))) : 100; | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| unset($tmpData); | |
| } | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| } | |
| return true; | |
| $setData = []; | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $setData[] = gd_array_merge($setHedData, $tmpData); | |
| } | |
| return ['getData' => $setData, 'totalCount' => '$totalNum']; | |
| } | |
| } | |
변경 후ExcelRequest.php
| */ | |
| } | |
| /** | |
| * @param array $fileInfo 엑셀 요청의 menu, fileName, whereCondition, totalCount | |
| * @param int|string $excelKey 선택한 파일 순번 | |
| * @return int|string|null 파일별 처리건수 또는 미집계 | |
| */ | |
| public function getDownloadTotalCount(array $fileInfo, $excelKey) | |
| { | |
| if (!in_array($fileInfo['menu'] ?? '', ['order', 'orderDraft', 'member'], true)) { | |
| return $fileInfo['totalCount'] ?? null; | |
| } | |
| $fileNames = explode(STR_DIVISION, $fileInfo['fileName'] ?? ''); | |
| if ((!is_int($excelKey) && !is_string($excelKey)) | |
| || (string) (int) $excelKey !== (string) $excelKey | |
| || !isset($fileNames[$excelKey]) | |
| || empty($fileNames[$excelKey])) { | |
| return null; | |
| } | |
| $whereCondition = []; | |
| if (!empty($fileInfo['whereCondition'])) { | |
| if (!is_string($fileInfo['whereCondition'])) { | |
| return null; | |
| } | |
| $whereCondition = @unserialize($fileInfo['whereCondition'], ['allowed_classes' => false]); | |
| if (!is_array($whereCondition)) { | |
| return null; | |
| } | |
| } | |
| if (array_key_exists('excelFileCounts', $whereCondition)) { | |
| $fileCounts = $whereCondition['excelFileCounts']; | |
| if (!is_array($fileCounts) || array_keys($fileCounts) !== $fileNames) { | |
| return null; | |
| } | |
| foreach ($fileCounts as $fileCount) { | |
| if (!is_int($fileCount) || $fileCount < 0) { | |
| return null; | |
| } | |
| } | |
| return $fileCounts[$fileNames[$excelKey]]; | |
| } | |
| // 파일별 집계가 없는 이전 요청과 튜닝 사본은 기존 건수 표시를 유지한다. | |
| return $fileInfo['totalCount'] ?? null; | |
| } | |
| public function makeExcelFile(&$arrData) | |
| { | |
| $excleForm = \App::load('\\Component\\Excel\\ExcelForm'); | |
| $this->fileConfig['menu'] = $formData['menu']; | |
| $this->fileConfig['location'] = $formData['location']; | |
| // 미집계와 실제 0건을 구분하고 재사용 시 직전 요청 값을 제거한다. | |
| $this->fileConfig['totalCount'] = null; | |
| $this->fileConfig['excelFileCounts'] = []; | |
| $tracksFileCount = in_array($formData['menu'], ['order', 'member'], true) || $arrData['menu'] === 'orderDraft'; | |
| if ($tracksFileCount) { | |
| $this->fileConfig['fileName'] = []; | |
| $logWhereCondition = unserialize($arrData['whereCondition'], ['allowed_classes' => false]); | |
| if (is_array($logWhereCondition)) { | |
| // 요청에서 전달되거나 이전 생성 때 저장한 건수는 재집계한다. | |
| unset($logWhereCondition['excelFileCounts']); | |
| $arrData['whereCondition'] = serialize($logWhereCondition); | |
| } | |
| } | |
| if (!is_dir(UserFilePath::data('excel', $formData['menu'])->getPathName())) { | |
| mkdir(UserFilePath::data('excel', $formData['menu'])->getPathName(), 0707); | |
| } | |
| $tmpGetData = $this->getMemberMemberList(unserialize($arrData['whereCondition']), $formData['excelField'], $excelFieldName); | |
| } | |
| $getData = $tmpGetData['getData']; | |
| $this->fileConfig['totalCount'] = $tmpGetData['totalCount']; | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_manage') { | |
| $getData = $this->getPromotionCouponManage($arrData, $formData['excelField'], $excelFieldName); | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_offline_manage') { | |
| } | |
| if ($getData) { | |
| $generatedAllFiles = true; | |
| if (\is_array($getData)) { | |
| foreach ($getData as $k => $v) { | |
| if ($this->genarateFile($v) === false) { | |
| $generatedAllFiles = false; | |
| } | |
| } | |
| } else { | |
| if (gd_isset($this->fileConfig['password'])) { | |
| $arrData['filePath'] = "excel" . DS . $formData['menu']; | |
| $arrData['fileName'] = gd_implode(STR_DIVISION, $this->fileConfig['fileName']); | |
| if ($tracksFileCount) { | |
| $fileNames = $this->fileConfig['fileName']; | |
| $fileCounts = $this->fileConfig['excelFileCounts']; | |
| if (empty($fileCounts) && count($fileNames) === 1 && isset($this->fileConfig['totalCount'])) { | |
| $fileCounts = [(int) $this->fileConfig['totalCount']]; | |
| } | |
| $logWhereCondition = unserialize($arrData['whereCondition'], ['allowed_classes' => false]); | |
| $logWhereCondition = is_array($logWhereCondition) ? $logWhereCondition : []; | |
| $logWhereCondition['excelFileCounts'] = []; | |
| if ($generatedAllFiles | |
| && (!is_array($getData) || count($getData) === count($fileNames)) | |
| && !empty($fileNames) | |
| && count($fileNames) === count(array_unique($fileNames)) | |
| && empty($fileCounts)) { | |
| unset($logWhereCondition['excelFileCounts']); | |
| } | |
| if ($generatedAllFiles | |
| && (!is_array($getData) || count($getData) === count($fileNames)) | |
| && !empty($fileNames) | |
| && count($fileNames) === count(array_unique($fileNames)) | |
| && count($fileNames) === count($fileCounts) | |
| && array_keys($fileCounts) === range(0, count($fileNames) - 1)) { | |
| $logWhereCondition['excelFileCounts'] = array_combine($fileNames, $fileCounts); | |
| } | |
| $arrData['whereCondition'] = serialize($logWhereCondition); | |
| } | |
| if (isset($this->fileConfig['totalCount'])) { | |
| // DBTool의 느슨한 null 비교에서 정수 0이 기본값으로 바뀌므로 문자열로 전달한다. | |
| $arrData['totalCount'] = $this->fileConfig['totalCount'] === 0 ? '0' : $this->fileConfig['totalCount']; | |
| } | |
| $arrData['state'] = "y"; | |
| $arrData['expiryDate'] = date("Y-m-d", strtotime("+7 day")); | |
| $setData = $setHedData = []; | |
| $setHedData[] = '<tr>'; | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $orderData = $orderAdmin->getOrderListForAdminExcel($whereCondition, $whereCondition['periodFl'], $isUserHandle, $orderType, $excelField, 0, $this->excelPageNum); | |
| //튜닝한 업체를 위해 데이터 맞춤 | |
| if (!isset($orderData['totalCount'], $orderData['orderList'])) { | |
| $isGenerator = false; | |
| $totalNum = gd_count($orderData); | |
| if ($this->excelPageNum) $orderList = array_chunk($orderData, $this->excelPageNum, true); | |
| $totalNum = gd_count($orderData['totalCount']); | |
| $orderList = $orderData['orderList']; | |
| if (gd_is_provider() && $orderType == 'goods') { | |
| $totalScmInfo = $orderData['totalScmInfo'] ?? []; | |
| } | |
| } | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| $data = $orderList[$i]; | |
| } | |
| $fileCount = 0; | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum == 1) ? 100 : round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))); | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } else { | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| } | |
| $fileCount++; | |
| unset($tmpData); | |
| } | |
| //exit; | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| $this->fileConfig['excelFileCounts'][] = $fileCount; | |
| } | |
| $totalNum = gd_count($data); | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| $totalNum = gd_count($data); | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| $orderList = $orderData['orderList']; | |
| } | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| } else { | |
| $data = $orderList[$i]; | |
| } | |
| $fileCount = 0; | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum - 1) > 0 ? round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))) : 100; | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| $fileCount++; | |
| unset($tmpData); | |
| } | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| $this->fileConfig['excelFileCounts'][] = $fileCount; | |
| } | |
| return true; | |
| $setData = []; | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $setData[] = gd_array_merge($setHedData, $tmpData); | |
| } | |
| return ['getData' => $setData, 'totalCount' => $totalNum]; | |
| } | |
| } | |
변경 전OrderAdminNew.php
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| protected $targetOrderGoodsNo; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| } | |
변경 후OrderAdminNew.php
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| protected $targetOrderGoodsNo; | |
| /** @var array 우체국택배 송장번호를 발급한 주문번호 (saveOrderInvoice) */ | |
| protected $issuedInvoiceOrderNos = []; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| $this->issuedInvoiceOrderNos = []; | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| $this->issuedInvoiceOrderNos[] = $v['orderNo']; | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @return array 예약된 주문번호 목록 | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| $reservedOrderNos = []; | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| $reservedOrderNos[] = $updateData[$v]['orderNo']; | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| return array_values(array_unique($reservedOrderNos)); | |
| } | |
| /** | |
| * 우체국택배 송장번호를 발급한 주문번호 — 직전 saveOrderInvoice 호출 기준 | |
| * | |
| * @return array | |
| */ | |
| public function getIssuedInvoiceOrderNos() | |
| { | |
| return array_values(array_unique($this->issuedInvoiceOrderNos)); | |
| } | |
변경 전OrderAdmin.php
| protected $cancelOrderlLimit = 500; | |
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| protected $targetOrderGoodsNo; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| } | |
변경 후OrderAdmin.php
| protected $cancelOrderlLimit = 500; | |
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| /** @var array 우체국택배 송장번호를 발급한 주문번호 (saveOrderInvoice) */ | |
| protected $issuedInvoiceOrderNos = []; | |
| protected $targetOrderGoodsNo; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| $this->issuedInvoiceOrderNos = []; | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| $this->issuedInvoiceOrderNos[] = $v['orderNo']; | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @return array 예약된 주문번호 목록 | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| $reservedOrderNos = []; | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| $reservedOrderNos[] = $updateData[$v]['orderNo']; | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| return array_values(array_unique($reservedOrderNos)); | |
| } | |
| /** | |
| * 우체국택배 송장번호를 발급한 주문번호 — 직전 saveOrderInvoice 호출 기준 | |
| * | |
| * @return array | |
| */ | |
| public function getIssuedInvoiceOrderNos() | |
| { | |
| return array_values(array_unique($this->issuedInvoiceOrderNos)); | |
| } | |
변경 전BankdaMatchPsController.php
| case 'accountList': | |
| $bk = new Bankda(); | |
| $res = $bk->accountList(Request::get()->toArray()); | |
| echo $res; | |
| exit(); | |
| break; | |
| try { | |
| $bk = new Bankda(); | |
| $res = $bk->bankMatching(Request::get()->toArray()); | |
| echo $res; | |
| exit(); | |
| } catch (\Exception $e) { | |
| $bk = new Bankda(); | |
| $getValue = Request::get()->toArray(); | |
| $res = $bk->bankManualOrderList($getValue); | |
| if($res) { | |
| echo json_encode($res, JSON_UNESCAPED_UNICODE); | |
| } | |
| throw new HttpException($e->ectMessage, 500); | |
| } | |
| } | |
| } | |
변경 후BankdaMatchPsController.php
| case 'accountList': | |
| $bk = new Bankda(); | |
| $res = $bk->accountList(Request::get()->toArray()); | |
| $accountList = json_decode($res, true); | |
| $this->attachPrivacyLogResult( | |
| $this->extractListTargets($accountList, 'bkcode'), | |
| $this->extractListTotalCount($accountList) | |
| ); | |
| echo $res; | |
| exit(); | |
| break; | |
| try { | |
| $bk = new Bankda(); | |
| $res = $bk->bankMatching(Request::get()->toArray()); | |
| $this->attachPrivacyLogResult($this->extractMatchedOrderNos($res)); | |
| echo $res; | |
| exit(); | |
| } catch (\Exception $e) { | |
| $bk = new Bankda(); | |
| $getValue = Request::get()->toArray(); | |
| $res = $bk->bankManualOrderList($getValue); | |
| $this->attachPrivacyLogResult($this->extractListTargets($res, 'orderNo'), $this->extractListTotalCount($res)); | |
| if($res) { | |
| echo json_encode($res, JSON_UNESCAPED_UNICODE); | |
| } | |
| throw new HttpException($e->ectMessage, 500); | |
| } | |
| } | |
| /** | |
| * 조회 결과 행의 식별자 — 결과 검증에서 누락을 감지하도록 응답과 식별자의 null 을 보존한다 | |
| * | |
| * 통장입금내역은 입금내역 코드(뱅크다 TBLBANK.bkcode), 입금대기 주문은 주문번호를 처리대상으로 남긴다. | |
| * 입금대기 주문은 결과가 없으면 lists 없이 page 만 내려준다 | |
| * | |
| * @param mixed $response 조회 응답 (lists: 조회 행 목록, page: 페이징 정보) | |
| * @param string $field 행의 식별자 필드 (bkcode, orderNo) | |
| * @return array|null 응답 형식이 아니면 null | |
| */ | |
| protected function extractListTargets(mixed $response, string $field): ?array | |
| { | |
| if (!is_array($response) || !is_array($response['page'] ?? null)) { | |
| return null; | |
| } | |
| $lists = $response['lists'] ?? []; | |
| return is_array($lists) | |
| ? array_map(static fn(mixed $row): mixed => is_array($row) ? ($row[$field] ?? null) : null, $lists) | |
| : null; | |
| } | |
| /** | |
| * 조회 결과의 검색 건수 | |
| * | |
| * @param mixed $response 조회 응답 (page.recode: 검색 건수) | |
| * @return int|null | |
| */ | |
| protected function extractListTotalCount(mixed $response): ?int | |
| { | |
| $totalCount = is_array($response) ? ($response['page']['recode'] ?? null) : null; | |
| return is_numeric($totalCount) ? (int) $totalCount : null; | |
| } | |
| /** | |
| * 실시간입금확인으로 입금확인된 주문번호 — 화면 결과 레이어와 같이 '^' 뒤를 '|' 로 나눈다 | |
| * | |
| * @param mixed $result 매칭 결과 (결과 메시지^주문번호|주문번호) | |
| * @return array|null 입금확인된 주문이 없으면 빈 배열 | |
| */ | |
| protected function extractMatchedOrderNos(mixed $result): ?array | |
| { | |
| if (!is_string($result)) { | |
| return null; | |
| } | |
| $orderNos = explode('^', $result, 2)[1] ?? ''; | |
| return $orderNos === '' ? [] : explode('|', $orderNos); | |
| } | |
| } | |
변경 전BankdaNoMatchPsController.php
| // --- 미확인 입금자 등록 | |
| case 'insert': | |
| $ghostDepositor->registerGhostDepositor($requestPostParams); | |
| $rs['result'] = true; | |
| $this->json($rs); | |
| case 'load': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| $this->json($res); | |
| break; | |
| case 'download': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| $ghostDepositor->downloadGhostDepositor($res['body']); | |
| default: | |
| exit; | |
| } | |
| } | |
변경 후BankdaNoMatchPsController.php
| // --- 미확인 입금자 등록 | |
| case 'insert': | |
| $sno = $ghostDepositor->registerGhostDepositor($requestPostParams); | |
| // 등록 번호를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| if (!empty($sno)) { | |
| $this->attachPrivacyLogResult([$sno]); | |
| } | |
| $rs['result'] = true; | |
| $this->json($rs); | |
| case 'load': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| $this->attachPrivacyLogResult($this->extractPrivacyLogTargets($res['body'] ?? null)); | |
| $this->json($res); | |
| break; | |
| case 'download': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| // 엑셀 다운로드는 다른 엑셀과 같이 처리건수만 남긴다 | |
| $this->attachPrivacyLogResult([], is_array($res['body'] ?? null) ? count($res['body']) : null); | |
| $ghostDepositor->downloadGhostDepositor($res['body']); | |
| default: | |
| exit; | |
| } | |
| /** | |
| * 조회 결과의 입금자 번호 — 결과 검증에서 누락을 감지하도록 본문과 번호의 null 을 보존한다 | |
| * | |
| * @param mixed $body 조회 결과 행 목록 | |
| * @return array|null | |
| */ | |
| protected function extractPrivacyLogTargets(mixed $body): ?array | |
| { | |
| return is_array($body) | |
| ? array_map(static fn(mixed $row): mixed => is_array($row) ? ($row['sno'] ?? null) : null, $body) | |
| : null; | |
| } | |
| } | |
변경 전CashReceiptPsController.php
| // --- 현금영수증 개별 발급 요청 저장 | |
| case 'cash_receipt_register': | |
| try { | |
| // 개별 발급 요청 저장 | |
| $cashReceipt->saveCashReceiptEach($postValue); | |
| $this->layer(__('저장이 완료되었습니다.')); | |
| } catch (\Exception $e) { | |
변경 후CashReceiptPsController.php
| // --- 현금영수증 개별 발급 요청 저장 | |
| case 'cash_receipt_register': | |
| try { | |
| // 개별 발급 요청 저장 — 주문번호 없이 발급하면 저장 시 생성되므로 저장 후 접속기록에 채운다 | |
| $saved = false; | |
| try { | |
| $cashReceipt->saveCashReceiptEach($postValue); | |
| $saved = true; | |
| } finally { | |
| $savedOrderNo = $cashReceipt->getSavedOrderNo(); | |
| if ($saved || !empty($savedOrderNo)) { | |
| $this->attachPrivacyLogResult([$savedOrderNo]); | |
| } | |
| } | |
| $this->layer(__('저장이 완료되었습니다.')); | |
| } catch (\Exception $e) { | |
변경 전OrderPsController.php
| try { | |
| $excelOrderConvert = App::load('Component\\Excel\\ExcelOrderConvert'); | |
| $result = $excelOrderConvert->updateOrderInvoiceExcel(Request::files()->toArray()); | |
| $this->json($result); | |
| exit; | |
| } catch (Exception $e) { | |
| case 'register_frequency': | |
| try { | |
| $postValue = StringUtils::xssArrayClean(Request::request()->toArray()); | |
| $order->registerFrequencyAddress($postValue); | |
| throw new LayerException(); | |
| } catch (Exception $e) { | |
| // 주문 저장 후 처리 | |
| if ($result) { | |
| // Kafka MQ처리 | |
| $mqData = [ | |
| 'cartInfo' => ['cartSnos' => is_array($cart->cartSno) ? $cart->cartSno : [$cart->cartSno]], | |
변경 후OrderPsController.php
| try { | |
| $excelOrderConvert = App::load('Component\\Excel\\ExcelOrderConvert'); | |
| $result = $excelOrderConvert->updateOrderInvoiceExcel(Request::files()->toArray()); | |
| // 그룹코드를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| if (is_array($result) && !empty($result['groupCd'])) { | |
| $this->attachPrivacyLogResult([$result['groupCd']], $result['total'] ?? null); | |
| } | |
| $this->json($result); | |
| exit; | |
| } catch (Exception $e) { | |
| case 'register_frequency': | |
| try { | |
| $postValue = StringUtils::xssArrayClean(Request::request()->toArray()); | |
| $result = $order->registerFrequencyAddress($postValue); | |
| // 등록은 새로 생긴 주소 번호, 수정은 요청한 주소 번호를 남기고, 번호를 받지 못하면 처리 전 기록만 남긴다 | |
| $frequencySno = empty($postValue['sno']) ? $result : $postValue['sno']; | |
| if (is_numeric($frequencySno)) { | |
| $this->attachPrivacyLogResult([(string) $frequencySno]); | |
| } | |
| throw new LayerException(); | |
| } catch (Exception $e) { | |
| // 주문 저장 후 처리 | |
| if ($result) { | |
| $this->attachPrivacyLogResult([$order->orderNo]); | |
| // Kafka MQ처리 | |
| $mqData = [ | |
| 'cartInfo' => ['cartSnos' => is_array($cart->cartSno) ? $cart->cartSno : [$cart->cartSno]], | |
변경 전PostPsController.php
| } | |
| $result = $orderAdmin->saveOrderInvoice($postValue); | |
| if(gd_count($result) > 0 ) { | |
| throw new LayerException(sprintf(__("필수 정보(수령자명,수령자 핸드폰번호,수령자 주소,수령자 우편번호,주문자명) 가 누락된 주문(%s) 외 우체국 택배 송장번호가 발급되었습니다."), gd_implode(",",$result)),null,null,null,6000); | |
| throw new LayerException(__('우체국택배 서비스 신청 후 이용 가능합니다.')); | |
| } | |
| $orderAdmin->reserveOrderInvoice($postValue); | |
| throw new LayerException(__("우체국택배로 예약되었습니다.")); | |
| break; | |
| // 우체국택배 취소 | |
변경 후PostPsController.php
| } | |
| $result = $orderAdmin->saveOrderInvoice($postValue); | |
| // 발급한 주문번호를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| $issuedOrderNos = method_exists($orderAdmin, 'getIssuedInvoiceOrderNos') | |
| ? $orderAdmin->getIssuedInvoiceOrderNos() | |
| : []; | |
| if (!empty($issuedOrderNos)) { | |
| $this->attachPrivacyLogResult($issuedOrderNos); | |
| } | |
| if(gd_count($result) > 0 ) { | |
| throw new LayerException(sprintf(__("필수 정보(수령자명,수령자 핸드폰번호,수령자 주소,수령자 우편번호,주문자명) 가 누락된 주문(%s) 외 우체국 택배 송장번호가 발급되었습니다."), gd_implode(",",$result)),null,null,null,6000); | |
| throw new LayerException(__('우체국택배 서비스 신청 후 이용 가능합니다.')); | |
| } | |
| $reservedOrderNos = $orderAdmin->reserveOrderInvoice($postValue); | |
| // 예약한 주문번호를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| if (!empty($reservedOrderNos)) { | |
| $this->attachPrivacyLogResult($reservedOrderNos); | |
| } | |
| throw new LayerException(__("우체국택배로 예약되었습니다.")); | |
| break; | |
| // 우체국택배 취소 | |
변경 전LayerExcelPsController.php
| $request->request()->set($fileInfo['menu'] . 'Log', true); | |
| $request->post()->set('fileName', $fileName[$postValue['excelKey']]); | |
| $request->post()->set('downloadFileName', $fileInfo['downloadFileName']); | |
| $request->post()->set('totalCount', $fileInfo['totalCount']); | |
| $logAction = \App::load('Component\\Admin\\AdminLogDAO'); | |
| $logAction->setAdminLog(); | |
| } | |
변경 후LayerExcelPsController.php
| $request->request()->set($fileInfo['menu'] . 'Log', true); | |
| $request->post()->set('fileName', $fileName[$postValue['excelKey']]); | |
| $request->post()->set('downloadFileName', $fileInfo['downloadFileName']); | |
| $downloadTotalCount = $fileInfo['totalCount'] ?? null; | |
| if (method_exists($excelRequest, 'getDownloadTotalCount')) { | |
| $downloadTotalCount = $excelRequest->getDownloadTotalCount($fileInfo, $postValue['excelKey']); | |
| } | |
| $request->post()->set('totalCount', $downloadTotalCount); | |
| $logAction = \App::load('Component\\Admin\\AdminLogDAO'); | |
| $logAction->setAdminLog(); | |
| } | |