St_lq_odds.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_lq_odds extends Model
  10. {
  11. protected $table = 'st_lq_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(function($query){
  30. $query->where('odds_code','concede_home')
  31. ->orWhere(function($query){
  32. $query->where('odds_code','concede_guest');
  33. })
  34. ->orWhere(function($query){
  35. $query->where('odds_code','total_sizes_big');
  36. })
  37. ->orWhere(function($query){
  38. $query->where('odds_code','total_sizes_small');
  39. })
  40. ->orWhere(function($query){
  41. $query->where('odds_code','capot_home');
  42. })
  43. ->orWhere(function($query){
  44. $query->where('odds_code','capot_dogfall');
  45. })
  46. ->orWhere(function($query){
  47. $query->where('odds_code','capot_guest');
  48. });
  49. })
  50. ->get()
  51. ->toArray();
  52. return $oddsData;
  53. }
  54. }