<?php
namespace App\Lib\Biz\Game\Table;
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/12/6
 * Time: 13:59
 */
class GameTable extends BaseTable {
    /**
     * @param $obj 对象
     * @param $game 游戏代码
     * @param $data 数据
     */
    function gameTable(&$obj,$game){
        //获取一个已开奖的的游戏开奖信息
        $dbpath='\App\Models\Game'.ucfirst($game);
        $db=new $dbpath;
        $data=$db->getOne();
        $table=array();
        if(isset($data['prizes'])){
            $prize=json_decode($data['prizes'],1);
            if(is_array($prize)&&count($prize)>0){
                $prize=current($prize);
            }
            $table=$prize;
        }
        if(isset($data['extra'])&&$game!='sixlottery'){
            $extra=json_decode($data['extra'],1);
            if(is_array($extra)&&count($extra)>0){
                $table=array_merge($prize,$extra);
            }
        }
        //添加玩法列
        foreach ($table as $k=>$v){
            $obj->addColsFields($k,array('sort' => false));
        }
    }
}