彭俊 6 anni fa
parent
commit
f2b7b034d3

+ 29 - 10
Application/Sports/Model/St_zq_competition.php

@@ -35,6 +35,7 @@ class St_zq_competition extends Model
     public static function getRollMatchDataAll($source,$models,$where,$lg_ids=[],$ret){
         $model_match = $models['model_match'];
         $model_result = $models['model_result'];
+        $game_code = $ret['game_code'];
 
         $select = [$model_match.'.lg_id',$model_match.'.id as match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team'];
 
@@ -55,15 +56,32 @@ class St_zq_competition extends Model
         $result_record = $models['model_result_record'];
 
         //如果是网球
-        if($result_record == 'st_wq_result_record'){
-            $sql = "select a.match_id,a.home_player_score,a.guest_player_score,a.match_time as a_time,a.match_process from $result_record a,
+//         if($result_record == 'st_wq_result_record'){
+//             $sql = "select a.match_id,a.home_player_score,a.guest_player_score,a.match_time as a_time,a.match_process from $result_record a,
+// (select match_id,max(id) id from $result_record where match_id IN ($match_ids_str) group by match_id)b
+// where a.match_id = b.match_id and a.id = b.id ";
+//         }else{
+//             $sql = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process from $result_record a,
+//             (select match_id,max(id) id from $result_record where match_id IN ($match_ids_str) group by match_id)b
+//             where a.match_id = b.match_id and a.id = b.id ";
+//         }
+ //如果是网球
+ if($game_code == 'wq'){
+    $sql = "select a.match_id,a.home_player_score,a.guest_player_score,a.match_time as a_time,a.match_process,a.result_mark from $result_record a,
 (select match_id,max(id) id from $result_record where match_id IN ($match_ids_str) group by match_id)b
 where a.match_id = b.match_id and a.id = b.id ";
-        }else{
-            $sql = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process from $result_record a,
-            (select match_id,max(id) id from $result_record where match_id IN ($match_ids_str) group by match_id)b
-            where a.match_id = b.match_id and a.id = b.id ";
-        }
+}else
+//如果是棒球
+if($game_code == 'bq'){
+    $sql = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process,a.result_mark from $result_record a,
+(select match_id,max(id) id from $result_record where match_id IN ($match_ids_str) group by match_id)b
+where a.match_id = b.match_id and a.id = b.id ";
+}else{
+    //其他球类
+    $sql = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process from $result_record a,
+(select match_id,max(id) id from $result_record where match_id IN ($match_ids_str) group by match_id)b
+where a.match_id = b.match_id and a.id = b.id ";
+}
         $match_result_record = S ('DB')->select ($sql);
 
         //处理赛事数据,追加比分及进程
@@ -84,7 +102,8 @@ where a.match_id = b.match_id and a.id = b.id ";
                             $matchData[$k]['match_process'] = $vv->match_process?:C()->get('commonFunction')->getMatchProcess( $matchData[$k]['a_time'],$ret['game_code']);
                         }
                     }
-                }else{
+                }
+                else{
                      //如果是网球
                      if($model_result == 'st_wq_result'){
                         $matchData[$k]['home_player_score'] = 0;
@@ -93,8 +112,8 @@ where a.match_id = b.match_id and a.id = b.id ";
                         $matchData[$k]['home_score'] = 0;
                         $matchData[$k]['guest_score'] = 0;
                     }
-                    $matchData[$k]['a_time'] = 0;
-                    $matchData[$k]['match_process'] = '';
+                    $matchData[$k]['a_time'] = C()->get('commonFunction')->getMatchTime($v['match_date'],$v['match_time']);
+                    $matchData[$k]['match_process'] = C()->get('commonFunction')->getMatchProcess( $matchData[$k]['a_time'],$ret['game_code']);
                 }
                 
             }

+ 32 - 7
Biz/Common/CommonFunction.php

@@ -1149,6 +1149,13 @@ class CommonFunction {
     * $type 投注类型 1单式 
     */
    function getEarnMoney($game_code='',$p_code='',$odds=0,$bet_amount=0,$type=0){
+       /*
+       可赢额直接乘以赔率的父级玩法有
+        足球:球队进球数:大/小 进球:大/小 让球
+        篮球:让球   总分:大/小   球队得分大小
+        网球:让盘   让局    总局数:大/小
+        棒球:让球   总得分:大/小
+       */
         //单式投注
         if($type == 1){
             //足球 可赢金额 计算规则
@@ -1164,18 +1171,36 @@ class CommonFunction {
             }
             //篮球 可赢金额 计算规则
             if($game_code == 'lq'){
-                //可赢金额 = 赔率*投注金额
-                $prize_money = $odds*$bet_amount;
+                //让球   总分:大/小   球队得分大小
+                if($p_code == 'total_size' || $p_code == 'team_score' || $p_code == 'concede'){
+                    //可赢金额 = 赔率*投注金额
+                    $prize_money = $odds*$bet_amount;
+                }else{
+                    //可赢金额 = (赔率-1)*投注金额
+                    $prize_money = ($odds-1)*$bet_amount;
+                }
             }
             //网球 可赢金额 计算规则
             if($game_code == 'wq'){
-                //可赢金额 = 赔率*投注金额
-                $prize_money = $odds*$bet_amount;
+                //让盘   让局    总局数:大/小
+                if($p_code == 'dishes' || $p_code == 'bureau' || $p_code == 'total_number'){
+                    //可赢金额 = 赔率*投注金额
+                    $prize_money = $odds*$bet_amount;
+                }else{
+                    //可赢金额 = (赔率-1)*投注金额
+                    $prize_money = ($odds-1)*$bet_amount;
+                }
             }
-            //棒球 可赢金额 计算规则
+            //棒球
             if($game_code == 'bq'){
-                //可赢金额 = 赔率*投注金额
-                $prize_money = $odds*$bet_amount;
+                //让球   总得分:大/小
+                if($p_code == 'concede' || $p_code == 'total_size'){
+                    //可赢金额 = 赔率*投注金额
+                    $prize_money = $odds*$bet_amount;
+                }else{
+                    //可赢金额 = (赔率-1)*投注金额
+                    $prize_money = ($odds-1)*$bet_amount;
+                }
             }
         }