File manager - Edit - /home/webapp69.cm.in.th/u69319090028/Shop/app/Controllers/SellerReviewController.php
Back
<?php /** * SellerReviewController * Handles Review Monitoring in Seller Center (Read-only as required by rules) */ require_once __DIR__ . '/../Core/Controller.php'; require_once __DIR__ . '/../Services/ReviewService.php'; require_once __DIR__ . '/../Services/StoreService.php'; require_once __DIR__ . '/../Services/SellerProductService.php'; require_once __DIR__ . '/../Helpers/Auth.php'; require_once __DIR__ . '/../Helpers/Session.php'; require_once __DIR__ . '/../Helpers/Url.php'; class SellerReviewController extends Controller { private ReviewService $reviewService; private StoreService $storeService; private SellerProductService $productService; public function __construct() { $this->reviewService = new ReviewService(); $this->storeService = new StoreService(); $this->productService = new SellerProductService(); } /** * GET /seller/reviews * Seller Center Reviews Hub */ public function index(): void { $userId = Auth::id(); $store = $this->storeService->getStoreByUserId($userId); if (!$store) { Session::setFlash('warning', 'กรุณาสมัครเปิดร้านค้าก่อนเข้าสู่ศูนย์ผู้ขาย'); $this->redirect('/seller/register'); return; } $storeId = (int)$store['id']; $filters = [ 'rating' => !empty($_GET['rating']) ? (int)$_GET['rating'] : 0, 'product_id' => !empty($_GET['product_id']) ? (int)$_GET['product_id'] : 0, 'q' => trim($_GET['q'] ?? '') ]; $page = max(1, (int)($_GET['page'] ?? 1)); $data = $this->reviewService->getStoreReviews($storeId, $filters, $page, 20); // Fetch store products for filter dropdown $productModel = new Product(); $products = $productModel->getSellerProducts($storeId, [], 100, 0); $this->render('seller/reviews/index', [ 'reviews' => $data['reviews'], 'summary' => $data['summary'], 'totalCount' => $data['total_count'], 'totalPages' => $data['total_pages'], 'currentPage' => $data['page'], 'filters' => $filters, 'products' => $products, 'store' => $store, 'activeNav' => 'reviews', 'pageTitle' => 'รีวิวสินค้าจากลูกค้า - Seller Center' ], 'seller'); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.24 |
proxy
|
phpinfo
|
Settings