St_lq_odds.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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("lg_id","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(['type'=>0,'status'=>0])//查询滚球赔率
  30. ->where('is_stringscene',0)
  31. ->where(function($query){
  32. $query->where('odds_code','concede_home')
  33. ->orWhere(function($query){
  34. $query->where('odds_code','concede_guest');
  35. })
  36. ->orWhere(function($query){
  37. $query->where('odds_code','total_sizes_big');
  38. })
  39. ->orWhere(function($query){
  40. $query->where('odds_code','total_sizes_small');
  41. })
  42. ->orWhere(function($query){
  43. $query->where('odds_code','capot_home');
  44. })
  45. ->orWhere(function($query){
  46. $query->where('odds_code','capot_dogfall');
  47. })
  48. ->orWhere(function($query){
  49. $query->where('odds_code','capot_guest');
  50. });
  51. })
  52. ->get()
  53. ->toArray();
  54. return $oddsData;
  55. }
  56. }