<?php
namespace App\Models;
class GameOdds extends BaseModel
{

    protected $table="game_odds";
    public $timestamps = false;
    function getOdds($game){
        $data=$this->select('odds')->where('game_type',$game)->first();
        if(!$data){
            return -50123541222;//没有数据
        }
        return $data->toArray();
    }
    protected function getOdd($game){
        return $this->getOdds($game);

    }
    //更新倍率
    function updateodds($data,$game){
        $str=json_encode($data);
        $res=$this->where('game_type',$game)->update(['odds'=>$str,'update_time'=>date('Y-m-d H:i:s')]);
        if(!$res){
            return -5030022322;//更新倍率失败
        }
        return 1;
    }
}
