<?php
|
|
namespace app\api\controller\plus\vip;
|
|
use app\api\controller\Controller;
|
use app\api\model\plus\vip\User as VipUserModel;
|
use app\common\model\plus\vip\Referee as VipRefereeModel;
|
|
/**
|
* VIP团队控制器
|
*/
|
class Team extends Controller
|
{
|
// 用户
|
private $user;
|
// VIP用户
|
private $vip;
|
|
/**
|
* 构造方法
|
*/
|
public function initialize()
|
{
|
// 用户信息
|
$this->user = $this->getUser();
|
// VIP用户信息
|
$this->vip = VipUserModel::detail($this->user['user_id']);
|
}
|
|
/**
|
* 团队列表
|
*/
|
public function lists()
|
{
|
// 判断用户是否是VIP
|
if (!$this->vip || $this->vip['is_delete']) {
|
return $this->renderError('您不是VIP用户');
|
}
|
|
// 获取团队成员列表
|
$model = new VipRefereeModel();
|
$team_list = $model->getList($this->user['user_id']);
|
|
return $this->renderSuccess('', compact('team_list'));
|
}
|
|
/**
|
* 团队统计信息
|
*/
|
public function statistics()
|
{
|
// 判断用户是否是VIP
|
if (!$this->vip || $this->vip['is_delete']) {
|
return $this->renderError('您不是VIP用户');
|
}
|
|
// 获取团队统计信息
|
$statistics = VipRefereeModel::getStatistics($this->user['user_id']);
|
|
return $this->renderSuccess('', compact('statistics'));
|
}
|
}
|