SoccerNoteList.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Jonlin
  5. * Date: 2019/4/9
  6. * Time: 9:18
  7. */
  8. namespace App\Models;
  9. use Illuminate\Support\Facades\DB;
  10. class SoccerNoteList extends BaseModel {
  11. protected $table = "st_bet_order";
  12. public $timestamps = false;
  13. function getinfo($list = 10, $page, $where = '')
  14. {
  15. if (is_array ($where) && count ($where) > 0) {
  16. $data = $this->join('st_zq_league','st_bet_order.lg_id','=','st_zq_league.lg_id')
  17. ->join('st_zq_competition','st_bet_order.match_id','=','st_zq_competition.match_id')
  18. ->join('account','st_bet_order.account_id','=','account.id')
  19. ->select('st_bet_order.id','st_bet_order.match_id','st_bet_order.lg_id','st_zq_league.name_chinese','st_bet_order.odds_id','st_bet_order.game_code','st_bet_order.ctime','st_bet_order.utime','st_bet_order.bet_amount','st_bet_order.win_amount','st_bet_order.bet_odds','st_bet_order.order_number','st_bet_order.status','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','account.account')
  20. ->where('st_bet_order.game_code','zq')
  21. ->where($where)
  22. ->orderby('st_bet_order.utime','desc')
  23. ->orderby('st_bet_order.ctime','desc')
  24. ->paginate ($list);
  25. } else {
  26. $data = $this->join('st_zq_league','st_bet_order.lg_id','=','st_zq_league.lg_id')
  27. ->join('st_zq_competition','st_bet_order.match_id','=','st_zq_competition.match_id')
  28. ->join('account','st_bet_order.account_id','=','account.id')
  29. ->select('st_bet_order.id','st_bet_order.match_id','st_bet_order.lg_id','st_zq_league.name_chinese','st_bet_order.odds_id','st_bet_order.game_code','st_bet_order.ctime','st_bet_order.utime','st_bet_order.bet_amount','st_bet_order.win_amount','st_bet_order.bet_odds','st_bet_order.order_number','st_bet_order.status','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','account.account')
  30. ->where('st_bet_order.game_code','zq')
  31. ->orderby('st_bet_order.utime','desc')
  32. ->orderby('st_bet_order.ctime','desc')
  33. ->paginate ($list);
  34. }
  35. if (!$data < 0) {
  36. return -2021052003; //
  37. }
  38. for($i=0;$i<count($data);$i++){
  39. // if($data[$i]->match_date <= date('Y-m-d',time()) && strtotime($data[$i]->match_time)+5400 <= strtotime(date('H:i:s',time()))){
  40. // $data[$i]->status = '2';
  41. // $this->where('id', $data[$i]->id)->update(['status' => 2]);
  42. // }
  43. if($data[$i]->status==1){
  44. $data[$i]->status = '待处理';
  45. }else if($data[$i]->status==1){
  46. $data[$i]->status = '已取消';
  47. }else if($data[$i]->status==2){
  48. $data[$i]->status = '已完成';
  49. }
  50. $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
  51. $data[$i]->competition_time = $data[$i]->match_date.' '.$data[$i]->match_time;
  52. }
  53. return $data->toArray();
  54. }
  55. }