diff --git a/shopxo/app/event.php b/shopxo/app/event.php index bf18ce7..7ed04bc 100644 --- a/shopxo/app/event.php +++ b/shopxo/app/event.php @@ -41,6 +41,10 @@ return array ( array ( 0 => 'app\\plugins\\vr_ticket\\hook\\ViewGoodsCss', ), + 'plugins_view_user_various_bottom' => + array ( + 0 => 'app\\plugins\\vr_ticket\\Hook', + ), ), ); ?> \ No newline at end of file diff --git a/shopxo/app/plugins/vr_ticket/Hook.php b/shopxo/app/plugins/vr_ticket/Hook.php index 89df8b9..3bff217 100644 --- a/shopxo/app/plugins/vr_ticket/Hook.php +++ b/shopxo/app/plugins/vr_ticket/Hook.php @@ -1,6 +1,9 @@ wallet(); + } + + /** + * 票夹页面 + * + * URL: ?s=plugins/index&pluginsname=vr_ticket&pluginscontrol=index&pluginsaction=wallet + * + * @return string + */ + public function wallet() + { + // 用 ShopXO 标准方式获取登录用户(session key = 'user_login_info') + $user = UserService::LoginUserInfo(); + if (empty($user)) { + // 未登录,重定向到登录页 + return redirect(MyUrl('index/user/logininfo')); + } + + // 渲染票夹页面 + return MyView('../../../plugins/vr_ticket/view/goods/ticket_wallet', [ + 'user' => $user, + ]); + } +} diff --git a/shopxo/app/plugins/vr_ticket/service/AuditService.php b/shopxo/app/plugins/vr_ticket/service/AuditService.php index 1a03105..931c5f6 100644 --- a/shopxo/app/plugins/vr_ticket/service/AuditService.php +++ b/shopxo/app/plugins/vr_ticket/service/AuditService.php @@ -9,6 +9,8 @@ namespace app\plugins\vr_ticket\service; +require_once __DIR__ . '/BaseService.php'; + class AuditService { // ======================== diff --git a/shopxo/app/plugins/vr_ticket/service/SeatSkuService.php b/shopxo/app/plugins/vr_ticket/service/SeatSkuService.php index 149e8b6..0287939 100644 --- a/shopxo/app/plugins/vr_ticket/service/SeatSkuService.php +++ b/shopxo/app/plugins/vr_ticket/service/SeatSkuService.php @@ -18,6 +18,7 @@ namespace app\plugins\vr_ticket\service; use think\facade\Db; +require_once __DIR__ . '/BaseService.php'; class SeatSkuService extends BaseService { diff --git a/shopxo/app/plugins/vr_ticket/service/WalletService.php b/shopxo/app/plugins/vr_ticket/service/WalletService.php index 6fc3a71..df764b8 100644 --- a/shopxo/app/plugins/vr_ticket/service/WalletService.php +++ b/shopxo/app/plugins/vr_ticket/service/WalletService.php @@ -12,6 +12,8 @@ namespace app\plugins\vr_ticket\service; +require_once __DIR__ . '/BaseService.php'; + class WalletService extends BaseService { /** @@ -85,7 +87,8 @@ class WalletService extends BaseService 'id' => $ticket['id'], 'goods_id' => $ticket['goods_id'], 'goods_title' => $goodsMap[$ticket['goods_id']] ?? '已下架商品', - 'seat_info' => $ticket['seat_info'] ?? '', + 'seat_info' => $ticket['seat_info'] ?? '', // 完整 5 维(保留) + 'seat_number' => self::parseSeatNumber($ticket['seat_info'] ?? ''), // 仅座位号 'session_time' => $seatInfo['session'] ?? '', 'venue_name' => $seatInfo['venue'] ?? '', 'real_name' => $ticket['real_name'] ?? '', @@ -93,12 +96,25 @@ class WalletService extends BaseService 'verify_status' => $ticket['verify_status'], 'issued_at' => $ticket['issued_at'], 'short_code' => $shortCode, + 'seat_number' => self::parseSeatNumber($ticket['seat_info'] ?? ''), ]; } return $result; } + /** + * 提取座位号(seat_info 最后一个 | 分段) + * @param string $seatInfo 完整 5 维坐席信息 + * @return string 仅座位号 + */ + public static function parseSeatNumber(string $seatInfo): string + { + if (empty($seatInfo)) return ''; + $parts = explode('|', $seatInfo); + return end($parts) ?: ''; + } + /** * 获取票详情 * @@ -160,6 +176,7 @@ class WalletService extends BaseService 'verify_time' => $ticket['verify_time'] ?? 0, 'issued_at' => $ticket['issued_at'], 'short_code' => $shortCode, + 'seat_number' => self::parseSeatNumber($ticket['seat_info'] ?? ''), 'qr_payload' => $qrData['payload'], 'qr_expires_at' => $qrData['expires_at'], 'qr_expires_in' => $qrData['expires_in'], diff --git a/shopxo/app/plugins/vr_ticket/view/goods/ticket_card.html b/shopxo/app/plugins/vr_ticket/view/goods/ticket_card.html index 067dc96..dc4af9a 100644 --- a/shopxo/app/plugins/vr_ticket/view/goods/ticket_card.html +++ b/shopxo/app/plugins/vr_ticket/view/goods/ticket_card.html @@ -236,7 +236,7 @@
💺 - {{seat_info}} + {{seat_number}}
👤 @@ -273,7 +273,7 @@ * 3. 调用 VrTicketWallet.loadTickets() 加载票列表 */ var VrTicketWallet = (function() { - var apiBase = '?s=api/plugins/index&pluginsname=vr_ticket&pluginscontrol=ticket&pluginsaction='; + var apiBase = '/api.php?s=plugins/index&pluginsname=vr_ticket&pluginscontrol=ticket&pluginsaction='; var token = ''; var tickets = []; var currentTicket = null; @@ -436,6 +436,7 @@ var VrTicketWallet = (function() { '
' + '
短码(人工核销)
' + '
' + escapeHtml(ticket.short_code) + '
' + + '' + '
' + '
' + '
状态
' + @@ -451,7 +452,7 @@ var VrTicketWallet = (function() { '
' + '
' + '
座位
' + - '
' + escapeHtml(ticket.seat_info) + '
' + + '
' + escapeHtml(ticket.seat_number) + '
' + '
' + '
' + '
观演人
' + @@ -485,6 +486,7 @@ var VrTicketWallet = (function() { '
' + '
短码(人工核销)
' + '
' + escapeHtml(ticket.short_code) + '
' + + '' + '
' + verifiedBadge + '
' + @@ -497,7 +499,7 @@ var VrTicketWallet = (function() { '
' + '
' + '
座位
' + - '
' + escapeHtml(ticket.seat_info) + '
' + + '
' + escapeHtml(ticket.seat_number) + '
' + '
' + '
' + '
观演人
' + @@ -508,6 +510,7 @@ var VrTicketWallet = (function() { // 渲染 QR 码 if (ticket.qr_payload) { renderQrCode(ticket.qr_payload, ticket.qr_expires_in); + try { var bc = document.getElementById('vrBarcodeCanvas'); if (bc && ticket.short_code) { JsBarcode(bc, ticket.short_code, {format:'CODE128', width:2, height:60, displayValue:true, fontSize:14, margin:5}); } } catch(e){} } else { document.getElementById('vrQrcodeBox').innerHTML = '
QR加载中...
'; } @@ -555,6 +558,7 @@ var VrTicketWallet = (function() { })); renderQrCode(ticket.qr_payload, expiresIn); + try { var bc = document.getElementById('vrBarcodeCanvas'); if (bc && ticket.short_code) { JsBarcode(bc, ticket.short_code, {format:'CODE128', width:2, height:60, displayValue:true, fontSize:14, margin:5}); } } catch(e){} } }, error: function() { @@ -622,6 +626,7 @@ var VrTicketWallet = (function() { // 重新渲染 QR renderQrCode(ticket.qr_payload, ticket.qr_expires_in); + try { var bc = document.getElementById('vrBarcodeCanvas'); if (bc && ticket.short_code) { JsBarcode(bc, ticket.short_code, {format:'CODE128', width:2, height:60, displayValue:true, fontSize:14, margin:5}); } } catch(e){} if (btn) { btn.textContent = '已刷新'; diff --git a/shopxo/app/plugins/vr_ticket/view/goods/ticket_wallet.html b/shopxo/app/plugins/vr_ticket/view/goods/ticket_wallet.html index a4ec2a2..ff7b870 100644 --- a/shopxo/app/plugins/vr_ticket/view/goods/ticket_wallet.html +++ b/shopxo/app/plugins/vr_ticket/view/goods/ticket_wallet.html @@ -33,6 +33,7 @@ +