fix(ecommerce,board,tosspayments,pay_kginicis,pay_nhnkcp,pay_nicepayments,core,basic): 공개 이슈 잔여 결함 5건 해소 — 상점 주소 SSoT·게시판 계약/안내/상한/색인
공개 이슈(gnuboard/g7) 17건 전수 대조에서 "진짜 누락"으로 판정된 5건을 해소한다.
— 서버가 만들어 내보내는 상점 주소가 각 지점에서 `/shop` 리터럴이나
`"/{$routePath}/..."` 조립으로 흩어져 있었다. 기본값이 아닌 상점에서는 그 주소가
존재하지 않는 화면을 가리키는데, 서버는 문자열을 만들어 내려보냈을 뿐이라 예외도
404 로그도 남지 않는다 — 링크만 조용히 죽는다. `ShopPathResolver` 를 단일 해석
지점으로 두고 주문 완료 이동·비회원 조회 안내·알림 메일·통합검색·상품문의·SEO
캐시·사이트맵 전 지점을 경유시켰다. 같은 값에 종속된 PG 4종 리다이렉트는
`{shopBase}` 자리표시자로, 편집기 상태 scope 는 선택 세그먼트 토큰 `/*?`
(engine-v1.58.0)로 해소했다. 기설치본은 업그레이드 스텝이 백필한다.
M-02 — 답변 깊이 상한이 config 는 1~10 인데 컬럼 comment 만 1~5 로 남아,
comment 에서 자동 생성되는 계약 문서 4곳이 실제보다 좁은 상한을 공개하고 있었다.
L-01 — 관리자 게시글 폼에 첨부 안내가 아예 없었고, 대신 사장된 고정 문구
("최대 5개 파일, 각 10MB")가 남아 있었다. 게시판마다 다른 실제 설정값을 렌더한다.
— 목록 1페이지가 공지 전량을 상한 없이 읽던 것에 안전상한을 두고(구조 무변경,
limit 부가만), 조회수 정렬 목록 술어를 덮는 복합 색인을 신설했다.
브라우저 실측 검수에서 발견한 사전 결함 1건(사용자 게시판 목록이 URL 정렬
파라미터를 데이터소스로 전달하지 않던 문제)도 함께 고쳤다. 폴백을 빈 문자열로 둬
URL 에 정렬이 없을 때 게시판 설정을 덮어쓰지 않게 했다.
This commit is contained in:
1 parent
3715be5e51
commit
f9c4c025cb
138 files changed
+3907
-361
No files matched your search
@@ -26,6 +26,7 @@ use Modules\Sirsoft\Ecommerce\Services\OrderService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\StockService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\TempOrderService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\UserAddressService;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* 주문 공유 컨트롤러 (회원/비회원 공용 + 비회원 토큰 후속 액션)
|
||||
@@ -193,7 +194,9 @@ class OrderController extends PublicBaseController
|
||||
return ResponseHelper::error(
|
||||
'sirsoft-ecommerce::exceptions.order_not_found',
|
||||
404,
|
||||
['redirect_to' => '/shop/guest/orders']
|
||||
// 상점 주소 설정(route_path/no_route)을 반영해야 주소를 바꾼 상점에서도
|
||||
// 실제 존재하는 비회원 조회 화면으로 안내된다 (공개 #85).
|
||||
['redirect_to' => ShopPathResolver::path('guest/orders')]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -19,6 +19,7 @@ use Modules\Sirsoft\Ecommerce\Models\Order;
|
||||
use Modules\Sirsoft\Ecommerce\Models\TempOrder;
|
||||
use Modules\Sirsoft\Ecommerce\Services\CurrencyConversionService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\EcommerceSettingsService;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* 주문 생성 공통 흐름 Trait
|
||||
@@ -218,7 +219,9 @@ trait HandlesOrderCreation
|
||||
{
|
||||
$responseData = [
|
||||
'order' => $orderResource,
|
||||
'redirect_url' => "/shop/orders/{$order->order_number}/complete",
|
||||
// 상점 주소는 운영자 설정이다 — 기본값 리터럴을 내려보내면 주소를 바꾼 상점에서
|
||||
// 결제를 마친 손님이 존재하지 않는 화면으로 이동한다 (공개 #85).
|
||||
'redirect_url' => ShopPathResolver::path("orders/{$order->order_number}/complete"),
|
||||
'requires_pg_payment' => $requiresPg,
|
||||
];
|
||||
|
||||
|
||||
+6
-3
@@ -11,6 +11,7 @@ use Modules\Sirsoft\Ecommerce\Models\ProductInquiry;
|
||||
use Modules\Sirsoft\Ecommerce\Module;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\OrderCancelRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Services\CurrencyConversionService;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* 이커머스 알림 데이터 필터 리스너
|
||||
@@ -418,16 +419,18 @@ class EcommerceNotificationDataListener implements HookListenerInterface
|
||||
// ──────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* 비회원 주문 조회 화면 경로
|
||||
* 비회원 주문 조회 화면의 기준 경로 (상점 주소 설정 하위)
|
||||
*
|
||||
* 후속 이메일 발송 이슈가 비회원 주문 조회 URL을 만들 때 사용하는 경로 기준이다.
|
||||
* 비회원 본인 확인은 주문번호 + 전화번호 + 조회 비밀번호 입력을 전제로 하므로
|
||||
* 주문번호를 쿼리에 노출하지 않고 순수 경로만 제공한다.
|
||||
*
|
||||
* 앞의 상점 주소는 운영자 설정이므로 ShopPathResolver 가 붙인다 — 상수로 `/shop` 을
|
||||
* 박아 두면 주소를 바꾼 상점의 안내 메일이 존재하지 않는 화면을 가리킨다 (공개 #85).
|
||||
* 경로는 비회원 주문 조회 라우트(templates/sirsoft-basic/routes.json) 및
|
||||
* OrderController::showByOrderNumber 의 비회원 redirect_to 와 동일하게 유지한다.
|
||||
*/
|
||||
private const GUEST_ORDER_LOOKUP_PATH = '/shop/guest/orders';
|
||||
private const GUEST_ORDER_LOOKUP_SUFFIX = 'guest/orders';
|
||||
|
||||
/**
|
||||
* 주문 알림 데이터 배열을 구성합니다.
|
||||
@@ -445,7 +448,7 @@ class EcommerceNotificationDataListener implements HookListenerInterface
|
||||
|
||||
if ($order->isGuestOrder()) {
|
||||
$name = $order->getOrdererName() ?? '';
|
||||
$orderUrl = "{$baseUrl}".self::GUEST_ORDER_LOOKUP_PATH;
|
||||
$orderUrl = "{$baseUrl}".ShopPathResolver::path(self::GUEST_ORDER_LOOKUP_SUFFIX);
|
||||
} else {
|
||||
$name = $order->user?->name ?? '';
|
||||
$orderUrl = "{$baseUrl}/mypage/orders/{$order->order_number}";
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Support\Query\BoundedCount;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\Traits\HasMultiCurrencyPrices;
|
||||
use Modules\Sirsoft\Ecommerce\Services\ProductService;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* 통합 검색에 상품 검색 결과를 제공하는 리스너
|
||||
@@ -268,7 +269,8 @@ class SearchProductsListener implements HookListenerInterface
|
||||
'multi_currency_selling_price' => $this->buildMultiCurrencyPrices($product->selling_price),
|
||||
'multi_currency_list_price' => $this->buildMultiCurrencyPrices($product->list_price),
|
||||
'labels' => $labels,
|
||||
'url' => '/shop/products/'.$product->product_code,
|
||||
// 상점 주소는 운영자 설정 — 기본값 리터럴은 주소를 바꾼 상점에서 죽은 링크가 된다 (공개 #85)
|
||||
'url' => ShopPathResolver::path('products/'.$product->product_code),
|
||||
'review_count' => (int) ($product->review_count ?? 0),
|
||||
'rating_avg' => $product->rating_avg !== null ? round((float) $product->rating_avg, 1) : 0.0,
|
||||
];
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Jobs\GenerateSitemapJob;
|
||||
use App\Seo\Contracts\SeoCacheManagerInterface;
|
||||
use App\Seo\SitemapIndexer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* 카테고리 변경 시 SEO 캐시 무효화 리스너
|
||||
@@ -142,9 +143,8 @@ class SeoCategoryCacheListener implements HookListenerInterface
|
||||
&& (bool) g7_module_settings('sirsoft-ecommerce', 'seo.seo_category', true);
|
||||
|
||||
if ($visible) {
|
||||
$routePath = g7_module_settings('sirsoft-ecommerce', 'basic_info.route_path', 'shop');
|
||||
$indexer->indexResource('category', $category->id, 'sirsoft-ecommerce', [[
|
||||
'url' => "/{$routePath}/category/{$category->slug}",
|
||||
'url' => ShopPathResolver::path("category/{$category->slug}"),
|
||||
'lastmod' => $category->updated_at?->toW3cString(),
|
||||
'changefreq' => SitemapChangeFreq::Weekly->value,
|
||||
'priority' => 0.6,
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Seo\SeoCacheRegenerator;
|
||||
use App\Seo\SitemapIndexer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Sirsoft\Ecommerce\Enums\ProductDisplayStatus;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* 상품 변경 시 SEO 캐시 무효화 리스너
|
||||
@@ -160,9 +161,8 @@ class SeoProductCacheListener implements HookListenerInterface
|
||||
&& (bool) g7_module_settings('sirsoft-ecommerce', 'seo.seo_product_detail', true);
|
||||
|
||||
if ($visible) {
|
||||
$routePath = g7_module_settings('sirsoft-ecommerce', 'basic_info.route_path', 'shop');
|
||||
$indexer->indexResource('product', $product->id, 'sirsoft-ecommerce', [[
|
||||
'url' => "/{$routePath}/products/{$product->id}",
|
||||
'url' => ShopPathResolver::path("products/{$product->id}"),
|
||||
'lastmod' => $product->updated_at?->toW3cString(),
|
||||
'changefreq' => SitemapChangeFreq::Weekly->value,
|
||||
'priority' => 0.8,
|
||||
@@ -184,8 +184,8 @@ class SeoProductCacheListener implements HookListenerInterface
|
||||
/**
|
||||
* 상품 상세 페이지의 SEO 캐시를 즉시 재생성합니다.
|
||||
*
|
||||
* URL 구성: /{route_path}/products/{id}
|
||||
* route_path는 이커머스 모듈 설정에서 조회합니다.
|
||||
* URL 구성: {상점 기준 경로}/products/{id}
|
||||
* 기준 경로는 상점 주소 설정(route_path / no_route)을 ShopPathResolver 가 해석한 값입니다.
|
||||
*
|
||||
* @param array $args 훅 인자 배열
|
||||
*/
|
||||
@@ -199,8 +199,7 @@ class SeoProductCacheListener implements HookListenerInterface
|
||||
|
||||
try {
|
||||
$regenerator = app(SeoCacheRegenerator::class);
|
||||
$routePath = g7_module_settings('sirsoft-ecommerce', 'basic_info.route_path', 'shop');
|
||||
$url = "/{$routePath}/products/{$product->id}";
|
||||
$url = ShopPathResolver::path("products/{$product->id}");
|
||||
$regenerator->renderAndCache($url);
|
||||
|
||||
Log::debug('[SEO] Product detail cache regenerated', [
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Seo\AbstractSitemapContributor;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\CategoryRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\ProductRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* Ecommerce 모듈 Sitemap 기여자
|
||||
@@ -74,12 +75,12 @@ class EcommerceSitemapContributor extends AbstractSitemapContributor
|
||||
*/
|
||||
private function collectUrls(): iterable
|
||||
{
|
||||
$routePath = g7_module_settings('sirsoft-ecommerce', 'basic_info.route_path') ?? 'shop';
|
||||
|
||||
// 상점 주소 설정(route_path / no_route)을 반영한다 — 주소를 바꾼 상점의 사이트맵이
|
||||
// 기본값 주소를 싣고 나가면 검색엔진이 존재하지 않는 URL 을 수집한다 (공개 #85).
|
||||
// 상품 목록 페이지 — 'SEO 제공 페이지' 토글 OFF 시 제외
|
||||
if ((bool) g7_module_settings('sirsoft-ecommerce', 'seo.seo_shop_index', true)) {
|
||||
yield [
|
||||
'url' => "/{$routePath}/products",
|
||||
'url' => ShopPathResolver::path('products'),
|
||||
'changefreq' => SitemapChangeFreq::Daily->value,
|
||||
'priority' => 0.7,
|
||||
'resource_type' => 'shop_index',
|
||||
@@ -91,7 +92,7 @@ class EcommerceSitemapContributor extends AbstractSitemapContributor
|
||||
if ((bool) g7_module_settings('sirsoft-ecommerce', 'seo.seo_category', true)) {
|
||||
foreach ($this->categoryRepository->streamActiveForSitemap() as $category) {
|
||||
yield [
|
||||
'url' => "/{$routePath}/category/{$category->slug}",
|
||||
'url' => ShopPathResolver::path("category/{$category->slug}"),
|
||||
'lastmod' => $category->updated_at?->toW3cString(),
|
||||
'changefreq' => SitemapChangeFreq::Weekly->value,
|
||||
'priority' => 0.6,
|
||||
@@ -105,7 +106,7 @@ class EcommerceSitemapContributor extends AbstractSitemapContributor
|
||||
if ((bool) g7_module_settings('sirsoft-ecommerce', 'seo.seo_product_detail', true)) {
|
||||
foreach ($this->productRepository->streamVisibleForSitemap() as $product) {
|
||||
yield [
|
||||
'url' => "/{$routePath}/products/{$product->id}",
|
||||
'url' => ShopPathResolver::path("products/{$product->id}"),
|
||||
'lastmod' => $product->updated_at?->toW3cString(),
|
||||
'changefreq' => SitemapChangeFreq::Weekly->value,
|
||||
'priority' => 0.8,
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
|
||||
namespace Modules\Sirsoft\Ecommerce\Services;
|
||||
|
||||
use App\Contracts\Repositories\UserRepositoryInterface;
|
||||
use App\Extension\HookManager;
|
||||
use App\Helpers\PermissionHelper;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Sirsoft\Ecommerce\Models\ProductInquiry;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\ProductInquiryRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\ProductRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShopPathResolver;
|
||||
|
||||
/**
|
||||
* 상품 1:1 문의 서비스
|
||||
@@ -26,11 +28,13 @@ class ProductInquiryService
|
||||
* @param ProductInquiryRepositoryInterface $repository 문의 리포지토리
|
||||
* @param ProductRepositoryInterface $productRepository 상품 리포지토리
|
||||
* @param EcommerceSettingsService $settingsService 이커머스 설정 서비스
|
||||
* @param UserRepositoryInterface $userRepository 사용자 리포지토리 (작성자 이름 배치 조회)
|
||||
*/
|
||||
public function __construct(
|
||||
protected ProductInquiryRepositoryInterface $repository,
|
||||
protected ProductRepositoryInterface $productRepository,
|
||||
protected EcommerceSettingsService $settingsService
|
||||
protected EcommerceSettingsService $settingsService,
|
||||
protected UserRepositoryInterface $userRepository
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -63,13 +67,13 @@ class ProductInquiryService
|
||||
if (! $boardSlug) {
|
||||
return [
|
||||
'items' => [],
|
||||
'meta' => [
|
||||
'board_settings' => $this->defaultBoardSettings(),
|
||||
'meta' => [
|
||||
'board_settings' => $this->defaultBoardSettings(),
|
||||
'inquiry_available' => false,
|
||||
'total' => 0,
|
||||
'current_page' => $page,
|
||||
'per_page' => $perPage,
|
||||
'last_page' => 1,
|
||||
'total' => 0,
|
||||
'current_page' => $page,
|
||||
'per_page' => $perPage,
|
||||
'last_page' => 1,
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -118,7 +122,7 @@ class ProductInquiryService
|
||||
// user_id 일괄 조회 (N+1 방지)
|
||||
$userIds = $pagePivots->map(fn ($pivot) => $posts[$pivot->inquirable_id]['user_id'] ?? null)
|
||||
->filter()->unique()->values()->all();
|
||||
$userMap = User::whereIn('id', $userIds)->pluck('name', 'id');
|
||||
$userMap = $this->userRepository->getNamesByIds($userIds);
|
||||
|
||||
$items = $pagePivots->map(function ($pivot) use ($posts, $currentUserId, $userMap) {
|
||||
$post = $posts[$pivot->inquirable_id] ?? null;
|
||||
@@ -128,19 +132,19 @@ class ProductInquiryService
|
||||
$name = $userId ? ($userMap[$userId] ?? $post['author_name'] ?? null) : ($post['author_name'] ?? null);
|
||||
|
||||
return [
|
||||
'id' => $pivot->id,
|
||||
'post_id' => $pivot->inquirable_id,
|
||||
'user_id' => $userId,
|
||||
'id' => $pivot->id,
|
||||
'post_id' => $pivot->inquirable_id,
|
||||
'user_id' => $userId,
|
||||
'author_name' => $this->maskAuthorName($name),
|
||||
'title' => $post['title'] ?? null,
|
||||
'category' => $post['category'] ?? null,
|
||||
'content' => $post['content'] ?? null,
|
||||
'is_secret' => $post['is_secret'] ?? false,
|
||||
'is_owner' => $isOwner,
|
||||
'title' => $post['title'] ?? null,
|
||||
'category' => $post['category'] ?? null,
|
||||
'content' => $post['content'] ?? null,
|
||||
'is_secret' => $post['is_secret'] ?? false,
|
||||
'is_owner' => $isOwner,
|
||||
'is_answered' => $pivot->is_answered ?? false,
|
||||
'answered_at' => $pivot->answered_at?->toIso8601String(),
|
||||
'created_at' => $pivot->created_at?->toIso8601String(),
|
||||
'reply' => $post['reply'] ?? null,
|
||||
'created_at' => $pivot->created_at?->toIso8601String(),
|
||||
'reply' => $post['reply'] ?? null,
|
||||
'attachments' => $post['attachments'] ?? [],
|
||||
];
|
||||
})->values()->all();
|
||||
@@ -149,14 +153,14 @@ class ProductInquiryService
|
||||
|
||||
return [
|
||||
'items' => $items,
|
||||
'meta' => [
|
||||
'board_settings' => $boardSettings,
|
||||
'meta' => [
|
||||
'board_settings' => $boardSettings,
|
||||
'inquiry_available' => (bool) $boardSlug,
|
||||
'current_page' => $page,
|
||||
'per_page' => $perPage,
|
||||
'total' => $total,
|
||||
'last_page' => max(1, $lastPage),
|
||||
'abilities' => [
|
||||
'current_page' => $page,
|
||||
'per_page' => $perPage,
|
||||
'total' => $total,
|
||||
'last_page' => max(1, $lastPage),
|
||||
'abilities' => [
|
||||
'can_update' => PermissionHelper::check('sirsoft-ecommerce.inquiries.update', Auth::user()),
|
||||
'can_delete' => PermissionHelper::check('sirsoft-ecommerce.inquiries.delete', Auth::user()),
|
||||
],
|
||||
@@ -172,14 +176,14 @@ class ProductInquiryService
|
||||
private function defaultBoardSettings(): array
|
||||
{
|
||||
return [
|
||||
'secret_mode' => 'disabled',
|
||||
'categories' => [],
|
||||
'use_file_upload' => false,
|
||||
'max_file_count' => 5,
|
||||
'max_file_size' => 10485760,
|
||||
'secret_mode' => 'disabled',
|
||||
'categories' => [],
|
||||
'use_file_upload' => false,
|
||||
'max_file_count' => 5,
|
||||
'max_file_size' => 10485760,
|
||||
'allowed_extensions' => [],
|
||||
'min_title_length' => 2,
|
||||
'max_title_length' => 200,
|
||||
'min_title_length' => 2,
|
||||
'max_title_length' => 200,
|
||||
'min_content_length' => 10,
|
||||
'max_content_length' => 10000,
|
||||
];
|
||||
@@ -209,7 +213,7 @@ class ProductInquiryService
|
||||
$product = $this->productRepository->find($productId);
|
||||
|
||||
if (! $product) {
|
||||
throw new \Illuminate\Database\Eloquent\ModelNotFoundException(
|
||||
throw new ModelNotFoundException(
|
||||
__('sirsoft-ecommerce::messages.products.not_found')
|
||||
);
|
||||
}
|
||||
@@ -312,41 +316,42 @@ class ProductInquiryService
|
||||
$post = $posts[$inquiry->inquirable_id] ?? null;
|
||||
|
||||
return [
|
||||
'id' => $inquiry->id,
|
||||
'product_id' => $inquiry->product_id,
|
||||
'product' => $inquiry->product ? [
|
||||
'id' => $inquiry->product->id,
|
||||
'product_code' => $inquiry->product->product_code,
|
||||
'name' => $inquiry->product->getLocalizedName(),
|
||||
'id' => $inquiry->id,
|
||||
'product_id' => $inquiry->product_id,
|
||||
'product' => $inquiry->product ? [
|
||||
'id' => $inquiry->product->id,
|
||||
'product_code' => $inquiry->product->product_code,
|
||||
'name' => $inquiry->product->getLocalizedName(),
|
||||
'thumbnail_url' => $inquiry->product->getThumbnailUrl(),
|
||||
'url' => '/' . ltrim($this->settingsService->getSetting('basic_info.route_path', 'shop'), '/') . '/products/' . $inquiry->product->product_code,
|
||||
// 주소 없이 운영하는 상점(no_route)까지 반영해야 실제 상품 화면을 가리킨다 (공개 #85)
|
||||
'url' => ShopPathResolver::path('products/'.$inquiry->product->product_code),
|
||||
] : null,
|
||||
'product_name' => $this->localizeProductName($inquiry->product_name_snapshot),
|
||||
'is_answered' => $inquiry->is_answered,
|
||||
'answered_at' => $inquiry->answered_at?->toIso8601String(),
|
||||
'created_at' => $inquiry->created_at?->toIso8601String(),
|
||||
'updated_at' => $inquiry->updated_at?->toIso8601String(),
|
||||
'product_name' => $this->localizeProductName($inquiry->product_name_snapshot),
|
||||
'is_answered' => $inquiry->is_answered,
|
||||
'answered_at' => $inquiry->answered_at?->toIso8601String(),
|
||||
'created_at' => $inquiry->created_at?->toIso8601String(),
|
||||
'updated_at' => $inquiry->updated_at?->toIso8601String(),
|
||||
// 게시판 Post 데이터 (게시판 미연동 시 null)
|
||||
'title' => $post['title'] ?? null,
|
||||
'category' => $post['category'] ?? null,
|
||||
'content' => $post['content'] ?? null,
|
||||
'is_secret' => $post['is_secret'] ?? false,
|
||||
'reply' => $post['reply'] ?? null,
|
||||
'attachments' => $post['attachments'] ?? [],
|
||||
'title' => $post['title'] ?? null,
|
||||
'category' => $post['category'] ?? null,
|
||||
'content' => $post['content'] ?? null,
|
||||
'is_secret' => $post['is_secret'] ?? false,
|
||||
'reply' => $post['reply'] ?? null,
|
||||
'attachments' => $post['attachments'] ?? [],
|
||||
];
|
||||
})->values()->all();
|
||||
|
||||
return [
|
||||
'items' => $items,
|
||||
'meta' => [
|
||||
'current_page' => $paginator->currentPage(),
|
||||
'per_page' => $paginator->perPage(),
|
||||
'total' => $paginator->total(),
|
||||
'last_page' => $paginator->lastPage(),
|
||||
'from' => $paginator->firstItem(),
|
||||
'to' => $paginator->lastItem(),
|
||||
'meta' => [
|
||||
'current_page' => $paginator->currentPage(),
|
||||
'per_page' => $paginator->perPage(),
|
||||
'total' => $paginator->total(),
|
||||
'last_page' => $paginator->lastPage(),
|
||||
'from' => $paginator->firstItem(),
|
||||
'to' => $paginator->lastItem(),
|
||||
'inquiry_available' => (bool) $boardSlug,
|
||||
'abilities' => [
|
||||
'abilities' => [
|
||||
'can_update' => PermissionHelper::check('sirsoft-ecommerce.inquiries.update', Auth::user()),
|
||||
'can_delete' => PermissionHelper::check('sirsoft-ecommerce.inquiries.delete', Auth::user()),
|
||||
],
|
||||
@@ -394,7 +399,7 @@ class ProductInquiryService
|
||||
|
||||
Log::info('상품 문의 수정 완료', [
|
||||
'inquiry_id' => $inquiryId,
|
||||
'user_id' => Auth::id(),
|
||||
'user_id' => Auth::id(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -442,7 +447,7 @@ class ProductInquiryService
|
||||
|
||||
Log::info('상품 문의 삭제 완료', [
|
||||
'inquiry_id' => $inquiryId,
|
||||
'user_id' => Auth::id(),
|
||||
'user_id' => Auth::id(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sirsoft\Ecommerce\Support;
|
||||
|
||||
/**
|
||||
* 상점 화면 경로의 SSoT.
|
||||
*
|
||||
* 상점 주소는 운영자 설정이다 — `basic_info.route_path` 로 바꿀 수 있고,
|
||||
* `basic_info.no_route` 를 켜면 주소 세그먼트 없이 루트에 붙는다. 그런데 서버가
|
||||
* 만들어 내보내는 상점 주소(주문 완료 이동 · 비회원 주문 조회 안내 · 알림 메일의
|
||||
* 주문 조회 링크 · 통합검색 결과 링크 · 사이트맵/SEO 캐시 URL)는 각 지점에서
|
||||
* `/shop` 리터럴이나 `"/{$routePath}/..."` 조립으로 흩어져 있었다.
|
||||
*
|
||||
* 기본값이 아닌 상점에서는 그 주소가 존재하지 않는 페이지를 가리키는데, 서버는
|
||||
* 문자열을 만들어 내려보냈을 뿐이라 예외도 로그도 남지 않는다. 링크만 조용히 죽는다.
|
||||
*
|
||||
* 설정 접근은 `g7_module_settings()` 로 고정한다. 매 요청 부팅 시 적재된 배열을 읽으므로
|
||||
* 파일 I/O 가 없고, 테스트에서 `Config::set('g7_settings.modules.*')` 로 축을 주입할 수 있다.
|
||||
*
|
||||
* ## 공개 계약 (다른 확장이 소비한다)
|
||||
*
|
||||
* 상점 주소가 필요한 확장은 자체 계산을 두지 말고 이 클래스를 거친다. 결제 플러그인
|
||||
* 4종(tosspayments / pay_kginicis / pay_nhnkcp / pay_nicepayments)이 결제 완료·실패
|
||||
* 리다이렉트 주소를 만들 때 `base()` 를 호출한다. 같은 계산이 여러 벌로 흩어지면
|
||||
* 주소 규칙이 바뀔 때 한 곳을 빠뜨리게 되고, 그 확장에서만 링크가 조용히 죽는다.
|
||||
*
|
||||
* 소비 확장은 `plugin.json` / `module.json` 의 `dependencies.modules.sirsoft-ecommerce`
|
||||
* 를 이 계약이 도입된 `>=1.1.0` 이상으로 선언해야 한다.
|
||||
*
|
||||
* 시그니처를 바꾸거나 제거할 때는 위 소비 확장을 전수 확인하고 각 확장의 최소 버전
|
||||
* 제약을 함께 올린다 (CLAUDE.md "버전 동기화 의무" ②).
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class ShopPathResolver
|
||||
{
|
||||
/** 상점 주소 설정 키 */
|
||||
public const ROUTE_PATH_KEY = 'basic_info.route_path';
|
||||
|
||||
/** 주소 없이 운영 여부 설정 키 */
|
||||
public const NO_ROUTE_KEY = 'basic_info.no_route';
|
||||
|
||||
/** 기본 상점 주소 (설정 미지정·빈 값 시 폴백) */
|
||||
public const DEFAULT_ROUTE_PATH = 'shop';
|
||||
|
||||
/**
|
||||
* 상점 화면의 기준 경로를 반환합니다.
|
||||
*
|
||||
* `no_route` 가 켜져 있으면 빈 문자열이다 — 상점이 루트에 붙어 있어 앞에 붙일
|
||||
* 세그먼트가 없다는 뜻이며, `path()` 가 이를 이중 슬래시 없이 이어 붙인다.
|
||||
*
|
||||
* @return string 앞에만 슬래시가 붙은 기준 경로 (예: `/shop`), 주소 미사용 시 빈 문자열
|
||||
*/
|
||||
public static function base(): string
|
||||
{
|
||||
if (g7_module_settings('sirsoft-ecommerce', self::NO_ROUTE_KEY)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$routePath = trim((string) g7_module_settings('sirsoft-ecommerce', self::ROUTE_PATH_KEY, self::DEFAULT_ROUTE_PATH), '/');
|
||||
|
||||
return '/'.($routePath !== '' ? $routePath : self::DEFAULT_ROUTE_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* 기준 경로에 하위 경로를 이어 붙인 상점 화면 경로를 반환합니다.
|
||||
*
|
||||
* 슬래시 중복은 한 겹으로 정규화한다 (`no_route` + 앞 슬래시 붙은 하위 경로 조합에서
|
||||
* `//products` 가 만들어지는 것을 막는다). 코어 라우트 해석기가 같은 이유로 같은
|
||||
* 정규화를 수행한다 (`app/Seo/TemplateRouteResolver.php`).
|
||||
*
|
||||
* @param string $suffix 기준 경로 하위의 화면 경로 (앞 슬래시 유무 무관)
|
||||
* @return string 정규화된 상점 화면 경로
|
||||
*/
|
||||
public static function path(string $suffix): string
|
||||
{
|
||||
return (string) preg_replace('#/+#', '/', self::base().'/'.ltrim($suffix, '/'));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user