فهرست منبع

新增推送 接口查询优化及调整 5/22

彭俊 6 سال پیش
والد
کامیت
d33448d839

+ 23 - 0
Application/Api/Controller/UserBuy.php

@@ -165,4 +165,27 @@ class UserBuy extends BaseController {
             //Render([], $code, $e->getMessage());
         }
     }
+
+    /**
+     * 个人中心初始显示
+     *
+     * @access public
+     * @return array JsonString
+     */
+    public function index() {
+        $code = 0;
+        $msg = lang('Common','Api') -> get('error');
+        try{
+            $MoneyBuyModel = new MoneyBuy();
+            // 数据获取
+            $result = $MoneyBuyModel -> monthRecord();
+            $code = 1;
+            $msg = lang('Index','Api') -> get('success');
+
+            Render($result, $code, $msg);
+        } catch (Exception $e) {
+            Render([], $code, $msg);
+            //Render([], $code, $e->getMessage());
+        }
+    }
 }

+ 73 - 0
Application/Api/Model/MoneyBuy.php

@@ -312,4 +312,77 @@ class MoneyBuy extends Model {
 
         return $result;
     }
+
+    /**
+     * 统计记录
+     *
+     * @access public
+     * @return String
+     */
+    public function monthRecord()
+    {
+        $accountManagerClass = new AccountManager;
+        $userInfo = $accountManagerClass -> getCurrentUser();
+        if (empty($userInfo['identity'])) {
+            Render([], '2001', lang('Common','Api') -> get('user does login'));
+        }
+        // 用户ID
+        $moneyBuyWhere['account_identity'] =$userInfo['identity'];
+        // 时间区间
+        $endTime = date('Y-m-d H:i:s');
+        if ($userInfo['statisticsTime']) {
+            $startTime = $userInfo['statisticsTime'];
+        } else {
+            $startTime = '1900-01-01 00:00:00';
+        }
+        $moneyBuyBetween = [$startTime, $endTime];
+        $moneyRecordWhere['settle_status'] = 2;
+        // 获取单式投注订单
+        $moneyBuySimplex = lm('money_buy_simplex', "commons");
+        $mnyBuySpxData = $moneyBuySimplex
+            ->select(['order_id', 'money', 'gain_money'])
+            ->where($moneyBuyWhere)
+            ->whereBetween('settlementTime', $moneyBuyBetween)
+            ->get();
+        // 获取串式投注订单
+        $moneyBuyStr = lm('money_buy_str', "commons");
+        $mnyBuyStrData = $moneyBuyStr
+            ->select(['order_id', 'money', 'gain_money'])
+            ->where($moneyBuyWhere)
+            ->whereBetween('settlementTime', $moneyBuyBetween)
+            ->get();
+        $winMoney = $userInfo['allWin'];
+        $loseMoney = $userInfo['allLose'];
+        foreach ($mnyBuySpxData as $key => $value) {
+            // 判断订单是否盈利
+            if ($value->money >= $value->gain_money) {
+                $loseMoney += $value->money - $value->gain_money;   //本钱减回款
+            } else {
+                $winMoney += $value->gain_money - $value->money;    //回款减本钱
+            }
+        }
+        foreach ($mnyBuyStrData as $key => $value) {
+            // 判断订单是否盈利
+            if ($value->money >= $value->gain_money) {
+                $loseMoney += $value->money - $value->gain_money;   //本钱减回款
+            } else {
+                $winMoney += $value->gain_money - $value->money;    //回款减本钱
+            }
+        }
+        // 修改用户统计
+        $updateActDtd = [
+          'allWin' => $winMoney,
+          'allLose' => $loseMoney,
+          'statisticsTime' => date('Y-m-d H:i:s'),
+        ];
+        $accountDetailed = lm('account_detailed', "commons");
+        $accountDetailed->where(['account_identity'=>$userInfo['identity']])->update($updateActDtd);
+        $result = [
+            'winMoney' => $winMoney ?? 0,
+            'loseMoney' => $loseMoney ?? 0,
+            'allMoney' => $userInfo['available_cash'],
+        ];
+
+        return $result;
+    }
 }

+ 38 - 0
Application/Commons/Model/Money_record.php

@@ -56,4 +56,42 @@ class Money_record extends Model {
 
         return $result;
     }
+
+    /**
+     * 盈亏记录
+     *
+     * @access public
+     * @param mixed $moneyRecordSelect 查询参数
+     * @param mixed $moneyRecordWhere 查询条件
+     * @param mixed $moneyRecordBetween 查询条件区间
+     * @param mixed $orWhere or查询
+     * @return array JsonString
+     */
+    public function moneyRecordAll($moneyRecordSelect, $moneyRecordWhere, $moneyRecordBetween, $orWhere=[]) {
+        $result = $this
+            -> select($moneyRecordSelect)
+            -> where($moneyRecordWhere);
+        if ($moneyRecordBetween) {
+            $result = $result-> whereBetween('money_time', $moneyRecordBetween);
+        }
+        if ($orWhere) {
+            // 循环获取or查询.
+            foreach ($orWhere as $value) {
+                $result = $result->where(
+                    function ($query) use ($value) {
+                        foreach ($value as $k => $v) {
+                            if ($k === 0) {
+                                $query = $query->where([$v[0] => $v[1]]);
+                            } else {
+                                $query = $query->orWhere([$v[0] => $v[1]]);
+                            }
+                        }
+                    }
+                );
+            }
+        }
+        $result = $result->get()->toArray();
+
+        return $result;
+    }
 }

+ 72 - 156
Application/Sports/Controller/Head.php

@@ -2,6 +2,14 @@
 namespace App\Sports\Controller;
 
 use BaseController\Controller;
+use App\Sports\Model\St_zq_competition as ZQmatchModel;
+use App\Sports\Model\St_lq_competition as LQmatchModel;
+use App\Sports\Model\St_wq_competition as WQmatchModel;
+use App\Sports\Model\St_bq_competition as BQmatchModel;
+use App\Sports\Model\St_zq_odds as ZQoddsModel;
+use App\Sports\Model\St_lq_odds as LQoddsModel;
+use App\Sports\Model\St_wq_odds as WQoddsModel;
+use App\Sports\Model\St_bq_odds as BQoddsModel;
 
 /**
  * Class Head
@@ -16,185 +24,93 @@ class Head extends Controller{
     }
 
     /**
-     * 首页头部类别列表 弃用
+     * @throws \Exception
+     * 返回首页球类列表
      */
-    public function __typeList (){
-
-        //获取类型 代码
-        $type = lang('GameTypes','Sports')->getAll();
-        $ret = lm('GameType', 'Sports')->select('id','game_name','game_code','game_ico_url')->where('status',1)->get()->toArray();
-
-        $data = [];
-        foreach ($type as $key =>$item){
-            $matchNum = [];
-            $where = $this->commonFunction->getState($item['type_code']);
-            foreach ($ret as $key1 => $item1){
-                if($item1['game_code'] != 'gj'){
-                    //根据球类代码 获取相关model
-                    $models = $this->commonFunction->getModels($item1['game_code'],0);
-                    $model_match = $models['model_match'];
-
-                    $matchNum[$key1][] = lm($model_match, 'Sports')
-//                    ->select('match_id')
-                        ->where($this->source)
-                        ->where($where)
-                        ->count("*");
-                }
-            }
-
-            $num_s = array_sum(array_column($matchNum, 0));
-
-            //追加统计 各状态赛事数量
-            $item['matchNum'] = $num_s;
+    public function ballList (){
+        $ret = lm('GameType', 'Sports')->select('id','game_name','game_code','game_ico_url')->where('status',1)->get();
 
-            $data[$key][]=$item;
-        }
+        if(!empty($ret)) Render($ret, '1', lang('Tips','Sports')->get('success'));
 
-        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
-    /**
-     * 重写获取头部状态及其赛事数量
-     */
+    //获取各状态下所有赛事数量
     public function typeList(){
+        //获取所有未结束赛事
+        $where = [
+            ['status','<','2']
+        ];
+        $select = ['id','match_id','status','match_date','match_time','us_time','is_morningplate','is_stringscene'];
+        $ZQmatchData = ZQmatchModel::getMatchData($where,$select)->toarray();
+        $LQmatchData = LQmatchModel::getMatchData($where,$select)->toarray();
+        $WQmatchData = WQmatchModel::getMatchData($where,$select)->toarray();
+        $BQmatchData = BQmatchModel::getMatchData($where,$select)->toarray();
+        //合并所有球类赛事
+        $matchAll = array_merge_recursive($ZQmatchData,$LQmatchData,$WQmatchData,$BQmatchData);
+
+        //获取所有冠军盘口
+        $where = [
+            ['type','=',1],
+            ['source','=',$this->source]
+        ];
+        $select = ['match_id','type'];
+        $ZQoddsData = ZQoddsModel::getOddsData($where,$select)->toArray();
+        $LQoddsData = LQoddsModel::getOddsData($where,$select)->toArray();
+        $WQoddsData = WQoddsModel::getOddsData($where,$select)->toArray();
+        $BQoddsData = BQoddsModel::getOddsData($where,$select)->toArray();
+        //合并所有球类关键盘口
+        $oddsAll = array_merge_recursive($ZQoddsData,$LQoddsData,$WQoddsData,$BQoddsData);
+
+        $StRollBall = [];
+        $StSoon = [];
+        $StToday = [];
+        $StMorningPlate = [];
+        $StStringScene = [];
+        //按状态条件分装数组
+        foreach ($matchAll as $kk=>$vv){
+            if($vv['status'] == '1'){
+                $StRollBall[] = $vv;
+            }
+            if($vv['status'] == '0' and $vv['match_date'] == date("Y-m-d") and $vv['match_time'] < date("H:i:s", strtotime("+2 hour")) and $vv['match_time'] > date("H:i:s", time())){
+                $StSoon[] = $vv;
+            }
+            if($vv['match_date'] == date("Y-m-d") and $vv['match_time'] > date("H:i:s", time())){
+                $StToday[] = $vv;
+            }
+            if($vv['is_morningplate'] == 1 and $vv['us_time'] > $this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4)){
+                $StMorningPlate[] = $vv;
+            }
+            if($vv['is_stringscene'] == 1 and $vv['us_time'] > $this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4)){
+                $StStringScene[] = $vv;
+            }
+        }
         //获取所有状态
         $type = lang('GameTypes','Sports')->getAll();
-        $d = [];
-
-        $ret = lm('GameType', 'Sports')->select('id','game_name','game_code','game_ico_url')->where('status',1)->get()->toArray();
-
-        foreach ($type as $key =>$item){
-            $matchNum = [];
-            switch ($item['type_code']){
+        foreach ($type as $k=>$v){
+            switch ($v['type_code']) {
                 case 'StRollBall'://滚球
-                    foreach ($ret as $key1 => $item1){
-                        //根据球类代码 获取相关model
-                        $models = $this->commonFunction->getModels($item1['game_code'],1);
-                        $model_match = $models['model_match'];
-                        $model_result = $models['model_result'];
-                        $model_odds = $models['model_odds'];
-                        $where = $this->commonFunction->getState($item['type_code'],$model_match);
-                        if($item1['game_code'] != 'gj'){
-                            $matchNum[$key1][] = lm($model_match, 'Sports')
-                                ->join($model_result,$model_result.'.match_id',$model_match . '.match_id')
-                                ->where($model_match.'.source',$this->source['source'])
-                                ->where($where)
-                                ->count("*");
-                        }
-                    }
+                    $type[$k]['matchNum'] = count($StRollBall);
                     break;
                 case 'StSoon'://即将
-                    foreach ($ret as $key1 => $item1){
-                        //根据球类代码 获取相关model
-                        $models = $this->commonFunction->getModels($item1['game_code'],1);
-                        $model_match = $models['model_match'];
-                        $model_league = $models['model_league'];
-
-                        $where = $this->commonFunction->getState($item['type_code'],$model_match);
-                        if($item1['game_code'] != 'gj'){
-                            $matchNum[$key1][] = lm($model_league,"Sports")
-                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
-                                ->where($model_match.'.source',$this->source['source'])
-                                ->where($where)
-                                ->count("*");
-                        }
-                    }
+                    $type[$k]['matchNum'] = count($StSoon);
                     break;
                 case 'StToday'://今日
-                    foreach ($ret as $key1 => $item1){
-                        //根据球类代码 获取相关model
-                        $models = $this->commonFunction->getModels($item1['game_code'],1);
-                        $model_match = $models['model_match'];
-                        $model_league = $models['model_league'];
-                        $where = $this->commonFunction->getState($item['type_code'],$model_match);
-                        if($item1['game_code'] != 'gj'){
-//                            $matchNum[$key1][] = lm($model_match, 'Sports')
-//                                ->where($model_match.'.source',$this->source['source'])
-//                                ->where($where)
-//                                ->count("*");
-                            $matchNum[$key1][] = lm($model_league,"Sports")
-                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
-                                ->where($model_match.'.source',$this->source['source'])
-                                ->where($where)
-                                ->count("*");
-                        }
-                    }
+                    $type[$k]['matchNum'] = count($StToday);
                     break;
                 case 'StMorningPlate'://早盘
-                    foreach ($ret as $key1 => $item1){
-                        //根据球类代码 获取相关model
-                        $models = $this->commonFunction->getModels($item1['game_code'],1);
-                        $model_match = $models['model_match'];
-                        $model_league = $models['model_league'];
-                        $where = $this->commonFunction->getState($item['type_code'],$model_match);
-                        if($item1['game_code'] != 'gj'){
-                            $matchNum[$key1][] = lm($model_league,"Sports")
-                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
-                                ->where($model_match.'.source',$this->source['source'])
-                                ->where($where)
-                                ->count("*");
-                        }
-                    }
+                    $type[$k]['matchNum'] = count($StMorningPlate);
                     break;
                 case 'StStringScene'://串场
-                    foreach ($ret as $key1 => $item1) {
-                        //根据球类代码 获取相关model
-                        $models = $this->commonFunction->getModels($item1['game_code'], 1);
-                        $model_match = $models['model_match'];
-                        $model_league = $models['model_league'];
-                        $where = $this->commonFunction->getState($item['type_code'], $model_match);
-                        if ($item1['game_code'] != 'gj') {
-                            $matchNum[$key1][] = lm($model_league,"Sports")
-                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
-                                ->where($model_match.'.source',$this->source['source'])
-                                ->where($where)
-                                ->count("*");
-                        }
-                    }
+                    $type[$k]['matchNum'] = count($StStringScene);
                     break;
                 case 'StChampion'://冠军
-                    foreach ($ret as $key1 => $item1) {
-                        //根据球类代码 获取相关model
-                        $models = $this->commonFunction->getModels($item1['game_code'], 1);
-                        $model_odds = $models['model_odds'];
-                        $where = $this->commonFunction->getState($item['type_code']);
-                        if ($item1['game_code'] != 'gj') {
-                            $matchNum[$key1][] =count(lm($model_odds, 'Sports')
-                                ->select("match_id","type")
-                                ->where($this->source)
-                                ->where($where)
-                                ->groupby("match_id","type")
-                                ->get()
-                            );
-                        }
-                    }
+                    $type[$k]['matchNum'] = count($oddsAll);
                     break;
                 default:
-                    throw new \Exception(Render([], '10002', lang('Tips','Sports')->get('PARAM_ERROR')));
+                    throw new \Exception(Render([], '10002', lang('Tips', 'Sports')->get('PARAM_ERROR')));
             }
-
-            $num_s = array_sum(array_column($matchNum, 0));
-
-            //追加统计 各状态赛事数量
-            $item['matchNum'] = $num_s;
-
-            $data[$key][]=$item;
-
         }
-        Render($data, '1', lang('Tips','Sports')->get('success'));
-
-
-
-    }
-
-    /**
-     * @throws \Exception
-     * 返回首页球类列表
-     */
-    public function ballList (){
-        $ret = lm('GameType', 'Sports')->select('id','game_name','game_code','game_ico_url')->where('status',1)->get();
-
-        if(!empty($ret)) Render($ret, '1', lang('Tips','Sports')->get('success'));
+        Render($type, '1', lang('Tips','Sports')->get('success'));
 
     }
 }

+ 0 - 6
Application/Sports/Controller/MatchList.php

@@ -671,7 +671,6 @@ class  MatchList extends Controller {
             $gameData = [];
 
             foreach ($game as $key=>$type){
-
                 if($type_code != 'StChampion'){
                     $matchModel = $this->commonFunction->getModels($type['game_code']);
                     $matchNum = lm($matchModel['model_league'],"Sports")
@@ -679,10 +678,6 @@ class  MatchList extends Controller {
                         ->where($matchModel['model_match'].'.source',$this->source['source'])
                         ->where($where)
                         ->count("*");
-//                        lm($matchModel['model_match'], 'Sports')
-//                        ->where($this->source)
-//                        ->where($where)
-//                        ->count('*');
                     //获取满足状态的球类/去除冠军类
                     if($matchNum != 0 and $type['game_code']!='gj'){
                         $gameData[] = $type;
@@ -698,7 +693,6 @@ class  MatchList extends Controller {
                         $gameData[] = $type;
                     }
                 }
-
             }
 
             Render($gameData, '1', lang('Tips','Sports')->get('success'));

+ 3 - 6
Application/Sports/Controller/WriteSports.php

@@ -464,18 +464,15 @@ class WriteSports extends Controller{
             "p_code"=> $data['p_code'],
             "update_time"=>$this->newTime
         ];
-        //更新操作
+        //赛事结果记录处理
         if($match_r_id > 0){
             $ret = lm($model['model_result_record'],'Sports')
                 ->where(['id'=>$match_r_id])
                 ->update($set_match_r);
-
-            dd($ret);
-            if($ret < 1) Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
+            if($ret < 1) Render([], '10022', lang('Tips','Sports')->get('add_match_r_r_error'));
         }else{
-            //写入操作
             $ret = lm($model['model_result_record'],'Sports')->insert($set_match_r);
-            if($ret != true) Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
+            if($ret != true) Render([], '10022', lang('Tips','Sports')->get('add_match_r_r_error'));
         }
         Render([], '1', lang('Tips','Sports')->get('success'));
     }

+ 4 - 4
Application/Sports/Lang/Errors.php

@@ -44,12 +44,12 @@ return array(
     'error-10014' => '地区不存在',
     'error-10015' => '联赛不存在',
     'error-10016' => '赛事不存在',
-    'error-10017' => '写入联赛关联记录失败',
-    'error-10018' => '写入赛事关联记录失败',
-    'error-10019' => '赛事赔率数据写入失败',
+    'error-10017' => '联赛关联记录写入失败',
+    'error-10018' => '赛事关联记录写入失败',
+    'error-10019' => '赛事赔率写入失败',
     'error-10020' => '赛事赔率记录写入失败',
     'error-10021' => '联赛结果写入失败',
-    'error-10022' => '赛事结果写入失败',
+    'error-10022' => '赛事结果记录写入失败',
 
 
 

+ 1 - 1
Application/Sports/Lang/Tips.php

@@ -19,7 +19,7 @@ return array(
     'add_odds_r_error' =>'赛事赔率记录写入失败',
     'add_lg_r_error' =>'联赛结果写入失败',
     'add_match_r_error' =>'赛事结果写入失败',
-
+    'add_match_r_r_error' =>'赛事结果记录写入失败',
 
     // ====end===
 

+ 13 - 0
Application/Sports/Model/St_bq_competition.php

@@ -11,4 +11,17 @@ use \System\Model;
 class St_bq_competition extends Model
 {
     protected $table = 'st_bq_competition';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赛事数据
+     */
+    public static function getMatchData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $matchData = self::select($select)->where($where)->orderBy($sort,$orderby)->get();
+        return $matchData;
+    }
 }

+ 13 - 0
Application/Sports/Model/St_bq_odds.php

@@ -12,4 +12,17 @@ class St_bq_odds extends Model
 {
 
     protected $table = 'st_bq_odds';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赔率数据
+     */
+    public static function getOddsData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $oddsData = self::select($select)->where($where)->groupby("match_id","type")->get();
+        return $oddsData;
+    }
 }

+ 13 - 0
Application/Sports/Model/St_lq_competition.php

@@ -12,4 +12,17 @@ class St_lq_competition extends Model
 {
 
     protected $table = 'st_lq_competition';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赛事数据
+     */
+    public static function getMatchData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $matchData = self::select($select)->where($where)->orderBy($sort,$orderby)->get();
+        return $matchData;
+    }
 }

+ 13 - 0
Application/Sports/Model/St_lq_odds.php

@@ -12,4 +12,17 @@ class St_lq_odds extends Model
 {
 
     protected $table = 'st_lq_odds';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赔率数据
+     */
+    public static function getOddsData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $oddsData = self::select($select)->where($where)->groupby("match_id","type")->get();
+        return $oddsData;
+    }
 }

+ 13 - 0
Application/Sports/Model/St_wq_competition.php

@@ -12,4 +12,17 @@ class St_wq_competition extends Model
 {
 
     protected $table = 'st_wq_competition';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赛事数据
+     */
+    public static function getMatchData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $matchData = self::select($select)->where($where)->orderBy($sort,$orderby)->get();
+        return $matchData;
+    }
 }

+ 13 - 0
Application/Sports/Model/St_wq_odds.php

@@ -12,4 +12,17 @@ class St_wq_odds extends Model
 {
 
     protected $table = 'st_wq_odds';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赔率数据
+     */
+    public static function getOddsData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $oddsData = self::select($select)->where($where)->groupby("match_id","type")->get();
+        return $oddsData;
+    }
 }

+ 13 - 0
Application/Sports/Model/St_zq_competition.php

@@ -12,4 +12,17 @@ class St_zq_competition extends Model
 {
 
     protected $table = 'st_zq_competition';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赛事数据
+     */
+    public static function getMatchData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $matchData = self::select($select)->where($where)->orderBy($sort,$orderby)->get();
+        return $matchData;
+    }
 }

+ 13 - 0
Application/Sports/Model/St_zq_odds.php

@@ -11,4 +11,17 @@ use \System\Model;
 class St_zq_odds extends Model
 {
     protected $table = 'st_zq_odds';
+
+    /**
+     * @param array $where 条件
+     * @param string $select 字段
+     * @param string $sort 排序字段
+     * @param string $orderby 排序方式
+     * @return mixed
+     * 获取赔率数据
+     */
+    public static function getOddsData($where=[],$select='id',$sort='id',$orderby='asc'){
+        $oddsData = self::select($select)->where($where)->groupby("match_id","type")->get();
+        return $oddsData;
+    }
 }

+ 1 - 37
Biz/Match/GetmatchData.php

@@ -149,7 +149,7 @@ class GetmatchData {
             foreach($v['matchData'] as $kk => $vv){
                 $oddsData= lm($model_match,"Sports")
                     ->leftjoin($model_odds,$model_odds.'.match_id',$model_match.'.match_id')
-                    ->select($model_odds.'.id','p_code','odds_code',$model_odds.'.status','odds','condition','sort')
+                    ->select($model_odds.'.id','p_code','odds_code',$model_odds.'.status','odds','condition','odds_only','sort')
                     ->where($model_match.'.source',$source['source'])
                     ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.type'=>0])//查询滚球赔率
                     //->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
@@ -849,42 +849,6 @@ class GetmatchData {
                 ->toarray();
         }
 
-
-//        foreach($matchData as $kk => $vv) {
-//            $oddsData = lm($model_match, "Sports")
-//                ->leftjoin($model_odds, $model_odds . '.match_id', $model_match . '.match_id')
-//                ->select($model_odds . '.id', 'odds_only','p_code', 'odds_code', $model_odds . '.status', 'odds', 'condition', 'sort')
-//                ->where($model_match.'.source',$source['source'])
-//                ->where([$model_odds . '.match_id' => $vv['match_id'], $model_odds . '.type' => 0])
-//                ->where($oddsTypeWhere)//追加查询各状态不同的赔率
-////                ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
-//                ->where(function ($query) use ($model_odds) {
-//                    $query->where($model_odds . '.odds_code', 'concede_home')
-//                        ->orWhere(function ($query) use ($model_odds) {
-//                            $query->where($model_odds . '.odds_code', 'concede_guest');
-//                        })
-//                        ->orWhere(function ($query) use ($model_odds) {
-//                            $query->where($model_odds . '.odds_code', 'size_home');
-//                        })
-//                        ->orWhere(function ($query) use ($model_odds) {
-//                            $query->where($model_odds . '.odds_code', 'size_guest');
-//                        });
-//                })
-//                ->get()
-//                ->toarray();
-//            //根据 排序 获取 最新让球/大小玩法赔率
-//            $sortData = array_column($oddsData,'sort');
-//            array_multisort($sortData,SORT_DESC,$oddsData);
-//
-//            $zu = [];
-//            foreach ($oddsData as $key1 =>$item1){
-//                $zu[$item1['p_code']][] = $item1;
-//            }
-//            $c_s = array_slice($zu['concede_size'],0,4);//让球/大小 前四条 放入
-//
-//            $matchData[$kk]['oddsData'] = $c_s;
-//        }
-
         //获取各球类默认赔率
         $game_code = $_REQUEST['game_code'];
         switch ($game_code) {