| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace App\Sports\Model;
- use \System\Model;
- /**
- * Class Account
- * @package App\Sports\Model
- * 足球联赛
- */
- class St_zq_league extends Model
- {
- protected $table = 'st_zq_league';
- /*
- * 获取滚球 联赛数据
- */
- public static function getRollLeagueData($source,$models,$where,$search=''){
- $model_match = $models['model_match'];
- $model_league = $models['model_league'];
- $model_result = $models['model_result'];
- //当前状态下所有联赛
- $data = lm($model_league,"Sports")
- ->join($model_match,$model_match.'.lg_id',$model_league.'.id')
- ->select($model_league.'.id as lg_id',$model_league.'.name_chinese as leagueName')
- ->distinct($model_league.'.name_chinese')
- ->where([[$model_league.'.name_chinese','!=','']])
- ->where($where)
- ->where(function($query)use ($model_match,$search){
- $query->where($model_match.'.home_team','like','%'.$search.'%')
- ->orWhere(function($query)use ($model_match,$search) {
- $query->where($model_match . '.guest_team', 'like', '%' . $search . '%');
- });
- })
- ->get()
- ->toarray();
- return $data;
- }
- /*
- * 获取即将 联赛数据
- */
- public static function getSoonLeagueData($source,$models,$where,$search=''){
- $model_match = $models['model_match'];
- $model_league = $models['model_league'];
- $model_result = $models['model_result'];
- //当前状态下所有联赛
- $data = lm($model_league,"Sports")
- ->join($model_match,$model_match.'.lg_id',$model_league.'.id')
- ->select($model_league.'.id as lg_id',$model_league.'.name_chinese as leagueName')
- ->distinct($model_league.'.name_chinese')
- ->where([[$model_league.'.name_chinese','!=','']])
- ->where($where)
- ->where(function($query)use ($model_match,$search){
- $query->where($model_match.'.home_team','like','%'.$search.'%')
- ->orWhere(function($query)use ($model_match,$search) {
- $query->where($model_match . '.guest_team', 'like', '%' . $search . '%');
- });
- })
- ->get()
- ->toarray();
- return $data;
- }
- /*
- * 获取非滚球 联赛下赛事数据 用于统计数量
- */
- public static function getLeagueMatchData($models,$where){
- $model_match = $models['model_match'];
- $model_league = $models['model_league'];
- $model_result = $models['model_result'];
- $model_odds = $models['model_odds'];
- //当前状态下所有联赛
-
- $data = lm($model_league,"Sports")
- ->join($model_match,$model_match.'.lg_id',$model_league.'.id')
- ->select($model_league.'.id as lg_id',$model_league.'.name_chinese as leagueName',$model_match.'.id as match_id',$model_match.'.status',$model_match.'.match_date',$model_match.'.match_time',$model_match.'.us_time',$model_match.'.is_morningplate',$model_match.'.is_stringscene',$model_match.'.is_rollball',$model_match.'.is_today')
- ->where([[$model_league.'.name_chinese','!=','']])
- ->where([[$model_match.'.status','<',2]])
- ->get()
- ->toArray();
-
- return $data;
- }
- }
|