浏览代码

magicBook init

程旭源 4 年之前
父节点
当前提交
ffc9e5c077
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. 8 1
      application/common/behavior/Common.php
  2. 6 0
      composer.json

+ 8 - 1
application/common/behavior/Common.php

@@ -74,7 +74,7 @@ class Common
         $this->moduleInit($request);
     }
 
-    static public function getRedis()
+    static public function getRedis($params)
     {
         $options = [
             'host'       => '127.0.0.1',
@@ -87,6 +87,13 @@ class Common
             'prefix'     => '',
         ];
 
+        if (!extension_loaded('redis')) {
+            throw new \BadFunctionCallException('not support: redis');
+        }
+
+        if (!empty($params)) {
+            $options = array_merge($options, $params);
+        }
 
     }
 }

+ 6 - 0
composer.json

@@ -28,5 +28,11 @@
     },
     "config": {
         "preferred-install": "dist"
+    },
+    "repositories": {
+        "packagist": {
+            "type": "composer",
+            "url": "https://packagist.phpcomposer.com"
+        }
     }
 }