Stzqcompetition.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. //足球赛事
  5. class Stzqcompetition extends Model
  6. {
  7. protected $table = 'st_zq_competition';
  8. public $timestamps = false;
  9. // function resultlist(){
  10. // $data=$this->orderby('id','desc')->whereIn('status',array(1))->paginate(1);
  11. // if(!$data){
  12. // return -6010000122;
  13. // }
  14. // return $data->toArray();
  15. // }
  16. function resultlist($list = 10, $page, $where = '')
  17. {
  18. if (is_array ($where) && count ($where) > 0) {
  19. $data = $this->orderby('id','desc')->where($where)->paginate ($list);
  20. } else {
  21. $data = $this->orderby('id','desc')->where($where)->paginate ($list);
  22. }
  23. if (!$data < 0) {
  24. return -2021052003; //
  25. }
  26. return $data->toArray ();
  27. }
  28. //足球赛事联赛查询
  29. function allcompetition($lg_id){
  30. $data = $this->where('lg_id',$lg_id)->select('match_id','home_team')->get();
  31. if (!$data) {
  32. return -5040000102; //无相关信息
  33. }
  34. return $data->toArray();
  35. }
  36. }
  37. ?>