|
|
@@ -13,6 +13,8 @@ use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class ZqRule
|
|
|
{
|
|
|
+ use RulePlus;
|
|
|
+
|
|
|
/**
|
|
|
* 全场|主队|让球
|
|
|
* @param mixed $model 注单表数据
|
|
|
@@ -712,8 +714,8 @@ class ZqRule
|
|
|
$resulttod = intval($resultModel->home_score) + intval($resultModel->guest_score);
|
|
|
//上半场总进球数
|
|
|
$Firsthalftod = intval($resultModel->u_home_score) + intval($resultModel->u_guest_score);
|
|
|
- $results =0;
|
|
|
- $resultb =0;
|
|
|
+ $results = 0;
|
|
|
+ $resultb = 0;
|
|
|
$qjnum = explode('-', $model->condition);
|
|
|
if ($model->odds_code == "total_goal_four") {
|
|
|
if ($qjnum[0] <= $resulttod and $qjnum[1] >= $resulttod) {
|
|
|
@@ -770,33 +772,33 @@ class ZqRule
|
|
|
];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if ($results == 1) {
|
|
|
- $data = [
|
|
|
- 'result' => 1,
|
|
|
- 'matchResult' => "$resulttod(全场)",
|
|
|
- ];
|
|
|
- }
|
|
|
- if($results == -1) {
|
|
|
- $data = [
|
|
|
- 'result' => -1,
|
|
|
- 'matchResult' => "$resulttod(全场)",
|
|
|
- ];
|
|
|
- }
|
|
|
|
|
|
- if ($resultb == 1) {
|
|
|
- $data = [
|
|
|
- 'result' => 1,
|
|
|
- 'matchResult' => "$resulttod(半场)",
|
|
|
- ];
|
|
|
- }
|
|
|
- if($resultb == -1) {
|
|
|
- $data = [
|
|
|
- 'result' => -1,
|
|
|
- 'matchResult' => "$resulttod(半场)",
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
+ if ($results == 1) {
|
|
|
+ $data = [
|
|
|
+ 'result' => 1,
|
|
|
+ 'matchResult' => "$resulttod(全场)",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if ($results == -1) {
|
|
|
+ $data = [
|
|
|
+ 'result' => -1,
|
|
|
+ 'matchResult' => "$resulttod(全场)",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($resultb == 1) {
|
|
|
+ $data = [
|
|
|
+ 'result' => 1,
|
|
|
+ 'matchResult' => "$resulttod(半场)",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if ($resultb == -1) {
|
|
|
+ $data = [
|
|
|
+ 'result' => -1,
|
|
|
+ 'matchResult' => "$resulttod(半场)",
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
@@ -1181,33 +1183,106 @@ class ZqRule
|
|
|
/**
|
|
|
* 角球相关--------->开始
|
|
|
*/
|
|
|
-
|
|
|
public function corner_ball($model, $resultModels, $result_match_r)
|
|
|
{
|
|
|
$odde_code = $model->odde_code;
|
|
|
- $isHalf = strpos($odde_code, 'half');
|
|
|
+ $isHalf = strpos(strtolower($odde_code), 'half');
|
|
|
if ($isHalf) {
|
|
|
- return corner_ball_half($model, $resultModels, $result_match_r);
|
|
|
+ return $this->corner_ball_all($model, $resultModels, $result_match_r);
|
|
|
} else {
|
|
|
- return corner_ball_half($model, $resultModels, $result_match_r);
|
|
|
+ return $this->corner_ball_half($model, $resultModels, $result_match_r);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function corner_ball_all($model, $resultModels, $result_match_r)
|
|
|
{
|
|
|
$resultModel = $resultModels['0'];
|
|
|
- $returnDatas = ['result' => -1, 'matchResult' => ''];
|
|
|
- $default = json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]);
|
|
|
+ if ($resultModel->conner_ball == '') {
|
|
|
+ $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
|
|
|
+ } else {
|
|
|
+ $game_ret = json_decode($resultModels->conner_ball);
|
|
|
+ }
|
|
|
+ $word = $game_ret->home . '-' .$game_ret->guest . "(全场)";
|
|
|
+ $returnDatas = ['result' => -1, 'matchResult' => $word];
|
|
|
|
|
|
+ $odds_code = $model->odds_code;
|
|
|
+ switch ($odds_code) {
|
|
|
+ case "corner_concede_home":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->home - $game_ret->guest, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_concede_guest":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->guest - $game_ret->home, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_goal_size_home":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->home - $game_ret->guest, $model->condition, 2, $word);
|
|
|
+ break;
|
|
|
+ case "corner_goal_size_guest":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->guest - $game_ret->home, $model->condition, 1, $word);
|
|
|
+ break;
|
|
|
+ case "corner_capot_home":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_capot_guest":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_capot_dogfall":
|
|
|
+ $returnDatas['result'] = ($game_ret->home == $game_ret->guest) ? 1 : -1;
|
|
|
+ break;
|
|
|
+ case "corner_two_sides_single":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ case "corner_two_sides_double":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
|
|
|
+ }
|
|
|
return $returnDatas;
|
|
|
}
|
|
|
|
|
|
public function corner_ball_half($model, $resultModels, $result_match_r)
|
|
|
{
|
|
|
$resultModel = $resultModels['0'];
|
|
|
- $returnDatas = ['result' => -1, 'matchResult' => ''];
|
|
|
- $default = json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]);
|
|
|
+ if ($resultModel->conner_ball == '') {
|
|
|
+ $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
|
|
|
+ } else {
|
|
|
+ $game_ret = json_decode($resultModels->conner_ball);
|
|
|
+ }
|
|
|
+ $word = $game_ret->home . '-' .$game_ret->guest . "(上半场)";
|
|
|
+ $returnDatas = ['result' => -1, 'matchResult' => $word];
|
|
|
|
|
|
+ $odds_code = $model->odds_code;
|
|
|
+ switch ($odds_code) {
|
|
|
+ case "corner_half_concede_home":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->home_half - $game_ret->guest_half, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_half_concede_guest":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->guest_half - $game_ret->home_half, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_half_goal_size_home":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->home_half - $game_ret->guest_half, $model->condition, 2, $word);
|
|
|
+ break;
|
|
|
+ case "corner_half_goal_size_guest":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->guest_half - $game_ret->home_half, $model->condition, 1, $word);
|
|
|
+ break;
|
|
|
+ case "corner_half_capot_home":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->home_half, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_half_capot_guest":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->hom_halfe, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "corner_half_capot_dogfall":
|
|
|
+ $returnDatas['result'] = ($game_ret->home_half == $game_ret->guest_half) ? 1 : -1;
|
|
|
+ break;
|
|
|
+ case "corner_half_two_sides_single":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ case "corner_half_two_sides_double":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
|
|
|
+ }
|
|
|
return $returnDatas;
|
|
|
}
|
|
|
|
|
|
@@ -1216,4 +1291,116 @@ class ZqRule
|
|
|
*/
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ 发球相关 开始
|
|
|
+ */
|
|
|
+ public function penalty_card($model, $resultModels, $result_match_r)
|
|
|
+ {
|
|
|
+ $odde_code = $model->odde_code;
|
|
|
+ $isHalf = strpos(strtolower($odde_code), 'half');
|
|
|
+ if ($isHalf) {
|
|
|
+ return $this->penalty_card_half($model, $resultModels, $result_match_r);
|
|
|
+ } else {
|
|
|
+ return $this->penalty_card_all($model, $resultModels, $result_match_r);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function penalty_card_half($model, $resultModels, $result_match_r){
|
|
|
+
|
|
|
+ $resultModel = $resultModels['0'];
|
|
|
+ if ($resultModel->conner_ball == '') {
|
|
|
+ $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
|
|
|
+ } else {
|
|
|
+ $game_ret = json_decode($resultModels->conner_ball);
|
|
|
+ }
|
|
|
+ $word = $game_ret->home . '-' .$game_ret->guest . "(上半场)";
|
|
|
+ $returnDatas = ['result' => -1, 'matchResult' => $word];
|
|
|
+
|
|
|
+ $odds_code = $model->odds_code;
|
|
|
+ switch ($odds_code) {
|
|
|
+ case "penalty_half_concede_home":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->home_half - $game_ret->guest_half, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_half_concede_guest":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->guest_half - $game_ret->home_half, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_half_goal_size_home":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->home_half - $game_ret->guest_half, $model->condition, 2, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_half_goal_size_guest":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->guest_half - $game_ret->home_half, $model->condition, 1, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_half_capot_home":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->home_half, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_half_capot_guest":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->hom_halfe, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_half_capot_dogfall":
|
|
|
+ $returnDatas['result'] = ($game_ret->home_half == $game_ret->guest_half) ? 1 : -1;
|
|
|
+ break;
|
|
|
+ case "penalty_half_two_sides_single":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ case "penalty_half_two_sides_double":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
|
|
|
+ }
|
|
|
+ return $returnDatas;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function penalty_card_all($model, $resultModels, $result_match_r){
|
|
|
+ $resultModel = $resultModels['0'];
|
|
|
+ if ($resultModel->conner_ball == '') {
|
|
|
+ $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
|
|
|
+ } else {
|
|
|
+ $game_ret = json_decode($resultModels->conner_ball);
|
|
|
+ }
|
|
|
+ $word = $game_ret->home . '-' .$game_ret->guest . "(全场)";
|
|
|
+ $returnDatas = ['result' => -1, 'matchResult' => $word];
|
|
|
+
|
|
|
+ $odds_code = $model->odds_code;
|
|
|
+ switch ($odds_code) {
|
|
|
+ case "penalty_concede_home":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->home - $game_ret->guest, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_concede_guest":
|
|
|
+ $returnDatas = $this->zq_letball($game_ret->guest - $game_ret->home, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_goal_size_home":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->home - $game_ret->guest, $model->condition, 2, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_goal_size_guest":
|
|
|
+ $returnDatas = $this->zq_inball_bigsmall($game_ret->guest - $game_ret->home, $model->condition, 1, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_capot_home":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_capot_guest":
|
|
|
+ $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
|
|
|
+ break;
|
|
|
+ case "penalty_capot_dogfall":
|
|
|
+ $returnDatas['result'] = ($game_ret->home == $game_ret->guest) ? 1 : -1;
|
|
|
+ break;
|
|
|
+ case "penalty_two_sides_single":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ case "penalty_two_sides_double":
|
|
|
+ $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
|
|
|
+ }
|
|
|
+ return $returnDatas;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ 发球相关 结束
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|