|
|
@@ -14,19 +14,19 @@ class WqRule
|
|
|
use RulePlus;
|
|
|
|
|
|
//冠军
|
|
|
- public function kemp($model, $resultModel, $resultRecords)
|
|
|
+ public function C($model, $resultModel, $resultRecords)
|
|
|
{
|
|
|
$odds_code = $model->odds_code;
|
|
|
$home_team = trim($model->home_team);
|
|
|
$guest_team = trim($model->guest_team);
|
|
|
|
|
|
- if (in_array($odds_code, ['kemp_home', 'kemp_guest'])) {
|
|
|
+ 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 == 'kemp_home') {
|
|
|
+ if ($odds_code == 'ch') {
|
|
|
return $this->wq_gj_all($all_winner, $home_team);
|
|
|
} else {
|
|
|
return $this->wq_gj_all($all_winner, $guest_team);
|
|
|
@@ -35,20 +35,20 @@ class WqRule
|
|
|
|
|
|
$stand_datas = $this->wq_scoreDatas($resultModel);
|
|
|
switch ($odds_code) {
|
|
|
- case 'one_kemp_home':
|
|
|
+ case 'ch_1':
|
|
|
$return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['1'], 1);
|
|
|
break;
|
|
|
- case 'one_kemp_guest':
|
|
|
+ case 'cg_1':
|
|
|
$return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['1'], 2);
|
|
|
break;
|
|
|
- case 'two_kemp_home':
|
|
|
+ case 'ch_2':
|
|
|
$return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['2'], 1);
|
|
|
break;
|
|
|
- case 'two_kemp_guest':
|
|
|
+ case 'cg_2':
|
|
|
$return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['2'], 2);
|
|
|
break;
|
|
|
default:
|
|
|
- $return = $this->return_error;
|
|
|
+ $return = $this->return_he;
|
|
|
break;
|
|
|
}
|
|
|
return $return;
|
|
|
@@ -87,7 +87,7 @@ class WqRule
|
|
|
|
|
|
|
|
|
//让盘
|
|
|
- public function dishes($model, $resultModel, $resultRecords)
|
|
|
+ public function LD($model, $resultModel, $resultRecords)
|
|
|
{
|
|
|
$odds_code = $model->odds_code;
|
|
|
$stand_datas = $this->wq_scoreDatas($resultModel);
|
|
|
@@ -96,21 +96,21 @@ class WqRule
|
|
|
$guest_score = $stand_datas['all']['guest'];
|
|
|
|
|
|
switch ($odds_code) {
|
|
|
- case 'dishes_home':
|
|
|
+ case 'ldh':
|
|
|
$return = $this->zq_letball($home_score - $guest_score, $condition, $guest_score . '-' . $guest_score . ('总盘'));
|
|
|
break;
|
|
|
- case 'dishes_guest':
|
|
|
+ case 'ldg':
|
|
|
$return = $this->zq_letball($guest_score - $home_score, $condition, $guest_score . '-' . $guest_score . ('总盘'));
|
|
|
break;
|
|
|
default:
|
|
|
- $return = $this->return_error;
|
|
|
+ $return = $this->return_he;
|
|
|
break;
|
|
|
}
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
//让局
|
|
|
- public function bureau($model, $resultModel, $resultRecords)
|
|
|
+ public function LB($model, $resultModel, $resultRecords)
|
|
|
{
|
|
|
$odds_code = $model->odds_code;
|
|
|
$condition = $model->condition;
|
|
|
@@ -119,20 +119,20 @@ class WqRule
|
|
|
$all_guest = $stand_datas['allinning']['guest'];
|
|
|
|
|
|
switch ($odds_code) {
|
|
|
- case 'bureau_home':
|
|
|
+ case 'lbh':
|
|
|
$return = $this->zq_letball($all_home - $all_guest, $condition, $all_home . '-' . $all_guest . ('总局数'));
|
|
|
break;
|
|
|
- case 'bureau_guest':
|
|
|
+ case 'lbg':
|
|
|
$return = $this->zq_letball($all_guest - $all_home, $condition, $all_home . '-' . $all_guest . ('总局数'));
|
|
|
break;
|
|
|
default:
|
|
|
- $return = $this->return_error;
|
|
|
+ $return = $this->return_he;
|
|
|
}
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
//总局数:大/小
|
|
|
- public function total_number($model, $resultModel, $resultRecords)
|
|
|
+ public function TN($model, $resultModel, $resultRecords)
|
|
|
{
|
|
|
$odds_code = $model->odds_code;
|
|
|
$condition = $model->condition;
|
|
|
@@ -141,32 +141,46 @@ class WqRule
|
|
|
$all_guest = $stand_datas['allinning']['guest'];
|
|
|
$all = $all_home + $all_guest;
|
|
|
|
|
|
- $one_home = $stand_datas['oneinning']['home'];
|
|
|
- $one_guest = $stand_datas['oneinning']['guest'];
|
|
|
- $one_all = $one_home + $one_guest;
|
|
|
-
|
|
|
switch ($odds_code) {
|
|
|
- case 'total_number_big':
|
|
|
+ case 'tnb':
|
|
|
$return = $this->zq_inball_bigsmall($all, $condition, 2, $all . '(总局数)');
|
|
|
break;
|
|
|
- case 'total_number_small':
|
|
|
+ case 'tns':
|
|
|
$return = $this->zq_inball_bigsmall($all, $condition, 1, $all . '(总局数)');
|
|
|
break;
|
|
|
- case 'one_total_number_big':
|
|
|
- $return = $this->zq_inball_bigsmall($one_all, $condition, 2, $all . '(第1盘局数)');
|
|
|
+ case 'tnb_1':
|
|
|
+ $tmpall = intval($stand_datas['list']['1']->home_score) + intval($stand_datas['list']['1']->guest_score);
|
|
|
+ $return = $this->zq_inball_bigsmall($tmpall, $condition, 2, $tmpall . '(第1盘局数)');
|
|
|
+ break;
|
|
|
+ case 'tns_1':
|
|
|
+ $tmpall = intval($stand_datas['list']['1']->home_score) + intval($stand_datas['list']['1']->guest_score);
|
|
|
+ $return = $this->zq_inball_bigsmall($tmpall, $condition, 1, $tmpall . '(第1盘局数)');
|
|
|
+ break;
|
|
|
+ case 'tnb_2':
|
|
|
+ $tmpall = intval($stand_datas['list']['2']->home_score) + intval($stand_datas['list']['2']->guest_score);
|
|
|
+ $return = $this->zq_inball_bigsmall($tmpall, $condition, 2, $tmpall . '(第2盘局数)');
|
|
|
+ break;
|
|
|
+ case 'tns_2':
|
|
|
+ $tmpall = intval($stand_datas['list']['2']->home_score) + intval($stand_datas['list']['2']->guest_score);
|
|
|
+ $return = $this->zq_inball_bigsmall($tmpall, $condition, 1, $tmpall . '(第2盘局数)');
|
|
|
break;
|
|
|
- case 'one_total_number_small':
|
|
|
- $return = $this->zq_inball_bigsmall($one_all, $condition, 1, $all . '(第1盘局数)');
|
|
|
+ case 'tnb_3':
|
|
|
+ $tmpall = intval($stand_datas['list']['3']->home_score) + intval($stand_datas['list']['3']->guest_score);
|
|
|
+ $return = $this->zq_inball_bigsmall($tmpall, $condition, 2, $tmpall . '(第3盘局数)');
|
|
|
+ break;
|
|
|
+ case 'tns_3':
|
|
|
+ $tmpall = intval($stand_datas['list']['3']->home_score) + intval($stand_datas['list']['3']->guest_score);
|
|
|
+ $return = $this->zq_inball_bigsmall($tmpall, $condition, 1, $tmpall . '(第3盘局数)');
|
|
|
break;
|
|
|
default:
|
|
|
- $return = $this->return_error;
|
|
|
+ $return = $this->return_he;
|
|
|
}
|
|
|
return $return;
|
|
|
|
|
|
}
|
|
|
|
|
|
//总局数:单/双
|
|
|
- public function two_game_sides($model, $resultModel, $resultRecords)
|
|
|
+ public function TS($model, $resultModel, $resultRecords)
|
|
|
{
|
|
|
$odds_code = $model->odds_code;
|
|
|
$condition = $model->condition;
|
|
|
@@ -176,19 +190,19 @@ class WqRule
|
|
|
$all = $all_home + $all_guest;
|
|
|
|
|
|
switch ($odds_code) {
|
|
|
- case 'two_sides_single':
|
|
|
- case 'two_sides_double':
|
|
|
+ case 'tss':
|
|
|
+ case 'tsd':
|
|
|
$return = $this->zq_doublesing($all, $condition, $all . '(总局数)');
|
|
|
break;
|
|
|
default:
|
|
|
- $return = $this->return_error;
|
|
|
+ $return = $this->return_he;
|
|
|
}
|
|
|
return $return;
|
|
|
|
|
|
}
|
|
|
|
|
|
//波胆
|
|
|
- public function bodan($model, $resultModel, $resultRecords)
|
|
|
+ public function B($model, $resultModel, $resultRecords)
|
|
|
{
|
|
|
$odds_code = $model->odds_code;
|
|
|
$stand_datas = $this->wq_scoreDatas($resultModel);
|
|
|
@@ -197,20 +211,20 @@ class WqRule
|
|
|
$word = $all_home . '-' . $all_guest . '(比分)';
|
|
|
|
|
|
switch ($odds_code) {
|
|
|
- case 'three_bodan_home_two_zero':
|
|
|
+ case 'b20_3':
|
|
|
$return = $this->bodan_fun($all_home, $all_guest, '2-0', $word);
|
|
|
break;
|
|
|
- case 'three_bodan_home_two_one':
|
|
|
+ case 'b21_3':
|
|
|
$return = $this->bodan_fun($all_home, $all_guest, '2-1', $word);
|
|
|
break;
|
|
|
- case 'three_bodan_guest_zero_two':
|
|
|
+ case 'b02_3':
|
|
|
$return = $this->bodan_fun($all_home, $all_guest, '0-2', $word);
|
|
|
break;
|
|
|
- case 'three_bodan_gueste_one_two':
|
|
|
+ case 'b12_3':
|
|
|
$return = $this->bodan_fun($all_home, $all_guest, '1-2', $word);
|
|
|
break;
|
|
|
default:
|
|
|
- $return = $this->return_error;
|
|
|
+ $return = $this->return_he;
|
|
|
}
|
|
|
return $return;
|
|
|
}
|
|
|
@@ -231,22 +245,29 @@ class WqRule
|
|
|
|
|
|
public function wq_getResultBySn($recoreModesArray, $type = 4, $sn = 1)
|
|
|
{
|
|
|
- $return = [];
|
|
|
- foreach ($recoreModesArray as $key => $val) {
|
|
|
- $nowsn = intval($val->match_process);
|
|
|
- $return[$nowsn] = $val;
|
|
|
+ if (!isset($recoreModesArray['0']) || empty($recoreModesArray['0'])) {
|
|
|
+ throw new \Exception("网球结果不能为空");
|
|
|
+ return;
|
|
|
}
|
|
|
+ $RecoedModel = $recoreModesArray['0'];
|
|
|
|
|
|
- //网球只能为三盘或5盘
|
|
|
- if (count($return) != 3 || count($return) != 5) {
|
|
|
- throw new \Exception("网球球结果不为3或5的数组,或match_process有错");
|
|
|
- } else {
|
|
|
- if (count($return) == 3 && !empty(array_diff([1, 2, 3], array_keys($return)))) {
|
|
|
- throw new \Exception("网球球结果不为3的数组,或match_process有错");
|
|
|
- }
|
|
|
- if (count($return) == 5 && !empty(array_diff([1, 2, 3, 4, 5], array_keys($return)))) {
|
|
|
- throw new \Exception("网球球结果不为5的数组,或match_process有错");
|
|
|
- }
|
|
|
+ $imatch_id = $RecoedModel->match_id;
|
|
|
+ $all_datas = json_decode($RecoedModel->inning, true);
|
|
|
+
|
|
|
+ $panlen = count($all_datas);
|
|
|
+ if (empty($all_datas) || !in_array($panlen, [3, 5])) {
|
|
|
+ throw new \Exception("篮球结果数据不正确,( matchid= $imatch_id 主客结果)不能为空或数据量不为3,5");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ $return = [];
|
|
|
+ for ($i = 1; $i <= $panlen; $i++) {
|
|
|
+ $tt = clone $RecoedModel;
|
|
|
+ $tmpobj = json_decode(json_encode($tt, 256), true);
|
|
|
+ $tmpobj['home_score'] = $all_datas[$i]['home'];
|
|
|
+ $tmpobj['guest_score'] = $all_datas[$i]['guest'];
|
|
|
+ $tmpobj['winner'] = ($all_datas[$i]['home'] > $all_datas[$i]['guest']) ? 'home' : 'guest';
|
|
|
+ $return[$i] = json_decode(json_encode($tmpobj, 256));
|
|
|
}
|
|
|
|
|
|
if ($type == 4) {
|
|
|
@@ -275,16 +296,14 @@ class WqRule
|
|
|
$tmp_home = intval($val->home_score);
|
|
|
$tmp_guest = intval($val->guest_score);
|
|
|
|
|
|
- $return['all']['home'] += $tmp_home;
|
|
|
- $return['all']['guest'] += $tmp_guest;
|
|
|
+ ($tmp_home > $tmp_guest) ? ($return['all']['home']++) : ($return['all']['guest']++);
|
|
|
|
|
|
- $juinfo = $this->wq_JuInfo($val);
|
|
|
- $return['allinning']['home'] += $juinfo['all']['home'];
|
|
|
- $return['allinning']['guest'] += $juinfo['all']['guest'];
|
|
|
+ $return['allinning']['home'] += $tmp_home;
|
|
|
+ $return['allinning']['guest'] += $tmp_guest;
|
|
|
|
|
|
if ($key == 1) {
|
|
|
- $return['oneinning']['home'] = $juinfo['all']['home'];
|
|
|
- $return['oneinning']['guest'] = $juinfo['all']['guest'];
|
|
|
+ $return['oneinning']['home'] = $tmp_home;
|
|
|
+ $return['oneinning']['guest'] = $tmp_guest;
|
|
|
}
|
|
|
}
|
|
|
return $return;
|