St_wq_odds.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_wq_odds extends Model
  10. {
  11. protected $table = 'st_wq_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','dishes_home')
  32. ->orWhere(function($query){
  33. $query->where('odds_code','dishes_guest');
  34. })
  35. ->orWhere(function($query){
  36. $query->where('odds_code','kemp_home');
  37. })
  38. ->orWhere(function($query){
  39. $query->where('odds_code','kemp_guest');
  40. });
  41. }
  42. )
  43. ->get()
  44. ->toArray();
  45. return $oddsData;
  46. }
  47. }