Ken 1 月之前
父节点
当前提交
dcaa9bd21f
共有 1 个文件被更改,包括 4 次插入6 次删除
  1. 4 6
      app/Services/FixtureService.php

+ 4 - 6
app/Services/FixtureService.php

@@ -15,13 +15,11 @@ static function odds($id)
         $key = "odds_{$id}";
         $odds = Cache::get($key, null);
         if ($odds) return json_decode($odds, true);
-        $res = Client::odds(['fixture'=>$id]);
+        $res = Client::odds(['fixture' => $id]);
+        if (count($res['response']) <= 0) return [];
+        $res = $res['response'][0];
+        Cache::put($key, $res, now()->addHours(3));
         return $res;
-//        $res['']
-//        $sport = Sport::where('data_id', $id)->first();
-//        return $sport->odds;
-
-
     }
 
     /**