<?php
|
|
namespace app\api\controller\plus\vip;
|
|
use app\api\controller\Controller;
|
use app\api\model\plus\vip\User as VipUserModel;
|
use app\api\model\plus\vip\Order as VipOrderModel;
|
|
/**
|
* VIP专区订单
|
*/
|
class Order extends Controller
|
{
|
private $user;
|
private $vipUser;
|
|
/**
|
* 构造方法
|
*/
|
public function initialize()
|
{
|
// 用户信息
|
$this->user = $this->getUser();
|
// VIP专区用户信息
|
$this->vipUser = VipUserModel::detail($this->user['user_id']);
|
}
|
|
/**
|
* VIP专区订单列表
|
*/
|
public function lists($type = -1)
|
{
|
if (!$this->vipUser) {
|
return $this->renderError('您还不是VIP用户');
|
}
|
|
$model = new VipOrderModel;
|
return $this->renderSuccess('', [
|
'list' => $model->getList($this->vipUser['user_id'], (int)$type, $this->postData()),
|
]);
|
}
|
|
/**
|
* VIP专区订单统计
|
*/
|
public function statistics()
|
{
|
if (!$this->vipUser) {
|
return $this->renderError('您还不是VIP用户');
|
}
|
|
$statistics = VipOrderModel::getStatistics($this->vipUser['user_id']);
|
return $this->renderSuccess('', $statistics);
|
}
|
|
}
|