St_wq_odds.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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(['type'=>0,'status'=>0])//查询滚球赔率
  30. ->where(
  31. function($query){
  32. $query->where('odds_code','dishes_home')
  33. ->orWhere(function($query){
  34. $query->where('odds_code','dishes_guest');
  35. })
  36. ->orWhere(function($query){
  37. $query->where('odds_code','kemp_home');
  38. })
  39. ->orWhere(function($query){
  40. $query->where('odds_code','kemp_guest');
  41. });
  42. }
  43. )
  44. ->get()
  45. ->toArray();
  46. return $oddsData;
  47. }
  48. }