|
@@ -148,17 +148,18 @@ trait RulePlus
|
|
|
|
|
|
|
|
|
|
|
|
|
//type ==1 返回第$sn节 ==2返回上下节,sn=1上半场,sn=2下半场 type==4全部按节数的数组
|
|
//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 = [];
|
|
$return = [];
|
|
|
foreach ($recoreModesArray as $key => $val) {
|
|
foreach ($recoreModesArray as $key => $val) {
|
|
|
$nowsn = intval($val->match_process);
|
|
$nowsn = intval($val->match_process);
|
|
|
$return[$nowsn] = $val;
|
|
$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有错");
|
|
throw new \Exception("篮球结果不为4的数组,或match_process有错");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
if ($type == 4) {
|
|
if ($type == 4) {
|
|
|
return $return;
|
|
return $return;
|
|
|
}
|
|
}
|
|
@@ -183,6 +184,33 @@ trait RulePlus
|
|
|
return $ret;
|
|
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)
|
|
private function doexchage(&$num1, &$num2)
|
|
|
{
|
|
{
|