<?php

namespace app\jinyou\controller;

use extend\jinyouapi\Jinyoujingtai;
use app\jinyou\model\Package as PackageModel;

class Api 
{
    public function test() {
                
        $qilinjt = new Jinyoujingtai;

        $data = $qilinjt::productList(0);
        dd($data);
    }

    //获取游戏列表
    public function gameList() {
        $qilinjt = new Jinyoujingtai;
        
        $data = $qilinjt::gameList();

        echo json_encode($data);
    }

    //获取地区列表
    public function regionSurplusOuts() {
        $info = $_GET;
        
        $qilinjt = new Jinyoujingtai;
        
        $data = $qilinjt::regionSurplusOuts($info['product_id'],$info['is_unshar'],$info['game_id']);

        echo json_encode($data);
    }

    //获取所有套餐
    public function getPackage() {
        $info = $_GET;
        $package_type = '';
        if ($info['type'] == 1) {
            $package_type = '静态';
        } else if ($info['type'] == 2) {
            $package_type = '固态';
        }
        $package_model = new PackageModel;
        $list = $package_model->get_package($package_type);

        $data = [
            'code' => 1,
            'msg' => '',
            'data' => $list,
        ];

        echo json_encode($data);
    }


}