St_bq_odds.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Sports\Model;
  3. use \System\Model;
  4. /**
  5. * Class Account
  6. * @package App\Sports\Model
  7. * 用户账号
  8. */
  9. class St_bq_odds extends Model
  10. {
  11. protected $table = 'st_bq_odds';
  12. /**
  13. * @param array $where 条件
  14. * @param string $select 字段
  15. * @param string $sort 排序字段
  16. * @param string $orderby 排序方式
  17. * @return mixed
  18. * 获取赔率数据
  19. */
  20. public static function getOddsData($where=[],$select='id',$sort='id',$orderby='asc'){
  21. $oddsData = self::select($select)->where($where)->groupby("match_id","type")->get();
  22. return $oddsData;
  23. }
  24. //获取棒球赛事下 默认赔率数据
  25. public static function getMatchOdds($source,$match_ids=[]){
  26. $oddsData = self::select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
  27. ->where($source)
  28. ->whereIn('match_id',$match_ids)
  29. ->where(
  30. function($query){
  31. $query->where('odds_code','capot_home')
  32. ->orWhere(function($query){
  33. $query->where('odds_code','capot_guest');
  34. });
  35. }
  36. )
  37. ->get()
  38. ->toArray();
  39. return $oddsData;
  40. }
  41. }