<?php

namespace app\controller\api;

use app\model\User;
use support\Request;

use App\Utils\ApiResponse;

use App\model\Carousel;
use App\model\Project;
use App\model\ProjectDetailed;
use App\model\ProjectRegister;
use App\model\Carouselad;
use App\model\VipLevel;
use App\Utils\ApiResponseApp;
use Tinywan\Jwt\JwtToken;

use hg\apidoc\annotation as Apidoc;
use support\Db;

/**
 * @Apidoc\Title("用户vip控制器")
 */

class Vip_salaryController
{
    protected $noNeedLogin = ['get_project', 'get_projectdetailed', 'get_mechanism_list'];
    /**
     * @Apidoc\Title("1.0 获取当前用户vip等级")
     * @Apidoc\Url("api/vip_salary/product")
     * @Apidoc\Method("POST")
     */
    public function user_count(Request $request)
    {
        $user_id = $request->data['id'];
        $user = User::find($user_id);
        return ApiResponseApp::success(['user_count' => $user->vip_id]);
    }
    /**
     * @Apidoc\Title("1.0 获取vip等级赠送积分")
     * @Apidoc\Url("api/vip_salary/product")
     * @Apidoc\Method("POST")
     */
    public function product(Request $request)
    {
        $res = VipLevel::all();
        return ApiResponseApp::success($res);
    }

    /**
     * @Apidoc\Title("1.0 获取vip等级赠送积分")
     * @Apidoc\Url("api/vip_salary/check_status")
     * @Apidoc\Method("POST")
     */
    public function  check_status(Request $request)
    {
        $data = [
            [
                "vip_id" => 1,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 5
            ],
            [
                "vip_id" => 2,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 100
            ],
            [
                "vip_id" => 3,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 1000
            ],
            [
                "vip_id" => 4,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 2000
            ]
        ];
        return ApiResponseApp::success($data);
    }
}
