Forráskód Böngészése

追加推送 6/10

彭俊 6 éve
szülő
commit
983b150eff

+ 23 - 5
Application/Api/Controller/Betorder.php

@@ -38,16 +38,14 @@ class Betorder extends BaseController{
         foreach ($last as $k =>$v){
             foreach ($v as $kk =>$vv){
                 $num = $kk+1;
+                //验证联赛是否存在
+                $this->verify_league($vv['ballId'],$vv['lg_id'],$num);
                 //验证赛事是否存在
                 $this->verify_match($vv['ballId'],$vv['match_id'],$num);
                 //验证球类代码是否有效
                 $this->verify_gameType($vv['ballId'],$num);
                 //验证赛事下赔率玩法是否有效
                 $this->verify_odds($vv['ballId'],$vv['odds_only'],$vv['odds'],$vv['condition'],$num);
-//                if(empty($vv['condition'])){
-//                    $msg = '第'.$num.'条'.lang('Errors','Api')->get('error-5110');
-//                    Render([], '5110',$msg);
-//                }
             }
         }
         foreach($res as $k => $v){
@@ -233,6 +231,26 @@ class Betorder extends BaseController{
         return $result['data'];
     }
 
+    //验证联赛是否存在
+    public function verify_league($game_code,$lg_id,$num = 1){
+        if(empty($lg_id)){
+            $msg = '第'.$num.'条'.lang('Errors','Api')->get('error-5112');
+            Render([], '5112',$msg);
+        }
+
+        //根据球类代码 获取相关model
+        $model = $this->commonFunction->getModels($game_code);
+        $model_league = $model['model_league'];
+        $info = lm($model_league,'Sports')
+            ->select('id')
+            ->where('id',$lg_id)
+            ->first();
+        if(empty($info)){
+            $msg = '第'.$num.'条'.lang('Errors','Api')->get('error-5113');
+            Render([], '5113',$msg);
+        }
+    }
+
     /**
      * 赛事是否存在或结束
      * @param  [type] $game_code 球类代码
@@ -334,7 +352,7 @@ class Betorder extends BaseController{
      * $userInfo 用户数据
      * $batch_id 批次号
      */
-    public function stringBet($data_str=[],$data_all=[],$userInfo=[],$batch_id=23456){
+    public function stringBet($data_str=[],$data_all=[],$userInfo=[],$batch_id=0){
         //验证串式投注是否合法
         $this->verify_stringType($data_all);
         //获取串式 总赛事数量

+ 2 - 0
Application/Api/Lang/Errors.php

@@ -247,6 +247,8 @@ return array(
     'error-5109' => '赛事ID为空',
     'error-5110' => '赔率条件为空',
     'error-5111' => '赔率唯一ID为空',
+    'error-5112' => '联赛ID为空',
+    'error-5113' => '联赛不存在',
 
 
 

+ 8 - 5
Application/Sports/Controller/MatchListWeb.php

@@ -66,7 +66,7 @@ class MatchListWeb extends Controller{
     //获取滚球
     public function getRollBall($type,$game_code,$p_code){
         //根据球类代码及玩法代码 获取相关赛事赔率数据
-        if(!empty($game_code) and !empty($p_code)){
+        if(!empty($game_code)){
             $matchData = $this->getMatchData($type,$game_code,$p_code);
 
             Render($matchData, '1', lang('Tips','Sports')->get('success'));
@@ -134,6 +134,7 @@ class MatchListWeb extends Controller{
 
         $select = [$models['model_match'].'.match_id'];
         $timeWhere = [];
+        //如果有传玩法代码,则获取查询字段
         if($p_code){
             //时间条件
             if(!empty($time)){
@@ -149,7 +150,10 @@ class MatchListWeb extends Controller{
                 $select = [$models['model_league'].'.lg_id',$models['model_league'].'.name_chinese as leagueName',$models['model_match'].'.match_id','home_team','guest_team','match_date','match_time','tag','country_id','area_id'];
             }
         }
-
+        //如果是滚球
+        if($type == 'StRollBall'){
+            $select = [$models['model_league'].'.lg_id',$models['model_league'].'.name_chinese as leagueName',$models['model_match'].'.match_id','home_team','guest_team','match_date','match_time','tag','country_id','area_id'];
+        }
         //赛事数据
         $matchNum = lm($models['model_league'],"Sports")
             ->join($models['model_match'],$models['model_match'].'.lg_id',$models['model_league'].'.lg_id')
@@ -158,10 +162,9 @@ class MatchListWeb extends Controller{
             ->where($where)
             ->where($timeWhere)
             ->get()->toArray();
-        //
 
         //赔率数据
-        $oddsCodeNum = $this->getOddsData($game_code,$models['model_odds'],$matchNum,$p_code);
+        $oddsCodeNum = $this->getOddsData($game_code,$models['model_odds'],$matchNum,$p_code,$type);
         if($p_code){
             $match_odds = [];
             if($p_code == 'kemp'){
@@ -319,7 +322,7 @@ class MatchListWeb extends Controller{
         return $oddsCodeNum;
     }
     //根据match_id获取赔率数据
-    public function getOddsData($game_code,$model_odds,$match_ids,$p_code=''){
+    public function getOddsData($game_code,$model_odds,$match_ids,$p_code='',$type=''){
         $match_id = [];
         $lg_ids = [];
         foreach ($match_ids as $k => $v){