| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Models;
- use Illuminate\Support\Facades\DB;
- class Stlqresult extends BaseModel
- {
- protected $table = 'st_lq_result';
- public $timestamps = false;
- protected $fillable = ['lg_id','home_team','guest_team','home_rate','guest_rate','home_score','status','first_score','last_score','match_score','guest_score','match_winer','update_time','match_time','match_process','tag','u_home_score','u_guest_score','match_id','all_goal','source'];
- function resultbklist($list = 10, $page, $where = '', $orwhere = '')
- {
- if (is_array ($where) && count ($where) > 0) {
- $data = $this->join('st_lq_league','st_lq_result.lg_id','=','st_lq_league.id')->select($this->table.'.id',$this->table.'.lg_id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.home_rate',$this->table.'.guest_rate',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.all_goal',$this->table.'.status',$this->table.'.first_score',$this->table.'.last_score',$this->table.'.match_score',$this->table.'.match_winer',$this->table.'.update_time',$this->table.'.match_time',$this->table.'.match_process',$this->table.'.tag',$this->table.'.match_id',$this->table.'.u_home_score',$this->table.'.u_guest_score','st_lq_league.name_chinese')->orderby($this->table.'.id','desc')->where($where)->orwhere($orwhere)->paginate ($list);
- } else {
- $data = $this->join('st_lq_league','st_lq_result.lg_id','=','st_lq_league.id')->select($this->table.'.id',$this->table.'.lg_id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.home_rate',$this->table.'.guest_rate',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.all_goal',$this->table.'.status',$this->table.'.first_score',$this->table.'.last_score',$this->table.'.match_score',$this->table.'.match_winer',$this->table.'.update_time',$this->table.'.match_time',$this->table.'.match_process',$this->table.'.tag',$this->table.'.match_id',$this->table.'.u_home_score',$this->table.'.u_guest_score','st_lq_league.name_chinese')->orderby($this->table.'.id','desc')->paginate ($list);
- }
- return $data->toArray ();
- }
- //根据match_id查询比赛1-4节比分
- function allscore($match_id,$count=4){
- for ($i=1; $i < $count; $i++) {
- $where = array(
- 'match_id'=>$match_id,
- 'match_process'=>$i,
- );
- $data[] = $this->where($where)->select($this->table.'.home_score',$this->table.'.guest_score')->first();
- }
- return $data;
- }
- //根据match_id查询
- function onlyselect($match_id){
- $data = $this->where('match_id',$match_id)->select('lg_id','home_team','guest_team','home_rate','guest_rate','all_goal','status','first_score','last_score','match_score','match_winer','match_time','tag','match_id','u_home_score','u_guest_score','source')->first();
- if (!$data) {
- return -5040000102; //无相关信息
- }
- return $data->toArray();
- }
- }
- ?>
|