59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
|
|
<?php
|
|||
|
|
/**
|
|||
|
|
* VR票务插件 - C端首页/票夹控制器
|
|||
|
|
*
|
|||
|
|
* 路由机制(PluginsService::PluginsControlCall):
|
|||
|
|
* URL: ?s=plugins/index&pluginsname=vr_ticket&pluginscontrol=index&pluginsaction=wallet
|
|||
|
|
* → pluginsname=vr_ticket, pluginscontrol=index, pluginsaction=wallet
|
|||
|
|
* → class = \app\plugins\vr_ticket\index\Index (ucfirst('index') = 'Index')
|
|||
|
|
* → method = ucfirst('wallet') = 'Wallet'
|
|||
|
|
* → app/plugins/vr_ticket/index/Index.php::Wallet() ✓
|
|||
|
|
*
|
|||
|
|
* @package vr_ticket\index
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
namespace app\plugins\vr_ticket\index;
|
|||
|
|
|
|||
|
|
use app\service\UserService;
|
|||
|
|
|
|||
|
|
class Index
|
|||
|
|
{
|
|||
|
|
/**
|
|||
|
|
* 构造方法
|
|||
|
|
*/
|
|||
|
|
public function __construct()
|
|||
|
|
{
|
|||
|
|
// 初始化检查
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 默认首页(重定向到用户中心或票夹)
|
|||
|
|
*/
|
|||
|
|
public function index()
|
|||
|
|
{
|
|||
|
|
return $this->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,
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
}
|