|
|
@@ -20,30 +20,18 @@ class WqRule
|
|
|
$odds_code = $model->odds_code;
|
|
|
$home_team = trim($model->home_team);
|
|
|
$guest_team = trim($model->guest_team);
|
|
|
- $all_winner = $resultModel['0']->match_winer_player;
|
|
|
-
|
|
|
- /*
|
|
|
- if (in_array($odds_code, ['ch', 'cg'])) {
|
|
|
- $resultModel = DB::table('st_wq_league_result')->where(['lg_id' => $model->lg_id, 'status' => 1])->first();
|
|
|
- $all_winner = trim($resultModel->result);
|
|
|
- if (!$resultModel) {
|
|
|
- throw new \Exception("没有找到冠军数据-" . $model->lg_id);
|
|
|
- }
|
|
|
- if ($odds_code == 'ch') {
|
|
|
- return $this->wq_gj_all($all_winner, $home_team);
|
|
|
- } else {
|
|
|
- return $this->wq_gj_all($all_winner, $guest_team);
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
+ //$all_winner = $resultModel['0']->match_winer_player;
|
|
|
|
|
|
$stand_datas = $this->wq_scoreDatas($resultModel);
|
|
|
+
|
|
|
switch ($odds_code) {
|
|
|
case 'ch':
|
|
|
- $return = $this->wq_gj_all($all_winner, $home_team);
|
|
|
+ $all_score_arr = $stand_datas['all'];
|
|
|
+ $return = $this->wq_gj_all($home_team, $guest_team, $all_score_arr, 1);
|
|
|
break;
|
|
|
case 'cg':
|
|
|
- $return = $this->wq_gj_all($all_winner, $guest_team);
|
|
|
+ $all_score_arr = $stand_datas['all'];
|
|
|
+ $return = $this->wq_gj_all($home_team, $guest_team, $all_score_arr, 2);
|
|
|
break;
|
|
|
case 'ch_1':
|
|
|
$return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['1'], 1);
|
|
|
@@ -70,14 +58,25 @@ class WqRule
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
- private function wq_gj_all($winner, $team)
|
|
|
+ private function wq_gj_all($home_name, $guest_name, $score_all, $homeguest = 1)
|
|
|
{
|
|
|
- if ($winner == $team) {
|
|
|
- $return['result'] = 1;
|
|
|
+ $home_score = $score_all['home_score'];
|
|
|
+ $guest_score = $score_all['guest_score'];
|
|
|
+ $return['matchResult'] = $home_score . ':' . $guest_score;
|
|
|
+
|
|
|
+ if ($homeguest == 1) {
|
|
|
+ if ($home_score > $guest_score) {
|
|
|
+ $return['result'] = 1;
|
|
|
+ } else {
|
|
|
+ $return['result'] = -1;
|
|
|
+ }
|
|
|
} else {
|
|
|
- $return['result'] = -1;
|
|
|
+ if ($home_score < $guest_score) {
|
|
|
+ $return['result'] = 1;
|
|
|
+ } else {
|
|
|
+ $return['result'] = -1;
|
|
|
+ }
|
|
|
}
|
|
|
- $return['matchResult'] = "($winner)";
|
|
|
return $return;
|
|
|
}
|
|
|
|