St_zq_competition.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_zq_competition extends Model
  10. {
  11. protected $table = 'st_zq_competition';
  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 getMatchData($where=[],$select='id',$sort='id',$orderby='asc'){
  21. $matchData = self::select($select)->where($where)->orderBy($sort,$orderby)->get();
  22. return $matchData;
  23. }
  24. //获取各球类 滚球赛事关联赛事结果数据
  25. public static function getRollMatchDataAll($source,$models,$where,$lg_ids=[]){
  26. $model_match = $models['model_match'];
  27. $model_result = $models['model_result'];
  28. $data = lm($model_match,"Sports")
  29. ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
  30. ->select($model_match.'.lg_id',$model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time as a_time','match_process')
  31. ->where($model_match.'.source',$source['source'])
  32. ->whereIn($model_match.'.lg_id',$lg_ids)
  33. ->where($where)
  34. ->get()
  35. ->toarray();
  36. return $data;
  37. }
  38. //获取各球类 非滚球赛事关联赛事结果数据
  39. public static function getSoonMatchDataAll($source,$models,$where,$lg_ids=[]){
  40. $model_match = $models['model_match'];
  41. $data = lm($model_match,"Sports")
  42. ->select($model_match.'.lg_id',$model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team',$model_match.'.us_time')
  43. ->where($source)
  44. ->where($where)
  45. ->whereIn($model_match.'.lg_id',$lg_ids)
  46. ->orderBy('match_time','asc')
  47. ->get()
  48. ->toarray();
  49. return $data;
  50. }
  51. }