Stbqresult.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Jimy
  5. * Date: 2019/4/18
  6. * Time: 13:59
  7. */
  8. namespace App\Models;
  9. use Illuminate\Support\Facades\DB;
  10. class Stbqresult extends BaseModel {
  11. protected $table = "st_bq_result";
  12. public $timestamps = false;
  13. function getinfo($list = 10, $page, $where = '',$whereor = '')
  14. {
  15. if (is_array ($where) && count ($where) > 0) {
  16. $data = $this->join('st_bq_league','st_bq_result.lg_id','=','st_bq_league.id')->join('st_bq_competition','st_bq_competition.id','=','st_bq_result.match_id')->select($this->table.'.id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.match_id','st_bq_result.guest_team','st_bq_result.home_rate','st_bq_result.guest_rate','st_bq_result.first_score','st_bq_result.status','st_bq_result.last_score','st_bq_result.match_score','st_bq_result.match_winer','st_bq_result.update_time','st_bq_competition.match_time','st_bq_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_bq_league.name_chinese as saisname')->orderby('st_bq_result.id','desc')->where($where)->paginate ($list);
  17. } else {
  18. $data = $this->join('st_bq_league','st_bq_result.lg_id','=','st_bq_league.id')->join('st_bq_competition','st_bq_competition.id','=','st_bq_result.match_id')->select($this->table.'.id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.match_id','st_bq_result.guest_team','st_bq_result.home_rate','st_bq_result.guest_rate','st_bq_result.first_score','st_bq_result.status','st_bq_result.last_score','st_bq_result.match_score','st_bq_result.match_winer','st_bq_result.update_time','st_bq_competition.match_time','st_bq_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_bq_league.name_chinese as saisname')->orderby('st_bq_result.id','desc')->paginate ($list);
  19. }
  20. return $data->toArray ();
  21. }
  22. //查询赛事
  23. function matchjg($match_id){
  24. $data = $this->where('match_id',$match_id)->select('id','home_team','guest_team')->first();
  25. if (!$data) {
  26. return -5040000102; //无相关信息
  27. }
  28. return $data->toArray();
  29. }
  30. //更新状态
  31. function updatestatus($field,$where,$data){
  32. $res=$this->where($field,$where)->update($data);
  33. if(!$res) {
  34. return -7020050022;//更新失败
  35. }
  36. return 1;
  37. }
  38. //更新
  39. function updateInfo($data, $match_id)
  40. {
  41. $res = $this->where ('match_id', $match_id)->update ($data);
  42. if (!$res) {
  43. return -7010101202; //更新失败
  44. }
  45. return 1;
  46. }
  47. }