彭俊 преди 6 години
родител
ревизия
d407265c22
променени са 2 файла, в които са добавени 41 реда и са изтрити 39 реда
  1. 26 25
      app/Http/Controllers/Admin/SportsfootController.php
  2. 15 14
      app/Lib/Settlement/Adapter/ZqRule.php

+ 26 - 25
app/Http/Controllers/Admin/SportsfootController.php

@@ -199,16 +199,16 @@ class SportsfootController extends Controller {
         	unset($alldata['_token']);
         	$all_goal = intval($alldata['home_score'])+intval($alldata['guest_score']);//总进球数
         	$penaltycard = array(
-        		'home'=>$alldata['homeallcard'],
-        		'guest'=>$alldata['guestallcard'],
-        		'home_half'=>$alldata['homehalfcard'],
-        		'guest_half'=>$alldata['guesthalfcard'],
+        		'home'=>intval($alldata['homeallcard'])?intval($alldata['homeallcard']):0,
+        		'guest'=>intval($alldata['guestallcard'])?intval($alldata['guestallcard']):0,
+        		'home_half'=>intval($alldata['homehalfcard'])?intval($alldata['homehalfcard']):0,
+        		'guest_half'=>intval($alldata['guesthalfcard']),
         	);
         	$cornerball = array(
-        		'home'=>$alldata['homeallcorner'],
-        		'guest'=>$alldata['guestallcorner'],
-        		'home_half'=>$alldata['homehalfcorner'],
-        		'guest_half'=>$alldata['guesthalfcorner'],
+        		'home'=>intval($alldata['homeallcorner']),
+        		'guest'=>intval($alldata['guestallcorner']),
+        		'home_half'=>intval($alldata['homehalfcorner']),
+        		'guest_half'=>intval($alldata['guesthalfcorner']),
         	);
 
         	$ret = \App\Models\Stzqresult::updateOrCreate(['match_id'=>$match_id],array_merge($alldata,['match_time'=>'00:01','update_time'=>date('Y-m-d H:i:s'),'all_goal'=>$all_goal,'penalty_card'=>json_encode($penaltycard),'corner_ball'=>json_encode($cornerball)]));
@@ -250,25 +250,26 @@ class SportsfootController extends Controller {
 		$num = $req->num;
 		$match_id = $req->match_id;
 		$newapp = new \App\Models\Stzqresult();
-		if($type==1){
-			$data['u_home_score'] = $num;
-			$res = $newapp->updateInfo($data,$id);//联赛id
-             $this->addcomendnotice($match_id);
-		}else if($type==2){
-			$data['u_guest_score'] = $num;
-			$res = $newapp->updateInfo($data,$id);//联赛id
-			$this->addcomendnotice($match_id);
-		}else if($type==3){
-			$data['home_score'] = $num;
-			$res = $newapp->updateInfo($data,$id);//联赛id
-			$this->addcomendnotice($match_id);
+		$update = $this->addcomendnotice($match_id);
+		if($update['status']==1){
+			if($type==1){
+				$data['u_home_score'] = $num;
+				$res = $newapp->updateInfo($data,$id);//联赛id
+			}else if($type==2){
+				$data['u_guest_score'] = $num;
+				$res = $newapp->updateInfo($data,$id);//联赛id
+			}else if($type==3){
+				$data['home_score'] = $num;
+				$res = $newapp->updateInfo($data,$id);//联赛id
+			}else{
+				$data['guest_score'] = $num;
+				$res = $newapp->updateInfo($data,$id);//联赛id
+			}
+			$newapp->totalgoal($match_id);
+			return responseToJson($res);
 		}else{
-			$data['guest_score'] = $num;
-			$res = $newapp->updateInfo($data,$id);//联赛id
-            $this->addcomendnotice($match_id);
+			return responseToJson($update);
 		}
-		$newapp->totalgoal($match_id);
-		return responseToJson($res);
 	}
 
 	//添加赛事结束纪录

+ 15 - 14
app/Lib/Settlement/Adapter/ZqRule.php

@@ -1185,8 +1185,8 @@ class ZqRule
      */
     public function corner_ball($model, $resultModels, $result_match_r)
     {
-        $odde_code = $model->odde_code;
-        $isHalf = strpos(strtolower($odde_code), 'half');
+        $odds_code = $model->odds_code;
+        $isHalf = strpos(strtolower($odds_code), 'half');
         if ($isHalf) {
             return $this->corner_ball_all($model, $resultModels, $result_match_r);
         } else {
@@ -1197,10 +1197,10 @@ class ZqRule
     public function corner_ball_all($model, $resultModels, $result_match_r)
     {
         $resultModel = $resultModels['0'];
-        if ($resultModel->conner_ball == '') {
+        if ($resultModel->corner_ball == '') {
             $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
         } else {
-            $game_ret = json_decode($resultModels->conner_ball);
+            $game_ret = json_decode($resultModel->corner_ball);
         }
         $word = $game_ret->home . '-' .$game_ret->guest . "(全场)";
         $returnDatas = ['result' => -1, 'matchResult' => $word];
@@ -1235,20 +1235,21 @@ class ZqRule
                 $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
                 break;
             default:
-                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)-'.$odds_code];
         }
         return $returnDatas;
     }
 
     public function corner_ball_half($model, $resultModels, $result_match_r)
     {
+
         $resultModel = $resultModels['0'];
-        if ($resultModel->conner_ball == '') {
+        if ($resultModel->corner_ball == '') {
             $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
         } else {
-            $game_ret = json_decode($resultModels->conner_ball);
+            $game_ret = json_decode($resultModel->corner_ball);
         }
-        $word = $game_ret->home . '-' .$game_ret->guest . "(上半场)";
+        $word = $game_ret->home_half . '-' .$game_ret->guest_half . "(上半场)";
         $returnDatas = ['result' => -1, 'matchResult' => $word];
 
         $odds_code = $model->odds_code;
@@ -1281,7 +1282,7 @@ class ZqRule
                 $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
                 break;
             default:
-                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)-'.$odds_code];
         }
         return $returnDatas;
     }
@@ -1313,9 +1314,9 @@ class ZqRule
         if ($resultModel->conner_ball == '') {
             $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
         } else {
-            $game_ret = json_decode($resultModels->conner_ball);
+            $game_ret = json_decode($resultModel->penalty_card);
         }
-        $word = $game_ret->home . '-' .$game_ret->guest . "(上半场)";
+        $word = $game_ret->home_half . '-' .$game_ret->guest_half . "(上半场)";
         $returnDatas = ['result' => -1, 'matchResult' => $word];
 
         $odds_code = $model->odds_code;
@@ -1348,7 +1349,7 @@ class ZqRule
                 $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
                 break;
             default:
-                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)-'.$odds_code];
         }
         return $returnDatas;
     }
@@ -1358,7 +1359,7 @@ class ZqRule
         if ($resultModel->conner_ball == '') {
             $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
         } else {
-            $game_ret = json_decode($resultModels->conner_ball);
+            $game_ret = json_decode($resultModel->penalty_card);
         }
         $word = $game_ret->home . '-' .$game_ret->guest . "(全场)";
         $returnDatas = ['result' => -1, 'matchResult' => $word];
@@ -1393,7 +1394,7 @@ class ZqRule
                 $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
                 break;
             default:
-                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)-'.$odds_code];
         }
         return $returnDatas;
     }