Ver Fonte

异常处理

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

+ 6 - 0
app/Http/Controllers/Admin/SportsbkController.php

@@ -264,6 +264,8 @@ class SportsbkController extends Controller {
 		$model = \App\Models\Stlqresult::where('match_id', $match_id)->first();
 		$model->update_time = date('Y-m-d H:i:s');
 			
+		//赛事状态
+		$match_status = intval($req->match_status)?intval($req->match_status):0;
 		$guestscore =array(
 			'1' => intval($req->okteamscore)?intval($req->okteamscore):0,//第一节客队比分
 			'2' => intval($req->tkteamscore)?intval($req->tkteamscore):0,//第二节客队比分
@@ -287,6 +289,10 @@ class SportsbkController extends Controller {
 		$status = 2;
 		//追加判断比分 如果都== -1,则作废该赛事
 		if($guestscore[1] < 0 and $guestscore[2] < 0 and $guestscore[3] < 0 and $guestscore[4] < 0 and $homescore[1] < 0 and $homescore[2] < 0 and $homescore[3] < 0 and $homescore[4] < 0 ){
+			//如果赛事已结算,不可作废
+			if($match_status == 3){
+				return responseToJson(-20002);
+			}
 			//赛事下单式注单作废,串关注单下此赛事按平局处理
 			$upapp = new \App\Models\SportsNoteList();
 			$upapp->delorder($match_id,'lq');

+ 6 - 1
app/Http/Controllers/Admin/SportsbqController.php

@@ -293,7 +293,8 @@ class SportsbqController extends Controller {
 		$num = $req->num;
 		$match_id = $req->match_id;
 		$newapp = new \App\Models\Stbqresult();
-
+		//赛事状态
+		$match_status = intval($req->match_status)?intval($req->match_status):0;
 		// $data['update_time'] = data('Y-m-d H:i:s');//更新时间
 		$data['u_home_score'] = intval($req->u_home_score)?intval($req->u_home_score):0;
 		$data['u_guest_score'] = intval($req->u_guest_score)?intval($req->u_guest_score):0;
@@ -304,6 +305,10 @@ class SportsbqController extends Controller {
 		$status = 2;
 		//追加判断比分 如果都== -1,则作废该赛事
 		if($data['u_home_score'] < 0 and $data['u_guest_score'] < 0 and $data['home_score'] < 0 and $data['guest_score'] < 0){
+			//如果赛事已结算,不可作废
+			if($match_status == 3){
+				return responseToJson(-20002);
+			}
 			//赛事下单式注单作废,串关注单下此赛事按平局处理
 			$upapp = new \App\Models\SportsNoteList();
 			$upapp->delorder($match_id,'bq');

+ 7 - 0
app/Http/Controllers/Admin/SportsfootController.php

@@ -806,6 +806,9 @@ class SportsfootController extends Controller {
 		$match_id = $req->match_id;
 		$newapp = new \App\Models\Stzqresult();
 		
+		//赛事状态
+		$match_status = intval($req->match_status)?intval($req->match_status):0;
+
 		$data['u_home_score'] = intval($req->u_home_score)?intval($req->u_home_score):0;
 		$data['u_guest_score'] = intval($req->u_guest_score)?intval($req->u_guest_score):0;
 		$data['home_score'] = intval($req->home_score)?intval($req->home_score):0;
@@ -816,6 +819,10 @@ class SportsfootController extends Controller {
 		$status = 2;
 		//追加判断比分 如果都== -1,则作废该赛事
 		if($data['u_home_score'] < 0 and $data['u_guest_score'] < 0 and $data['home_score'] < 0 and $data['guest_score'] < 0){
+			//如果赛事已结算,不可作废
+			if($match_status == 3){
+				return responseToJson(-20002);
+			}
 			//赛事下单式注单作废,串关注单下此赛事按平局处理
 			$upapp = new \App\Models\SportsNoteList();
 			$upapp->delorder($match_id,'zq');

+ 6 - 0
app/Http/Controllers/Admin/SportswqController.php

@@ -283,6 +283,8 @@ class SportswqController extends Controller {
 	function updatascore(Req $req){
 		$match_id = $req->match_id;//节数唯一标识
 
+		//赛事状态
+		$match_status = intval($req->match_status)?intval($req->match_status):0;
 		$model = \App\Models\Stwqresult::where('match_id', $match_id)->first();
 		$model->update_time = date('Y-m-d H:i:s');
 		$model->home_player_score = intval($req->home_player_score)?intval($req->home_player_score):0;//主队比分
@@ -294,6 +296,10 @@ class SportswqController extends Controller {
 		$status = 2;
 		//追加判断比分 如果都== -1,则作废该赛事
 		if($req->home_player_score < 0 and $req->guest_player_score < 0 ){
+			//如果赛事已结算,不可作废
+			if($match_status == 3){
+				return responseToJson(-20002);
+			}
 			//赛事下单式注单作废,串关注单下此赛事按平局处理
 			$upapp = new \App\Models\SportsNoteList();
 			$upapp->delorder($match_id,'wq');

+ 5 - 0
resources/lang/zh-cn/error.php

@@ -422,4 +422,9 @@ return [
      * 赛事规则管理
      */
     '-20001' =>'该组已有相关文档,不能添加',
+
+    /**
+     * 赛事作废
+     */
+    '-20002' => '赛事已结算,不能进行作废操作',
 ];

+ 8 - 1
resources/views/admin/Sportsbq/outcome.blade.php

@@ -23,6 +23,7 @@
             <input type="text" style="width:30px;heigth:20px" id="u_guest_score@{{d.match_id}}" name="u_guest_score" value="@{{d.u_guest_score}}"> / 
             <input type="text" style="width:30px;heigth:20px" id="home_score@{{d.match_id}}" name="home_score" value="@{{d.home_score}}">
             <input type="text" style="width:30px;heigth:20px" id="guest_score@{{d.match_id}}" name="guest_score" value="@{{d.guest_score}}">
+            <input type="hidden" style="width:30px;heigth:20px" id="match_status@{{d.match_id}}" name="guest_score" value="@{{d.status}}">
             <button class="layui-icon" onclick="teamscore(@{{d.match_id}})"><h6>提交</h6></button>
     </script>
 
@@ -315,6 +316,8 @@
             var u_guest_score = document.getElementById("u_guest_score"+match_id).value;
             var home_score = document.getElementById("home_score"+match_id).value;
             var guest_score = document.getElementById("guest_score"+match_id).value;
+            var match_status = document.getElementById("match_status"+match_id).value;
+
             // var reg = /^[0-99]\d*$/;
 
             // if(reg.test(num)==false){ 
@@ -326,12 +329,16 @@
                 type: 'POST',
                 dataType: 'json',
                 url: '/admin/Sportsbq/updatascore',
-                data: {match_id:match_id,u_home_score:u_home_score,u_guest_score:u_guest_score,home_score:home_score,guest_score:guest_score},
+                data: {match_id:match_id,u_home_score:u_home_score,u_guest_score:u_guest_score,home_score:home_score,guest_score:guest_score,match_status:match_status},
                 success: function(data) {
+                    /*
                     if(data.status==1){
                         layer.msg(data.msg);
                         location. reload()//刷新当前页面
                     }
+                    */
+                    layer.msg(data.msg);
+                    location. reload()//刷新当前页面
                 }
             })
         }

+ 8 - 1
resources/views/admin/Sportswq/outcome.blade.php

@@ -16,6 +16,7 @@
     <script type="text/html" id="matchscore"> 
             <input type="text" style="width:30px;heigth:20px" id="home_player_score@{{d.match_id}}" name="home_player_score" value="@{{d.home_player_score}}"> /
             <input type="text" style="width:30px;heigth:20px" id="guest_player_score@{{d.match_id}}" name="guest_player_score" value="@{{d.guest_player_score}}">
+            <input type="hidden" style="width:30px;heigth:20px" id="match_status@{{d.match_id}}" name="guest_score" value="@{{d.status}}">
             <button class="layui-icon" onclick="inputscore(@{{d.match_id}})"><h6>提交</h6></button>
     </script>
 
@@ -294,6 +295,8 @@
             // var reg = /^[0-99]\d*$/;
             var guest_player_score = $("#guest_player_score"+match_id).val();
             var home_player_score = $("#home_player_score"+match_id).val();
+            var match_status = document.getElementById("match_status"+match_id).value;
+
 
             // if(reg.test(num)==false){ 
             //     layer.msg('不能为空值');
@@ -304,12 +307,16 @@
                 type: 'POST',
                 dataType: 'json',
                 url: '/admin/Sportswq/updatascore',
-                data: {match_id:match_id,guest_player_score:guest_player_score,home_player_score:home_player_score},
+                data: {match_id:match_id,guest_player_score:guest_player_score,home_player_score:home_player_score,match_status:match_status},
                 success: function(data) {
+                    /*
                     if(data.status==1){
                         layer.msg(data.msg);
                         location. reload()//刷新当前页面
                     }
+                    */
+                    layer.msg(data.msg);
+                    location. reload()//刷新当前页面
                 }
             })
         }

+ 8 - 1
resources/views/admin/sportsbk/outcome.blade.php

@@ -191,6 +191,7 @@
         <input type="text" style="width:30px;heigth:20px" id="skteamscore@{{d.match_id}}" name="skteamscore" value="@{{d.skteamscore}}"> / 
         <input type="text" style="width:30px;heigth:20px" id="azteamscore@{{d.match_id}}" name="azteamscore" value="@{{d.azteamscore}}">
         <input type="text" style="width:30px;heigth:20px" id="akteamscore@{{d.match_id}}" name="akteamscore" value="@{{d.akteamscore}}">
+        <input type="hidden" style="width:30px;heigth:20px" id="match_status@{{d.match_id}}" name="guest_score" value="@{{d.status}}">
         <button class="layui-icon" onclick="teamscore(@{{d.match_id}})"><h6>提交</h6></button>
     </script>
 
@@ -518,6 +519,8 @@
             var szteamscore = $("#szteamscore"+match_id).val();
             var akteamscore = $("#akteamscore"+match_id).val();
             var azteamscore = $("#azteamscore"+match_id).val();
+            var match_status = document.getElementById("match_status"+match_id).value;
+
 
             // if(reg.test(num)==false){ 
             //     layer.msg('不能为空值');
@@ -528,12 +531,16 @@
                 type: 'POST',
                 dataType: 'json',
                 url: '/admin/Sportsbk/updatascore',
-                data: {match_id:match_id,okteamscore:okteamscore,ozteamscore:ozteamscore,tkteamscore:tkteamscore,tzteamscore:tzteamscore,skteamscore:skteamscore,szteamscore:szteamscore,akteamscore:akteamscore,azteamscore:azteamscore},
+                data: {match_id:match_id,okteamscore:okteamscore,ozteamscore:ozteamscore,tkteamscore:tkteamscore,tzteamscore:tzteamscore,skteamscore:skteamscore,szteamscore:szteamscore,akteamscore:akteamscore,azteamscore:azteamscore,match_status:match_status},
                 success: function(data) {
+                    /*
                     if(data.status==1){
                         layer.msg(data.msg);
                         location. reload()//刷新当前页面
                     }
+                    */
+                    layer.msg(data.msg);
+                    location. reload()//刷新当前页面
                 }
             })
         }

+ 8 - 1
resources/views/admin/sportsfoot/outcome.blade.php

@@ -77,6 +77,7 @@
             <input type="text" style="width:30px;heigth:20px" id="u_guest_score@{{d.match_id}}" name="u_guest_score" value="@{{d.u_guest_score}}"> /
             <input type="text" style="width:30px;heigth:20px" id="home_score@{{d.match_id}}" name="home_score" value="@{{d.home_score}}">
             <input type="text" style="width:30px;heigth:20px" id="guest_score@{{d.match_id}}" name="guest_score" value="@{{d.guest_score}}">
+            <input type="hidden" style="width:30px;heigth:20px" id="match_status@{{d.match_id}}" name="guest_score" value="@{{d.status}}">
             <button class="layui-icon" onclick="inputscore(@{{d.match_id}})"><h6>提交</h6></button>
     </script>
 
@@ -334,6 +335,7 @@
             var u_guest_score = document.getElementById("u_guest_score"+match_id).value;
             var home_score = document.getElementById("home_score"+match_id).value;
             var guest_score = document.getElementById("guest_score"+match_id).value;
+            var match_status = document.getElementById("match_status"+match_id).value;
 
             if(home_score<u_home_score || guest_score<u_guest_score){
                 layer.msg('请输入正确的全场比分');
@@ -344,12 +346,17 @@
                 type: 'POST',
                 dataType: 'json',
                 url: '/admin/Sportsfoot/updatenum',
-                data: {match_id:match_id,u_home_score:u_home_score,u_guest_score:u_guest_score,home_score:home_score,guest_score:guest_score},
+                data: {match_id:match_id,u_home_score:u_home_score,u_guest_score:u_guest_score,home_score:home_score,guest_score:guest_score,match_status:match_status},
                 success: function(data) {
+                    /*
                     if(data.status==1){
                         layer.msg(data.msg);
                         location. reload()//刷新当前页面
                     }
+                    */
+                    layer.msg(data.msg);
+                    location. reload()//刷新当前页面
+
                 }
             })
         }