St_competition.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. *------Create thems Model------
  4. *------SCWPHP Version 1.0.0------
  5. *------Dev Model Jions------
  6. *------Create Time 2019-04-15 16:05:26------
  7. */
  8. namespace App\Commons\Model;
  9. use \System\Model;
  10. class St_competition extends Model {
  11. // 对象表
  12. protected $table = '';
  13. public $timestamps = false;
  14. /**
  15. * 投注记录
  16. *
  17. * @access public
  18. * @param mixed $type 查询字段
  19. * @param mixed $moneyBuyWhere 查询条件
  20. * @param mixed $moneyBuyBetween 查询条件区间
  21. * @param mixed $begin 起始查询位置
  22. * @param mixed $pageSize 分页大小
  23. * @param mixed $orderBy 排序字段
  24. * @return array JsonString
  25. */
  26. public function getMatch($type, $whereOr) {
  27. $this->table = 'st_' . $type . '_competition';
  28. $stLeague = 'st_' . $type . '_league';
  29. if ($whereOr) {
  30. $result = $this
  31. ->select(['match_date', $this->table.'.id', 'match_time', 'name_chinese'])
  32. ->join($stLeague,$stLeague.'.id','=',$this->table.'.lg_id')
  33. -> where([$this->table.'.id' => $whereOr[0]]);
  34. foreach ($whereOr as $key => $value) {
  35. if ($key > 0) {
  36. $result = $result -> orWhere([$this->table.'.id' => $value]);
  37. }
  38. }
  39. $result = $result -> get()->toArray();
  40. } else {
  41. $result = [];
  42. }
  43. return $result;
  44. }
  45. }