GameOdds.php 732 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Models;
  3. class GameOdds extends BaseModel
  4. {
  5. protected $table="game_odds";
  6. public $timestamps = false;
  7. function getOdds($game){
  8. $data=$this->select('odds')->where('game_type',$game)->first();
  9. if(!$data){
  10. return -50123541222;//没有数据
  11. }
  12. return $data->toArray();
  13. }
  14. protected function getOdd($game){
  15. return $this->getOdds($game);
  16. }
  17. //更新倍率
  18. function updateodds($data,$game){
  19. $str=json_encode($data);
  20. $res=$this->where('game_type',$game)->update(['odds'=>$str,'update_time'=>date('Y-m-d H:i:s')]);
  21. if(!$res){
  22. return -5030022322;//更新倍率失败
  23. }
  24. return 1;
  25. }
  26. }