vali 6 سال پیش
والد
کامیت
cf075d3327
1فایلهای تغییر یافته به همراه35 افزوده شده و 6 حذف شده
  1. 35 6
      app/Lib/Biz/Sport/Common.php

+ 35 - 6
app/Lib/Biz/Sport/Common.php

@@ -1219,10 +1219,10 @@ class Common
     {
         /*
         危险球定义:
-            1.角球  
-            2. 12码罚球  
-            3.自由球(攻方在守方禁区附近的自由球)  
-            4.掷入球(攻方靠近守方禁区的掷入球)   
+            1.角球
+            2. 12码罚球
+            3.自由球(攻方在守方禁区附近的自由球)
+            4.掷入球(攻方靠近守方禁区的掷入球)
             5.一队向另一队禁区附近进攻
             ...
         危险球审核时间:
@@ -1241,7 +1241,7 @@ class Common
             $warn_more = trim($result_match[0]->warn_more);
 
             //当值为默认值时,表示没有危险球,不用再作判断了
-            if ($warn_more == '[{"timei":"1970-1-1 0:0:1","rtype":0}]' || empty($warn_more) || $warn_more == '[]') {
+            if ($warn_more == '[{"timei":"1970-1-1 0:0:1","rtype":0}]' || $warn_more == '' || $warn_more == '[]') {
                 return $defdata;
             }
 
@@ -1250,7 +1250,8 @@ class Common
             foreach ($warn_more as $k => $v) {
                 //获取危险球出现时间 转时间戳
                 $warn_time = strtotime($v['timei']);
-                if (($warn_time - $bet_time) < 90) {
+
+                if (($warn_time - $bet_time) < 90 && ($warn_time - $bet_time) >= 0) {
                     $data = [
                         'code' => -1,
                         'warn_more' => $v
@@ -1263,6 +1264,7 @@ class Common
         }
     }
 
+
     //写入赛事数据日志文件
     static function SET_SPORTS_RECORD($game_code, $getData = [], $title, $msg)
     {
@@ -1272,6 +1274,33 @@ class Common
         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);
     }
+
+    /* 
+     * 根据二维数组某个字段的值查找数组
+     * $array 数组
+     * 查询字段
+     * $value 字段值
+    */
+    static function filter_by_value($array_l, $index, $value)
+    {
+        $data_json = json_encode($array_l);
+        $array = json_decode($data_json, true);
+        if (is_array($array) && count($array) > 0) {
+            foreach (array_keys($array) as $key) {
+                $temp[$key] = $array[$key][$index];
+
+                if ($temp[$key] == $value) {
+
+                    $newarray = $array[$key];
+                    return $newarray;
+
+                }
+            }
+        }
+        return [];
+    }
+
+
 }
 
 ?>