Selaa lähdekoodia

追加危险球审核功能

彭俊 6 vuotta sitten
vanhempi
commit
56714d226e

+ 1 - 2
app/Http/Controllers/Api/SettlementController.php

@@ -19,9 +19,8 @@ class SettlementController extends Controller
     use RulePlus;
     public function index()
     {
-        dd(123);
         $dd = new ZqRule();
-        dd($dd->sw_T1G(1,2,1));
+        dd($dd->bodan(1,2,1));
     }
 
     public function dd()

+ 46 - 0
app/Lib/Biz/Sport/Common.php

@@ -1134,6 +1134,52 @@ class Common {
         }
         return null;
      }
+
+     /**
+     * 滚球投注 危险球审核
+     * $bet_match 投注赛事数据
+     * $result_match_r 投注赛事结果记录
+     */
+    static function WARN_CHECK($bet_match='',$result_match_r=[]){
+        /*
+        危险球定义:
+            1.角球  
+            2. 12码罚球  
+            3.自由球(攻方在守方禁区附近的自由球)  
+            4.掷入球(攻方靠近守方禁区的掷入球)   
+            5.一队向另一队禁区附近进攻
+            ...
+        危险球审核时间:
+            下注成功后60~90秒
+        */
+        if(!empty($bet_match) and !empty($result_match_r)) {
+            //获取投注时间  时间戳
+            $bet_time = strtotime($bet_match->ctime);
+            //取出所有有危险球的数据
+            foreach($result_match_r as $k=>$v){
+                //如果有危险球数据
+                if(!empty($v['warn_more'])){
+                    //json转数组
+                    $warn_more = json_encode($v['warn_more']);
+                    //出现危险球的时间
+                    $warn_time = strtotime($warn_more['time']);
+                    //如果出现危险球的时间不大于投注时间 90秒 则投注无效
+                    if(($warn_time - $bet_time) < 90){
+                        $data=[
+                            'code'=>-1,
+                            'warn_more'=>$warn_more
+                        ];
+                        return $data;
+                    }
+                }
+            }
+            $data = [
+                'code' => 1,
+                'warn_more'=>'',
+            ];
+            return $data;
+        }
+    }
 }
 
 ?>

+ 32 - 0
app/Lib/Settlement/Adapter/ZqRule.php

@@ -9,6 +9,7 @@
 namespace App\Lib\Settlement\Adapter;
 
 use Illuminate\Support\Facades\DB;
+use App\Lib\Biz\Sport\Common as commonFunction;
 
 
 class ZqRule
@@ -379,6 +380,22 @@ class ZqRule
 
         $p_code = $bet_match->p_code;
         $odds_code = $bet_match->odds_code;
+        //==获取是否是滚球投注==
+        $is_rolling = $bet_match->is_rolling;
+        //如果是滚球投注,则进行危险球审核
+        if($is_rolling == 1){
+            $ret = commonFunction::WARN_CHECK($bet_match,$result_match_r);
+            //如果审核不通过,则返回注单无效
+            if($ret['code'] == -1){
+                $data = [
+                    'result' => -200,
+                    'msg' => "滚球投注,危险球审核不通过",
+                    'warn_more' => $ret['warn_more']
+                ];
+                return $data;
+            }
+        }
+        //==end==
 
         //获取主客队投注比分
         $bet_score = explode('-', $bet_match->condition);
@@ -642,6 +659,21 @@ class ZqRule
         //获取父/子级赔率代码
         $p_code = $bet_match->p_code;
         $odds_code = $bet_match->odds_code;
+        //==获取是否是滚球投注==
+        $is_rolling = $bet_match->is_rolling;
+        //如果是滚球投注,则进行危险球审核
+        if($is_rolling == 1){
+            $ret = $this->WARN_CHECK($bet_match,$result_match_r);
+            //如果审核不通过,则返回注单无效
+            if($ret != 1){
+                $data = [
+                    'result' => -200,
+                    'matchResult' => "滚球投注,危险球审核不通过"
+                ];
+                return $data;
+            }
+        }
+        //==end==
 
         //获取最终赛事数据
         $result_match = $this->getHalfData($result_match);

+ 1 - 0
config/sconstant.php

@@ -5,5 +5,6 @@
 
 return [
 	'url' => "http://stadmin.bocai108.com:9094",
+	
 ];