| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?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.'.lg_id')
- ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
- ->select($model_league.'.lg_id',$model_league.'.name_chinese as leagueName')
- ->distinct($model_league.'.name_chinese')
- ->where($model_league.'.source',$source['source'])
- ->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.'.lg_id')
- ->select($model_league.'.lg_id',$model_league.'.name_chinese as leagueName')
- ->distinct($model_league.'.name_chinese')
- ->where($model_league.'.source',$source['source'])
- ->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'];
- //当前状态下所有联赛
- $data = lm($model_league,"Sports")
- ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
- ->select($model_league.'.lg_id',$model_league.'.name_chinese as leagueName',$model_match.'.id',$model_match.'.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')
- ->where([[$model_league.'.name_chinese','!=','']])
- ->where([[$model_match.'.status','<',2]])
- ->get()
- ->toarray();
- return $data;
- }
- }
|