Ver Fonte

异常处理

彭俊 há 6 anos atrás
pai
commit
7830166670

+ 6 - 7
app/Http/Controllers/Api/WriteSportsController.php

@@ -120,11 +120,10 @@ class WriteSportsController extends BaseController{
         }
     }
 
-    //计算滚球 赛事进行时间
-    private function secTime($sec=0){
-        $min = floor($sec/60);
-        $res = $min.':'.($sec-$min*60);
-        return $res;
+
+    public function upMatch(Req $data){
+
+        echo 123;exit;
     }
 
     //写入直播 数据
@@ -337,7 +336,7 @@ class WriteSportsController extends BaseController{
             'sort'=> $data['sort']?:0,
             'p_code'=> $data['p_code']?:'',
             'odds'=> $data['odds']?:0,
-            'condition'=> $data['condition']?:'',
+            'condition'=> $data['condition'],
             'odds_only'=> $data['odds_only']?:'',
             'source'=> $data['source']?:'',
             'type'=> $data['type']?:0,
@@ -369,7 +368,7 @@ class WriteSportsController extends BaseController{
             'sort'=> $data['sort']?:0,
             'p_code'=> $data['p_code']?:'',
             'odds'=> $data['odds']?:0,
-            'condition'=> $data['condition']?:'',
+            'condition'=> $data['condition'],
             'odds_only'=> $data['odds_only']?:'',
             'sole'=> $data['sole']?:'',
             'source'=> $data['source']?:'',

+ 54 - 0
app/Lib/Settlement/Adapter/RulePlus.php

@@ -131,6 +131,60 @@ trait RulePlus
         return $returnDatas;
     }
 
+    //独赢  $halftype 1上半场  4全场      $homeguest=1主队 2客队   $homeguest 1主队赢 2客队赢 3平
+    public function zq_duyingv2($homeguest, $halfalltype, $resultModel, $matchResultWord)
+    {
+        $home_score = intval($resultModel->home_score);
+        $guest_score = intval($resultModel->guest_score);
+        $home_score_half = intval($resultModel->u_home_score);
+        $guest_score_half = intval($resultModel->u_guest_score);
+
+        $returnDatas['matchResult'] = $matchResultWord;
+        if ($halfalltype == 4) {
+            if ($homeguest == 1) {
+                if ($home_score > $guest_score) {
+                    $returnDatas['result'] = 1;
+                } else {
+                    $returnDatas['result'] = -1;
+                }
+            } elseif ($homeguest == 2) {
+                if ($guest_score > $home_score) {
+                    $returnDatas['result'] = 1;
+                } else {
+                    $returnDatas['result'] = -1;
+                }
+            } else {
+                if ($guest_score == $home_score) {
+                    $returnDatas['result'] = 1;
+                } else {
+                    $returnDatas['result'] = -1;
+                }
+            }
+        } else {
+            if ($homeguest == 1) {
+                if ($home_score_half > $guest_score_half) {
+                    $returnDatas['result'] = 1;
+                } else {
+                    $returnDatas['result'] = -1;
+                }
+            } elseif ($homeguest == 2) {
+                if ($guest_score_half > $home_score_half) {
+                    $returnDatas['result'] = 1;
+                } else {
+                    $returnDatas['result'] = -1;
+                }
+            } else {
+                if ($guest_score_half == $home_score_half) {
+                    $returnDatas['result'] = 1;
+                } else {
+                    $returnDatas['result'] = -1;
+                }
+            }
+        }
+        return $returnDatas;
+    }
+
+
     //单双判断  $type 1单  2双
     public function zq_doublesing($score, $condition, $matchResultWord)
     {

+ 23 - 23
app/Lib/Settlement/Adapter/ZqRule.php

@@ -27,8 +27,8 @@ class ZqRule
         $resultModel = $resultModels['0'];
         $home = intval($resultModel->home_score);
         $guest = intval($resultModel->guest_score);
-        $word = $home.'-'.$guest.'(全场)';
-        $ret = $this->zq_letball($home,$model->condition,$word);
+        $word = $home . '-' . $guest . '(全场)';
+        $ret = $this->zq_letball($home - $guest, $model->condition, $word);
         return $ret;
     }
 
@@ -44,8 +44,8 @@ class ZqRule
         $resultModel = $resultModels['0'];
         $home = intval($resultModel->home_score);
         $guest = intval($resultModel->guest_score);
-        $word = $home.'-'.$guest.'(全场)';
-        $ret = $this->zq_letball($guest,$model->condition,$word);
+        $word = $home . '-' . $guest . '(全场)';
+        $ret = $this->zq_letball($guest - $home, $model->condition, $word);
         return $ret;
     }
 
@@ -62,8 +62,8 @@ class ZqRule
         $resultModel = $resultModels['0'];
         $home = intval($resultModel->u_home_score);
         $guest = intval($resultModel->u_guest_score);
-        $word = $home.'-'.$guest.'(上半场)';
-        $ret = $this->zq_letball($home,$model->condition,$word);
+        $word = $home . '-' . $guest . '(上半场)';
+        $ret = $this->zq_letball($home - $guest, $model->condition, $word);
         return $ret;
     }
 
@@ -79,8 +79,8 @@ class ZqRule
         $resultModel = $resultModels['0'];
         $home = intval($resultModel->u_home_score);
         $guest = intval($resultModel->u_guest_score);
-        $word = $home.'-'.$guest.'(上半场)';
-        $ret = $this->zq_letball($guest,$model->condition,$word);
+        $word = $home . '-' . $guest . '(上半场)';
+        $ret = $this->zq_letball($guest - $home, $model->condition, $word);
         return $ret;
 
     }
@@ -98,9 +98,9 @@ class ZqRule
         $resultModel = $resultModels['0'];
         $home = intval($resultModel->u_home_score);
         $guest = intval($resultModel->u_guest_score);
-        $total = $home +$guest;
-        $word = $home.'-'.$guest.'(全场)';
-        $ret = $this->zq_inball_bigsmall($total,$model->condition,2,$word);
+        $total = $home + $guest;
+        $word = $home . '-' . $guest . '(全场)';
+        $ret = $this->zq_inball_bigsmall($total, $model->condition, 2, $word);
         return $ret;
         //return $this->sizeFull($model, $resultModel, $resultRecords, 0, 1);
     }
@@ -244,7 +244,7 @@ class ZqRule
         $home = intval($resultModel->home_score);
         $guest = intval($resultModel->guest_score);
         $word = $home . '-' . $guest . '(全场)';
-        $ret = $this->zq_duying($home, $model->condition, $word);
+        $ret = $this->zq_duyingv2(1, 4, $resultModel, $word);
         return $ret;
     }
 
@@ -261,7 +261,7 @@ class ZqRule
         $home = intval($resultModel->home_score);
         $guest = intval($resultModel->guest_score);
         $word = $home . '-' . $guest . '(全场)';
-        $ret = $this->zq_duying($guest, $model->condition, $word);
+        $ret = $this->zq_duyingv2(2, 4, $resultModel, $word);
         return $ret;
     }
 
@@ -298,7 +298,7 @@ class ZqRule
     {
         $resultModel = $resultModels['0'];
         $word = $resultModel->u_home_score . '-' . $resultModel->u_guest_score . '(上半场)';
-        return $this->zq_duying($resultModel->u_home_score, $model->condition, $word);
+        return $this->zq_duyingv2(1, 1, $resultModel, $word);
 
     }
 
@@ -313,7 +313,7 @@ class ZqRule
     {
         $resultModel = $resultModels['0'];
         $word = $resultModel->u_home_score . '-' . $resultModel->u_guest_score . '(上半场)';
-        return $this->zq_duying($resultModel->u_guest_score, $model->condition, $word);
+        return $this->zq_duyingv2(2, 1, $resultModel, $word);
 
     }
 
@@ -913,10 +913,10 @@ class ZqRule
                 $returnDatas = $this->zq_inball_bigsmall($game_ret->guest - $game_ret->home, $model->condition, 1, $word);
                 break;
             case "corner_capot_home":
-                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(1, 4, $resultModel, $word);
                 break;
             case "corner_capot_guest":
-                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(2, 4, $resultModel, $word);
                 break;
             case "corner_capot_dogfall":
                 $returnDatas['result'] = ($game_ret->home == $game_ret->guest) ? 1 : -1;
@@ -960,10 +960,10 @@ class ZqRule
                 $returnDatas = $this->zq_inball_bigsmall($game_ret->guest_half - $game_ret->home_half, $model->condition, 1, $word);
                 break;
             case "corner_half_capot_home":
-                $returnDatas = $this->zq_duying($game_ret->home_half, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(1, 1, $resultModel, $word);
                 break;
             case "corner_half_capot_guest":
-                $returnDatas = $this->zq_duying($game_ret->hom_halfe, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(2, 1, $resultModel, $word);
                 break;
             case "corner_half_capot_dogfall":
                 $returnDatas['result'] = ($game_ret->home_half == $game_ret->guest_half) ? 1 : -1;
@@ -1026,10 +1026,10 @@ class ZqRule
                 $returnDatas = $this->zq_inball_bigsmall($game_ret->guest_half - $game_ret->home_half, $model->condition, 1, $word);
                 break;
             case "penalty_half_capot_home":
-                $returnDatas = $this->zq_duying($game_ret->home_half, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(1, 1, $resultModel, $word);
                 break;
             case "penalty_half_capot_guest":
-                $returnDatas = $this->zq_duying($game_ret->hom_halfe, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(2, 1, $resultModel, $word);
                 break;
             case "penalty_half_capot_dogfall":
                 $returnDatas['result'] = ($game_ret->home_half == $game_ret->guest_half) ? 1 : -1;
@@ -1072,10 +1072,10 @@ class ZqRule
                 $returnDatas = $this->zq_inball_bigsmall($game_ret->guest - $game_ret->home, $model->condition, 1, $word);
                 break;
             case "penalty_capot_home":
-                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(1, 4, $resultModel, $word);
                 break;
             case "penalty_capot_guest":
-                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                $returnDatas = $this->zq_duyingv2(2, 4, $resultModel, $word);
                 break;
             case "penalty_capot_dogfall":
                 $returnDatas['result'] = ($game_ret->home == $game_ret->guest) ? 1 : -1;

+ 1 - 0
routes/api.php

@@ -43,6 +43,7 @@ $routes=array(
     'ogsports'=>exeApi('api', 'Oggame_sport','getPipelineRecord'),
     'fygame'=>exeApi('api', 'fyGame','getBetting'),
     'setSports'=>exeApi('api', 'WriteSports','setSports'),
+    'upMatch'=>exeApi('api', 'WriteSports','upMatch'),
 );
 
 

+ 4 - 0
routes/web.php

@@ -28,6 +28,10 @@ Route::get('/', function () {
 Route::post('/setSports', function () {
     return appExec('api', 'WriteSports', 'setSports');
 });
+//更新赛事状态
+Route::post('/upMatch', function () {
+    return appExec('api', 'WriteSports', 'upMatch');
+});
 
 
 /**