| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class Stwqresult extends Model
- {
- protected $table = 'st_wq_result';
- public $timestamps = false;
- function resultlist($list = 10, $page, $where = '')
- {
- if (is_array ($where) && count ($where) > 0) {
- $data = $this->join('st_wq_league','st_wq_result.lg_id','=','st_wq_league.id')->join('st_zq_competition','st_zq_competition.id','=','st_wq_result.match_id')->select($this->table.'.id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.match_id','st_wq_result.guest_team','st_wq_result.home_rate','st_wq_result.guest_rate','st_wq_result.first_score','st_wq_result.status','st_wq_result.last_score','st_wq_result.match_score','st_wq_result.match_winer','st_wq_result.update_time','st_zq_competition.match_time','st_wq_result.match_process',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.u_guest_score',$this->table.'.u_home_score',$this->table.'.start_time','st_wq_league.name_chinese as saisname')->orderby('st_wq_result.id','desc')->where($where)->paginate ($list);
- } else {
- $data = $this->join('st_wq_league','st_wq_result.lg_id','=','st_wq_league.id')->join('st_zq_competition','st_zq_competition.id','=','st_wq_result.match_id')->select($this->table.'.id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.match_id','st_wq_result.guest_team','st_wq_result.home_rate','st_wq_result.guest_rate','st_wq_result.first_score','st_wq_result.status','st_wq_result.last_score','st_wq_result.match_score','st_wq_result.match_winer','st_wq_result.update_time','st_zq_competition.match_time','st_wq_result.match_process',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.u_guest_score',$this->table.'.u_home_score',$this->table.'.start_time','st_wq_league.name_chinese as saisname')->orderby('st_wq_result.id','desc')->paginate ($list);
- }
- return $data->toArray ();
- }
- //查询赛事
- function matchjg($match_id){
- $data = $this->where('match_id',$match_id)->select('id','home_team','guest_team')->first();
- if (!$data) {
- return -5040000102; //无相关信息
- }
- return $data->toArray();
- }
- }
- ?>
|