<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
//足球冠军赛事
class Stzqleagueresult extends Model
{
	protected $table = 'st_zq_league_result';
	public $timestamps = false;

	function resultlist($list = 10, $page, $where = '')
    {
        if (is_array ($where) && count ($where) > 0) {
            $data = $this->join('st_zq_league','st_zq_league.lg_id','=','st_zq_league_result.lg_id')
                ->select($this->table.'.*','st_zq_league.name_chinese')
                ->orderby('st_zq_league_result.id','desc')->where($where)->paginate ($list);
        } else {
            $data = $this->join('st_zq_league','st_zq_league.lg_id','=','st_zq_league_result.lg_id')
                ->select($this->table.'.*','st_zq_league.name_chinese')
                ->orderby('st_zq_league_result.id','desc')->paginate ($list);
        }

        if (!$data < 0) {
            return -2021052003; //
        }
        return $data->toArray ();

	}
	
	//足球赛事联赛查询
	function allcompetition($lg_id){
		$data = $this->where('lg_id',$lg_id)->select('id','home_team')->get();
        if (!$data) {
			return -5040000102; //无相关信息
		}
		return $data->toArray();
	}
	
}

?>