|
|
@@ -7,6 +7,8 @@
|
|
|
*/
|
|
|
|
|
|
namespace App\Lib\Settlement\Adapter;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
+
|
|
|
|
|
|
class ZqRule
|
|
|
{
|
|
|
@@ -18,7 +20,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function concede_home($model, $resultModel, $resultRecords) {
|
|
|
- $this -> concedeFull($model, $resultModel, $resultRecords, 1);
|
|
|
+ return $this -> concedeFull($model, $resultModel, $resultRecords, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -29,7 +31,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function concede_guest($model, $resultModel, $resultRecords) {
|
|
|
- $this -> concedeFull($model, $resultModel, $resultRecords, 2);
|
|
|
+ return $this -> concedeFull($model, $resultModel, $resultRecords, 2);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -40,7 +42,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function half_concede_home($model, $resultModel, $resultRecords) {
|
|
|
- $this -> concedeHalf($model, $resultModel, $resultRecords, 1, 1);
|
|
|
+ return $this -> concedeHalf($model, $resultModel, $resultRecords, 1, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -51,7 +53,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function half_concede_guest($model, $resultModel, $resultRecords) {
|
|
|
- $this -> concedeHalf($model, $resultModel, $resultRecords, 2, 1);
|
|
|
+ return $this -> concedeHalf($model, $resultModel, $resultRecords, 2, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -62,7 +64,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function size_home($model, $resultModel, $resultRecords) {
|
|
|
- $this -> sizeFull($model, $resultModel, $resultRecords, 0, 1);
|
|
|
+ return $this -> sizeFull($model, $resultModel, $resultRecords, 0, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -73,7 +75,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function size_guest($model, $resultModel, $resultRecords) {
|
|
|
- $this -> sizeFull($model, $resultModel, $resultRecords, 0, -1);
|
|
|
+ return $this -> sizeFull($model, $resultModel, $resultRecords, 0, -1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -84,7 +86,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function half_size_home($model, $resultModel, $resultRecords) {
|
|
|
- $this -> sizeHalf($model, $resultModel, $resultRecords, 0, 1, 1);
|
|
|
+ return $this -> sizeHalf($model, $resultModel, $resultRecords, 0, 1, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -95,7 +97,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输 2:平 3:赢半平半 4:输半平半
|
|
|
*/
|
|
|
public function half_size_guest($model, $resultModel, $resultRecords) {
|
|
|
- $this -> sizeHalf($model, $resultModel, $resultRecords, 0, -1, 1);
|
|
|
+ return $this -> sizeHalf($model, $resultModel, $resultRecords, 0, -1, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -106,7 +108,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输
|
|
|
*/
|
|
|
public function capot_home($model, $resultModel, $resultRecords) {
|
|
|
- $this -> winFull($model, $resultModel, $resultRecords, 1);
|
|
|
+ return $this -> winFull($model, $resultModel, $resultRecords, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -117,7 +119,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输
|
|
|
*/
|
|
|
public function capot_guest($model, $resultModel, $resultRecords) {
|
|
|
- $this -> winFull($model, $resultModel, $resultRecords, 2);
|
|
|
+ return $this -> winFull($model, $resultModel, $resultRecords, 2);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -128,7 +130,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输
|
|
|
*/
|
|
|
public function capot_dogfall($model, $resultModel, $resultRecords) {
|
|
|
- $this -> winFull($model, $resultModel, $resultRecords, 0);
|
|
|
+ return $this -> winFull($model, $resultModel, $resultRecords, 0);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -139,7 +141,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输
|
|
|
*/
|
|
|
public function half_capot_home($model, $resultModel, $resultRecords) {
|
|
|
- $this -> winHalf($model, $resultModel, $resultRecords, 1, 1);
|
|
|
+ return $this -> winHalf($model, $resultModel, $resultRecords, 1, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -150,7 +152,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输
|
|
|
*/
|
|
|
public function half_capot_guest($model, $resultModel, $resultRecords) {
|
|
|
- $this -> winHalf($model, $resultModel, $resultRecords, 2, 1);
|
|
|
+ return $this -> winHalf($model, $resultModel, $resultRecords, 2, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -161,7 +163,7 @@ class ZqRule
|
|
|
* @return string 1:赢 -1:输
|
|
|
*/
|
|
|
public function half_capot_dogfall($model, $resultModel, $resultRecords) {
|
|
|
- $this -> winHalf($model, $resultModel, $resultRecords, 0, 1);
|
|
|
+ return $this -> winHalf($model, $resultModel, $resultRecords, 0, 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -593,9 +595,9 @@ class ZqRule
|
|
|
* @param $result_match_r 结果记录
|
|
|
*/
|
|
|
public function bodan($bet_match,$result_match,$result_match_r){
|
|
|
-// $bet_match = DB::table('money_buy_match')->where('match_id', 3144414)->first();
|
|
|
-// $result_match = DB::table('st_zq_result')->where('match_id', 3144414)->first();
|
|
|
-// $result_match_r = DB::table('st_zq_result_record')->where('match_id', 3144414)->get()->toArray();
|
|
|
+// $bet_match = DB::table('money_buy_match')->where('match_id', 3150765)->first();
|
|
|
+// $result_match = DB::table('st_zq_result')->where('match_id', 3150765)->first();
|
|
|
+// $result_match_r = DB::table('st_zq_result_record')->where('match_id', 3150765)->get()->toArray();
|
|
|
|
|
|
//获取父/子级赔率代码
|
|
|
$p_code = $bet_match->p_code;
|
|
|
@@ -613,10 +615,17 @@ class ZqRule
|
|
|
//获取主客队上半场得分
|
|
|
$home_score = $last_half_data->home_score;
|
|
|
$guest_score = $last_half_data->guest_score;
|
|
|
+ if(strstr($bet_match->condition,"其他") ){
|
|
|
+ if(($home_score > 3) || ($guest_score > 3)) return 1;
|
|
|
+ }
|
|
|
}else{//全场
|
|
|
//获取主客队全场得分
|
|
|
$home_score = $result_match->home_score;
|
|
|
$guest_score = $result_match->guest_score;
|
|
|
+
|
|
|
+ if(strstr($bet_match->condition,"其他") ){
|
|
|
+ if(($home_score > 4) || ($guest_score > 4)) return 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//判断结果
|
|
|
@@ -629,17 +638,17 @@ class ZqRule
|
|
|
public function two_sides($model,$resultModel,$resultRecords){
|
|
|
$resulttod = intval($resultModel->home_score) + intval($resultModel->guest_score) + intval($resultModel->guest_rate) + intval($resultModel->home_rate);
|
|
|
if($resulttod%2==0){
|
|
|
- $data = 2;
|
|
|
+ $data = '双';
|
|
|
}else{
|
|
|
- $data = 2;
|
|
|
+ $data = '单';
|
|
|
}
|
|
|
- if($data = intval($model->condition)){
|
|
|
+ if($data = $model->condition){
|
|
|
return 1;
|
|
|
}else{
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
//结果总数 home_score 主队进球数 guest_score 客队进球数 home_rate 主队让球 guest_rate 客队让球 u_home_score 上半场-主队进球数 u_guest_score 上半场-客队进球数
|
|
|
public function total_goal($model,$resultModel,$resultRecords){
|
|
|
@@ -744,5 +753,89 @@ class ZqRule
|
|
|
return $last_half_data;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 冠军盘口投注
|
|
|
+ * $bet_match 投注赛事数据
|
|
|
+ * $result_match 联赛结果 数据 根据玩法代码查询一条
|
|
|
+ * $result_match_r 无用参数
|
|
|
+ */
|
|
|
+ public function gj($bet_match,$result_match,$result_match_r){
|
|
|
+
|
|
|
+// $bet_match = DB::table('money_buy_match')->where('match_id', 127317)->first();
|
|
|
+// $bet_match->odds_code = '巴西小组赛积分成绩';
|
|
|
+
|
|
|
+// $result_match = DB::table('st_zq_league_result')->where(['lg_id'=>27317,'game_name'=>$bet_match->odds_code])->first();
|
|
|
+
|
|
|
+ if(empty($bet_match) || empty($result_match) ) return false;
|
|
|
+ if($bet_match->p_code != 'gj') return false;//冠军玩法
|
|
|
+ if($bet_match->odds_code == $result_match->game_name){
|
|
|
+ $condition = $bet_match->condition;
|
|
|
+
|
|
|
+ //进球数判断
|
|
|
+ if(strpos($bet_match->odds_code,'进球数') !== false){
|
|
|
+ //获取数值
|
|
|
+ $bet = $this->findNum($condition);
|
|
|
+ //以上/以下判断
|
|
|
+ if(strpos($condition,'上') !== false){
|
|
|
+ if($bet < $result_match->result) return 1;
|
|
|
+ }
|
|
|
+ if(strpos($condition,'下') !== false){
|
|
|
+ if($bet > $result_match->result) return 1;
|
|
|
+ }
|
|
|
+ //大/小判断
|
|
|
+ if(strpos($condition,'大') !== false){
|
|
|
+ if($bet < $result_match->result) return 1;
|
|
|
+ }
|
|
|
+ if(strpos($condition,'小') !== false){
|
|
|
+ if($bet > $result_match->result) return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //积分成绩判断
|
|
|
+ if(strpos($bet_match->odds_code,'积分') !== false){
|
|
|
+ $condition = $bet_match->condition;
|
|
|
+ //获取数值
|
|
|
+ $bet = $this->findNum($condition);
|
|
|
+ if($bet == $result_match->result) return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果条件中没有数字,则获取球队/球员结果
|
|
|
+ if((preg_match('/\d+/',$condition)) == 0){
|
|
|
+ $result = $this->teamJudge($condition,$result_match->result);
|
|
|
+
|
|
|
+ if($result) return 1;
|
|
|
+ };
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 冠军盘口 球队/球员结果判断
|
|
|
+ */
|
|
|
+ public function teamJudge($condition,$result){
|
|
|
+ //返回结果数组中是否包含该球队
|
|
|
+ $result = in_array($condition,json_decode($result,true));
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * @param string $str
|
|
|
+ * @return string
|
|
|
+ * 处理字符串中的数字
|
|
|
+ */
|
|
|
+ public function findNum($str=''){
|
|
|
+ $str=trim($str);
|
|
|
+ if(empty($str)){return '';}
|
|
|
+ $result='';
|
|
|
+ for($i=0;$i<strlen($str);$i++){
|
|
|
+ if(is_numeric($str[$i]) || $str[$i] == '.' ){
|
|
|
+ $result.=$str[$i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果有小数点,返回浮点数
|
|
|
+ if(strpos($result,'.')) return floatval($result);
|
|
|
+ //返回整数
|
|
|
+ return (int)$result;
|
|
|
+ }
|
|
|
}
|