彭俊 6 éve
szülő
commit
a7a440d600

+ 1 - 1
app/Http/Controllers/Admin/SportsfootController.php

@@ -208,7 +208,7 @@ class SportsfootController extends Controller {
         		'home'=>intval($alldata['homeallcorner'])?intval($alldata['homeallcorner']):0,
         		'guest'=>intval($alldata['guestallcorner'])?intval($alldata['guestallcorner']):0,
         		'home_half'=>intval($alldata['homehalfcorner'])?intval($alldata['homehalfcorner']):0,
-        		'guest_half'=>intval($alldata['guesthalfcorner'])?intval($alldata['guesthalfcorner'])0,
+        	'guest_half'=>intval($alldata['guesthalfcorner'])?intval($alldata['guesthalfcorner']):0,
         	);
 
         	$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)]));

+ 1 - 0
app/Lib/Settlement/Adapter/LqRule.php

@@ -11,6 +11,7 @@ use Illuminate\Support\Facades\DB;
 
 class LqRule
 {
+    
     use RulePlus;
     /**
      * 让球公共函数

+ 30 - 2
app/Lib/Settlement/Adapter/RulePlus.php

@@ -148,17 +148,18 @@ trait RulePlus
 
 
     //type ==1 返回第$sn节   ==2返回上下节,sn=1上半场,sn=2下半场    type==4全部按节数的数组
-    public function lq_getResultBySn($recoreModesArray, $type=4, $sn = 1)
+    public function lq_getResultBySn($recoreModesArray, $type = 4, $sn = 1)
     {
         $return = [];
         foreach ($recoreModesArray as $key => $val) {
             $nowsn = intval($val->match_process);
             $return[$nowsn] = $val;
         }
-        if ( !((count($return) == 4 )  && isset($return['1'])  &&  isset($return['2'] )    &&  isset($return['3'])   &&  isset($return['4']))){
+        if (!((count($return) == 4) && isset($return['1']) && isset($return['2']) && isset($return['3']) && isset($return['4']))) {
             throw new  \Exception("篮球结果不为4的数组,或match_process有错");
         }
 
+
         if ($type == 4) {
             return $return;
         }
@@ -183,6 +184,33 @@ trait RulePlus
         return $ret;
     }
 
+    //篮球比分数据汇总,以方便后面使用
+    public function lq_scoreDatas($recoreModesArray)
+    {
+        $arr = $this->lq_getResultBySn($recoreModesArray);
+        $return = [
+            'list' => $arr,
+            'all' => ['home' => 0, 'guest' => 0],
+            'half' => ['home' => 0, 'guest' => 0],
+            'half2' => ['home' => 0, 'guest' => 0],
+        ];
+
+        foreach ($arr as $key => $val) {
+            $tmp_home = intval($val->home);
+            $tmp_guest = intval($val->guest);
+            $return['all']['home'] += $tmp_guest;
+            $return['all']['guest'] += $tmp_home;
+            if ($key == 1 || $key == 2) {
+                $return['half']['home'] += $tmp_home;
+                $return['half']['guest'] += $tmp_guest;
+            } else {
+                $return['half2']['home'] += $tmp_home;
+                $return['half2']['guest'] += $tmp_guest;
+            }
+        }
+        return $return;
+    }
+
 
     private function doexchage(&$num1, &$num2)
     {