본문으로 건너뛰기

우체국 반품 수거 연동

PHP 7 · GODO25
변경 파일 수: 6개
변경 파일 목록
총 6개
변경 파일 코드
추가삭제
Admin/order/popup_epost_apply_frame.php+14
변경 전popup_epost_apply_frame.php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
변경 후popup_epost_apply_frame.php
<script src="<?=gd_set_browser_cache(PATH_ADMIN_GD_SHARE . 'ncds/script/common/aggregator-message-router.js')?>"></script>
<style>
/* 팝업(720px)이 어드민 공통 body min-width(970px)보다 좁아 오른쪽이 잘리는 것 방지 */
body { min-width: 0; overflow: hidden; }
</style>
<iframe name="epostApply" src="<?=htmlspecialchars($pageUrl, ENT_QUOTES, 'UTF-8')?>" frameborder="0" marginwidth="0" marginheight="0" width="100%" style="height: 100vh;"></iframe>
<script>
// 허브가 신청 완료 시 MODAL_CLOSE 전송 — iframe 은 창을 못 닫으므로 여기서 팝업 창을 닫는다
IframeMessageRouter.init({
onModalClose: function () {
window.close();
},
});
</script>
 
Admin/order/post_request.php+31-23
변경 전post_request.php
<h3><?=end($naviMenu->location); ?></h3>
</div>
 
<div class="table-title">우체국택배 배송상태 자동 업데이트 </div>
<table class="table table-cols">
<tbody>
<tr>
<td style="padding: 15px 0;">
<div class="notice-info" style="margin-top: 0;margin-bottom: 0">
우체국택배 배송상태를 쇼핑몰에 2시간마다 자동으로 업데이트 합니다.<br/>
2시간마다 자동으로 배송상태를 확인하여 배송이 완료된 주문은 ‘배송완료’로 업데이트 됩니다.
</div>
</td>
</tr>
</tbody>
</table>
 
<div class="table-title">우체국택배 배송상태 수동 업데이트 </div>
<table class="table table-cols">
 
 
 
 
<tbody>
<tr>
<td style="padding: 15px 0 20px 0;">
<div class="notice-info" style="margin-top: 0;margin-bottom: 0">
우체국택배 배송상태를 쇼핑몰에 수동 업데이트하려면, 아래 버튼을 클릭해 주세요.<br/>
수동으로 배송상태를 확인하여 배송이 완료된 주문은 ‘배송완료’로 업데이트 됩니다.
</div>
<div style="padding-top: 15px;"><a href="./post_ps.php?mode=manual" class="btn btn-lg btn-black" target="ifrmProcess" style="color:#fff">배송상태 수동 업데이트</a></div>
 
 
 
 
 
 
 
 
 
</td>
</tr>
</tbody>
</table>
<div class="table-title ">우체국택배 신청 </div>
<iframe name="requestPostIfrm" src="https://www.nhn-commerce.com/service/godopost/regist.php?shopSno=<?=$shopSno?>&shopHost=<?=$domainUrl?>" frameborder="0" height="830px" width="100%"></iframe>
 
 
 
 
 
 
 
 
 
 
변경 후post_request.php
<h3><?=end($naviMenu->location); ?></h3>
</div>
 
<div class="table-title">우체국택배 관리</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<table class="table table-cols">
<colgroup>
<col class="width-md" />
<col />
</colgroup>
<tbody>
<tr>
<th>우체국택배 신청</th>
<td>
<?php if ($usageRequestStatus === null): ?>
상태를 확인할 수 없습니다.
<?php elseif ($isUsageNone): ?>
<a href="javascript:void(0)" id="epr-btn-apply" class="btn btn-white btn-sm">서비스 신청하기</a>
<?php else: ?>
<?=\Origin\Enum\ApiClient\Epost\EpostUsageRequestStatus::getLabel($usageRequestStatus)?>
<?php endif; ?>
</td>
</tr>
<tr>
<th>우체국택배 배송상태 수동 업데이트</th>
<td>
<a href="./post_ps.php?mode=manual" class="btn btn-gray btn-sm" target="ifrmProcess">배송상태 수동 업데이트</a>
</td>
</tr>
</tbody>
</table>
 
<script>
document.addEventListener('DOMContentLoaded', function () {
var applyBtn = document.querySelector('#epr-btn-apply');
if (applyBtn) {
applyBtn.addEventListener('click', function () {
window.open('./popup_epost_apply.php', 'epostApply', 'width=720,height=800,scrollbars=yes');
});
}
});
</script>
 
Controller/Admin/Order/PostIssueController.php+3-2
변경 전PostIssueController.php
try {
// --- 메뉴 설정
$this->callMenu('order', 'epostParcel', 'issue');
 
$this->addScript(
[
'jquery/jquery.multi_select_box.js',
]
);
$godopost= gd_policy('order.godopost');
if(empty($godopost['compdivcd']) === true) {
throw new AlertBackException(__("우체국택배 서비스 신청 후 이용 가능합니다."));
}
 
변경 후PostIssueController.php
try {
// --- 메뉴 설정
$this->callMenu('order', 'epostParcel', 'issue');
$this->setMenuCode('order', 'epostParcel', 'issue');
$this->addScript(
[
'jquery/jquery.multi_select_box.js',
]
);
$godoPost = \App::load('\\Component\\Godo\\GodoPostServerApi');
if ($godoPost->isUsageNotRequested()) {
throw new AlertBackException(__("우체국택배 서비스 신청 후 이용 가능합니다."));
}
 
Controller/Admin/Order/PostPsController.php+10-1
변경 전PostPsController.php
$postValue = Request::post()->toArray();
$orderAdmin = \App::load('\\Component\\Order\\OrderAdmin');
 
try {
switch (Request::request()->get('mode')) {
// 우체국택배 송장 발급
case 'issue':
 
 
 
 
$result = $orderAdmin->saveOrderInvoice($postValue);
break;
// 우체국택배 예약
case 'reserve':
 
 
 
 
 
$orderAdmin->reserveOrderInvoice($postValue);
throw new LayerException(__("우체국택배로 예약되었습니다."));
break;
break;
// 우체국수동업데이트
case 'manual':
$godoPost = \App::load('\\Component\\Godo\\GodoPostServerApi');
$data = $godoPost->saveManualUpdate();
throw new LayerException(sprintf(__("주문 %s 건의 우체국 택배 배송상태를 수동 업데이트 하였습니다."), $data));
break;
 
변경 후PostPsController.php
$postValue = Request::post()->toArray();
$orderAdmin = \App::load('\\Component\\Order\\OrderAdmin');
$godoPost = \App::load('\\Component\\Godo\\GodoPostServerApi');
try {
switch (Request::request()->get('mode')) {
// 우체국택배 송장 발급
case 'issue':
$this->setMenuCode('order', 'epostParcel', 'issue');
if ($godoPost->isUsageNotRequested()) {
throw new LayerException(__('우체국택배 서비스 신청 후 이용 가능합니다.'));
}
$result = $orderAdmin->saveOrderInvoice($postValue);
break;
// 우체국택배 예약
case 'reserve':
$this->setMenuCode('order', 'epostParcel', 'reserve');
if ($godoPost->isUsageNotRequested()) {
throw new LayerException(__('우체국택배 서비스 신청 후 이용 가능합니다.'));
}
$orderAdmin->reserveOrderInvoice($postValue);
throw new LayerException(__("우체국택배로 예약되었습니다."));
break;
break;
// 우체국수동업데이트
case 'manual':
 
$data = $godoPost->saveManualUpdate();
throw new LayerException(sprintf(__("주문 %s 건의 우체국 택배 배송상태를 수동 업데이트 하였습니다."), $data));
break;
 
Controller/Admin/Order/PostRequestController.php+62-43
변경 전PostRequestController.php
<?php
/**
* This is commercial software, only users who have purchased a valid license
* and accept to the terms of the License Agreement can install and use this
* program.
*
* Do not edit or add to this file if you wish to upgrade Godomall5 to newer
* versions in the future.
*
* @copyright ⓒ 2016, NHN godo: Corp.
* @link http://www.godo.co.kr
*/
namespace Bundle\Controller\Admin\Order;
use Globals;
use Request;
class PostRequestController extends \Controller\Admin\Controller
{
/**
* 우체국택배연동 가입
*
* @author atomyang
* @version 1.0
* @since 1.0
* @copyright ⓒ 2016, NHN godo: Corp.
* @param array $get
* @param array $post
* @param array $files
* @throws Except
*/
public function index()
{
// --- 메뉴 설정
$this->callMenu('order', 'epostParcel', 'request');
// --- 관리자 디자인 템플릿
$gLicense = Globals::get('gLicense');
$this->setData('shopSno', $gLicense['godosno']);
$this->setData('domainUrl', Request::getHostNoPort());
}
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
변경 후PostRequestController.php
<?php
 
/**
* This is commercial software, only users who have purchased a valid license
* and accept to the terms of the License Agreement can install and use this
* program.
*
* Do not edit or add to this file if you wish to upgrade Godomall5 to newer
* versions in the future.
*
* @copyright ⓒ 2016, NHN godo: Corp.
* @link http://www.godo.co.kr
*/
namespace Bundle\Controller\Admin\Order;
 
use Origin\Enum\ApiClient\Epost\EpostUsageRequestStatus;
use Origin\Service\ApiClient\NHNCommerceApi\AdminApi\Epost\EpostUsageAdminApiClientService;
use Throwable;
 
class PostRequestController extends \Controller\Admin\Controller
{
 
/**
* 우체국택배연동 가입
*
* @author atomyang
* @version 1.0
* @since 1.0
* @copyright ⓒ 2016, NHN godo: Corp.
* @param array $get
* @param array $post
* @param array $files
* @throws Except
*/
public function index()
{
// --- 메뉴 설정
$this->callMenu('order', 'epostParcel', 'request');
$this->setMenuCode('order', 'epostParcel', 'request');
 
// 우체국택배 서비스 신청 진행 상태 — 「우체국택배 신청」 항목 상태 텍스트/버튼 분기용
$usageRequestStatus = $this->findUsageRequestStatus();
$this->setData('usageRequestStatus', $usageRequestStatus);
$this->setData('isUsageNone', $usageRequestStatus === EpostUsageRequestStatus::NONE);
}
 
/**
* 신청 진행 상태 조회 — 실패해도 화면은 정상 노출하고 상태 표기만 생략함
*
* @return string|null 진행 단계 코드
*/
protected function findUsageRequestStatus()
{
try {
return \App::getInstance(EpostUsageAdminApiClientService::class)->findUsageRequestStatus();
} catch (Throwable $e) {
\App::getInstance('logger')->channel('epost')->warning('우체국택배 신청 진행 상태 조회 실패 — 상태 표기 생략', ['exception' => $e]);
 
return null;
}
}
}
 
Controller/Admin/Order/PostReserveController.php+3-2
변경 전PostReserveController.php
try {
// --- 메뉴 설정
$this->callMenu('order', 'epostParcel', 'reserve');
 
$godopost= gd_policy('order.godopost');
if(empty($godopost['compdivcd']) === true) {
throw new AlertBackException(__("우체국택배 서비스 신청 후 이용 가능합니다."));
}
 
변경 후PostReserveController.php
try {
// --- 메뉴 설정
$this->callMenu('order', 'epostParcel', 'reserve');
$this->setMenuCode('order', 'epostParcel', 'reserve');
$godoPost = \App::load('\\Component\\Godo\\GodoPostServerApi');
if ($godoPost->isUsageNotRequested()) {
throw new AlertBackException(__("우체국택배 서비스 신청 후 이용 가능합니다."));
}