|
|
@@ -256,6 +256,52 @@ trait RulePlus
|
|
|
}
|
|
|
$RecoedModel = $recoreModesArray['0'];
|
|
|
|
|
|
+ $imatch_id = $RecoedModel->match_id;
|
|
|
+ $truleResult = $RecoedModel->is_correct ? json_decode($RecoedModel->manual_result,true) :json_decode($RecoedModel->inning,true);
|
|
|
+
|
|
|
+ if (empty($truleResult)) {
|
|
|
+ throw new \Exception("篮球结果数据不正确,( matchid= $imatch_id 主客结果)应该为4场的数组");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ $return = [];
|
|
|
+ for ($i = 1; $i <= 4; $i++) {
|
|
|
+ $return[$i] = clone $RecoedModel;
|
|
|
+ $return[$i]->home_score = intval($truleResult[$i]['home']);
|
|
|
+ $return[$i]->guest_score = intval($truleResult[$i]['guest']);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($type == 4) {
|
|
|
+ return $return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($type == 1) {
|
|
|
+ return $return[$sn];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($type == 2) {
|
|
|
+ if ($sn == 1) {
|
|
|
+ $ret = [
|
|
|
+ $return[1],
|
|
|
+ $return[2],
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ $ret = [
|
|
|
+ $return[3],
|
|
|
+ $return[4],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $ret;
|
|
|
+ }
|
|
|
+ public function lq_getResultBySn_old($recoreModesArray, $type = 4, $sn = 1)
|
|
|
+ {
|
|
|
+ if (!isset($recoreModesArray['0'])) {
|
|
|
+ throw new \Exception("篮球结果不能为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $RecoedModel = $recoreModesArray['0'];
|
|
|
+
|
|
|
$imatch_id = $RecoedModel->match_id;
|
|
|
$home_all_datas = json_decode($RecoedModel->home_score, true);
|
|
|
$guest_all_datas = json_decode($RecoedModel->guest_score, true);
|
|
|
@@ -305,30 +351,16 @@ trait RulePlus
|
|
|
'half' => ['home' => 0, 'guest' => 0, 'home_rate' => 0, 'guest_rate' => 0],
|
|
|
'half2' => ['home' => 0, 'guest' => 0, 'home_rate' => 0, 'guest_rate' => 0],
|
|
|
];
|
|
|
+ $RecoedModel = $recoreModesArray['0'];
|
|
|
+ $truleResult = $RecoedModel->is_correct ? json_decode($RecoedModel->manual_result,true) :json_decode($RecoedModel->inning,true);
|
|
|
+
|
|
|
+ $return['all']['home'] = intval($truleResult['all']['home']);
|
|
|
+ $return['all']['guest'] = intval($truleResult['all']['guest']);
|
|
|
+ $return['half']['home'] = intval($truleResult['5']['home']);
|
|
|
+ $return['half']['guest'] = intval($truleResult['5']['guest']);
|
|
|
+ $return['half2']['home'] = intval($truleResult['6']['home']);
|
|
|
+ $return['half2']['guest'] = intval($truleResult['6']['guest']);
|
|
|
|
|
|
- foreach ($arr as $key => $val) {
|
|
|
- $tmp_home = intval($val->home_score);
|
|
|
- $tmp_guest = intval($val->guest_score);
|
|
|
- $tmp_home_rate = intval($val->home_rate);
|
|
|
- $tmp_guest_rate = intval($val->guest_rate);
|
|
|
-
|
|
|
- $return['all']['home'] += $tmp_home;
|
|
|
- $return['all']['guest'] += $tmp_guest;
|
|
|
- $return['all']['home_rate'] += $tmp_home_rate;
|
|
|
- $return['all']['guest_rate'] += $tmp_guest_rate;
|
|
|
-
|
|
|
- if ($key == 1 || $key == 2) {
|
|
|
- $return['half']['home'] += $tmp_home;
|
|
|
- $return['half']['guest'] += $tmp_guest;
|
|
|
- $return['half']['home_rate'] += $tmp_home_rate;
|
|
|
- $return['half']['guest_rate'] += $tmp_guest_rate;
|
|
|
- } else {
|
|
|
- $return['half2']['home'] += $tmp_home;
|
|
|
- $return['half2']['guest'] += $tmp_guest;
|
|
|
- $return['half2']['home_rate'] += $tmp_home_rate;
|
|
|
- $return['half2']['guest_rate'] += $tmp_guest_rate;
|
|
|
- }
|
|
|
- }
|
|
|
return $return;
|
|
|
}
|
|
|
|