<?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_rewardController
{
    protected $noNeedLogin = [''];


    /**
     * @Apidoc\Title("1.0 获取vip等级赠送积分")
     * @Apidoc\Url("api/vip_reward/product")
     * @Apidoc\Method("POST")
     */
    public function product(Request $request)
    {
        $data = [
            [
                "id" => 1,
                "name" => "1",
                "user_count" => 3,
                "first_amount" => 1500,
                "gift_amount" => 150,
                "createtime" => 0
            ],
            [
                "id" => 2,
                "name" => "2",
                "user_count" => 5,
                "first_amount" => 4000,
                "gift_amount" => 380,
                "createtime" => 0
            ],
            [
                "id" => 3,
                "name" => "3",
                "user_count" => 10,
                "first_amount" => 6000,
                "gift_amount" => 580,
                "createtime" => 0
            ],
            [
                "id" => 4,
                "name" => "4",
                "user_count" => 20,
                "first_amount" => 15000,
                "gift_amount" => 1080,
                "createtime" => 0
            ],
            [
                "id" => 5,
                "name" => "5",
                "user_count" => 40,
                "first_amount" => 40000,
                "gift_amount" => 2080,
                "createtime" => 0
            ],
            [
                "id" => 6,
                "name" => "6",
                "user_count" => 70,
                "first_amount" => 75000,
                "gift_amount" => 3800,
                "createtime" => 0
            ],
            [
                "id" => 7,
                "name" => "7",
                "user_count" => 200,
                "first_amount" => 75000,
                "gift_amount" => 10800,
                "createtime" => 0
            ],
            [
                "id" => 8,
                "name" => "8",
                "user_count" => 500,
                "first_amount" => 75000,
                "gift_amount" => 28000,
                "createtime" => 0
            ],
            [
                "id" => 9,
                "name" => "9",
                "user_count" => 1000,
                "first_amount" => 75000,
                "gift_amount" => 58000,
                "createtime" => 0
            ]
        ];
        return ApiResponseApp::success($data);
    }

    /**
     * @Apidoc\Title("1.0 查询当前用户积分")
     * @Apidoc\Url("api/vip_reward/need_score")
     * @Apidoc\Method("POST")
     */
    public function need_score(Request $request)
    {
        $user_id = $request->data['id'];
        $user = User::find($user_id);
        $res['score'] = $user->money;
        return ApiResponseApp::success($res);
    }
        /**
     * @Apidoc\Title("1.0 获取当前用户vip等级")
     * @Apidoc\Url("api/vip_reward/user_count")
     * @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_reward/check_status")
     * @Apidoc\Method("POST")
     */
    public function check_status(Request $request)
    {
        $data = [
            [
                "vip_id" => 1,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 3
            ],
            [
                "vip_id" => 2,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 5
            ],
            [
                "vip_id" => 3,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 10
            ],
            [
                "vip_id" => 4,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 20
            ],
            [
                "vip_id" => 5,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 40
            ],
            [
                "vip_id" => 6,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 70
            ],
            [
                "vip_id" => 7,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 200
            ],
            [
                "vip_id" => 8,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 500
            ],
            [
                "vip_id" => 9,
                "status" => 0,
                '$userCount' => 0,
                "user_count" => 1000
            ]
        ];
        return ApiResponseApp::success($data);
    }
    
}
