wesmiler 2 місяців тому
батько
коміт
0d84be897b

+ 2 - 0
app/Services/Api/SupervisorsService.php

@@ -24,6 +24,8 @@ use App\Services\RedisService;
  */
 class SupervisorsService extends BaseService
 {
+    protected static $instance = null;
+
     /**
      * 构造函数
      * @author laravel开发员

+ 14 - 0
app/Services/Common/AdService.php

@@ -24,6 +24,8 @@ use App\Services\RedisService;
  */
 class AdService extends BaseService
 {
+    protected static $instance = null;
+
     /**
      * 构造函数
      * @author laravel开发员
@@ -36,6 +38,18 @@ class AdService extends BaseService
     }
 
     /**
+     * 静态入口
+     * @return static|null
+     */
+    public static function make()
+    {
+        if (!self::$instance) {
+            self::$instance = (new static());
+        }
+        return self::$instance;
+    }
+
+    /**
      * 按广告位获取缓存列表
      * @param $position
      * @param int $num