St_zq_competition.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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){
  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. ->where($where)
  33. ->get()
  34. ->toarray();
  35. return $data;
  36. }
  37. //获取各球类 非滚球赛事关联赛事结果数据
  38. public static function getSoonMatchDataAll($source,$models,$where){
  39. $model_match = $models['model_match'];
  40. $data = lm($model_match,"Sports")
  41. ->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')
  42. ->where($source)
  43. ->where($where)
  44. ->orderBy('match_time','asc')
  45. ->get()
  46. ->toarray();
  47. return $data;
  48. }
  49. }