<?php

namespace App\Models;

class JisuGameplay extends BaseModel
{
    protected $table = 'jisu_gameplay';
    protected $fillable = [ 'game',  'gameplay','number',  'odds','type','maxinum','mininum'];
    
    public static function getGame($type) {
        $list = JisuGameplay::where('type',$type)->get()->toArray();
        $tree = [];
        foreach($list as $item) {
            if (!isset($tree[$item['gameplay']])) {
                $tree[$item['gameplay']] = [
                    'gameplay' => $item['gameplay'],
                ];
            }
            $tree[$item['gameplay']]['children'][] = [
                'id' => $item['id'],
                'type' => $item['type'],
                'name' => $item['number'],
                'odds' => $item['odds'],
                'maxinum' => $item['maxinum'],
                'mininum' => $item['mininum'],
            ];
        }
        return array_values($tree);
    }

    public static function getRemark($type) {
        if ($type == 1) {
            return '极速赛车';
        } elseif ($type == 2) {
            return '极速时时彩';
        } elseif ($type == 3) {
            return '极速飞艇';
        } elseif ($type == 4) {
            return 'SG时时彩';
        } elseif ($type == 5) {
            return 'SG飞艇';
        } elseif ($type == 6) {
            return '极速快3';
        } elseif ($type == 7) {
            return 'SG快3';
        }
        return $type;
    }
}
