vali %!s(int64=6) %!d(string=hai) anos
pai
achega
adc4db4b65
Modificáronse 2 ficheiros con 55 adicións e 0 borrados
  1. 54 0
      app/Lib/Biz/Sport/Common.php
  2. 1 0
      app/Lib/Settlement/Adapter/ZqRule.php

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

@@ -1,6 +1,8 @@
 <?php
 namespace App\Lib\Biz\Sport;
 use App\Http\Response\Response;
+use Log;
+
 
 use App\Http\Model\StZqMatch;
 use App\Http\Model\StZqLeague;
@@ -1134,6 +1136,58 @@ class Common {
         }
         return null;
      }
+
+     /**
+     * 滚球投注 危险球审核
+     * $bet_match 投注赛事数据
+     * $result_match_r 投注赛事结果记录
+     */
+    static function WARN_CHECK($bet_match='',$result_match=[]){
+        /*
+        危险球定义:
+            1.角球  
+            2. 12码罚球  
+            3.自由球(攻方在守方禁区附近的自由球)  
+            4.掷入球(攻方靠近守方禁区的掷入球)   
+            5.一队向另一队禁区附近进攻
+            ...
+        危险球审核时间:
+            下注成功后60~90秒
+        */
+        if(!empty($bet_match) and !empty($result_match)) {
+            //获取投注时间  时间戳
+            $bet_time = strtotime($bet_match->ctime);
+            //取出所有有危险球的数据
+            $warn_more = $result_match[0]->warn_more;
+            //json转数组
+            $warn_more = json_decode($warn_more,true);
+            foreach($warn_more as $k=>$v){
+                //获取危险球出现时间 转时间戳
+                $warn_time = strtotime($v['timei']);
+                if(($warn_time - $bet_time) < 90){
+                    $data=[
+                        'code'=>-1,
+                        'warn_more'=>$v
+                    ];
+                    return $data;
+                }
+            }
+            $data = [
+                'code' => 1,
+                'warn_more'=>'',
+            ];
+            return $data;
+        }
+    }
+
+    //写入赛事数据日志文件
+    static function SET_SPORTS_RECORD($game_code,$getData=[],$title,$msg){
+        //中文不转义
+        $json_data = json_encode($getData,JSON_UNESCAPED_UNICODE);
+        Log::getMonolog()->popHandler(); 
+        Log::useFiles(storage_path('logs/set_sports_record/'.date('Y-m-d',time()).'/'.$game_code.'/'.$title.'.log'), 'info');
+        Log::info('--->msg:' . $msg . ';data:' . $json_data);
+    }
 }
 
 ?>

+ 1 - 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