| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- *------Create thems Model------
- *------SCWPHP Version 1.0.0------
- *------Dev Model Jions------
- *------Create Time 2019-04-15 16:05:26------
- */
- namespace App\Commons\Model;
- use \System\Model;
- class StOdds extends Model {
- protected $table = '';
- /**
- * 获取赛事玩法是否还存在
- *
- * @access public
- * @param mixed $select 查询字段
- * @param mixed $wheres 查询条件
- * @param mixed $type 运动类型
- * @return array JsonString
- */
- public function stOdds($select, $wheres, $type) {
- $this->table = 'st_'. $type .'_odds';
- $count = count($wheres);
- $result = [];
- $unionAll = [];
- foreach ($wheres as $key => $value) {
- if ($key === 0) {
- $unionAll[0] = $this
- -> select($select)
- -> where($value);
- } elseif ($key + 1 === $count) {
- $result = $this
- -> select($select)
- -> where($value)
- -> unionAll($unionAll[$key - 1])
- -> get();
- } else {
- $unionAll[$key] = $this
- -> select($select)
- -> unionAll($unionAll[$key - 1])
- -> where($value);
- }
- }
- return $result;
- }
- }
|