<?php
namespace app\api\controller\user;

use app\models\system\SystemUserLevel;
use app\models\system\SystemUserTask;
use app\models\user\UserLevel;
use app\Request;

/**
 * 会员等级类
 * Class UserLevelController
 * @package app\api\controller\user
 */
class UserLevelController
{

    /**
     * @api {get} /user/level/detection 检测用户是否可以成为会员
     * @apiName GetUserLevelDetection
     * @apiGroup User.Level
     * 
     */
    public function detection(Request $request)
    {
        return app('json')->successful(UserLevel::setLevelComplete($request->uid()));
    }

    /**
     * @api {get} /user/level/grade 会员等级列表
     * @apiName GetUserLevelGrade
     * @apiGroup User.Level
     * 
     */
    public function grade(Request $request)
    {
        return app('json')->successful(SystemUserLevel::getLevelList($request->uid()));
    }

    /**
     * @api {get} /user/level/task/:id 获取等级任务
     * @apiName GetUserLevelTask
     * @apiGroup User.Level
     * 
     */
    public function task(Request $request, $id)
    {
        return app('json')->successful(SystemUserTask::getTashList($id,$request->uid()));
    }

}