diff --git a/sample-config/session.config.sample.json b/sample-config/session.config.sample.json index d8841e7..8ff2c75 100644 --- a/sample-config/session.config.sample.json +++ b/sample-config/session.config.sample.json @@ -1,5 +1,5 @@ { - "enabled":false, + "enabled":true, "adapter":"redis", //redis|file "option":{ "uniqueId":"KG_", diff --git a/src/Init.php b/src/Init.php index 494b216..b32e3a5 100644 --- a/src/Init.php +++ b/src/Init.php @@ -241,7 +241,8 @@ private static function injectSmsService() $di = self::$di; self::$di->set( 'sms', function () use ($config, $di) { - $smsAdapter = \Kuga\Core\Sms\SmsFactory::getAdapter($config->sms->adapter, $config->sms->adapter, $di); + $adapter = $config->sms->adapter; + $smsAdapter = \Kuga\Core\Sms\SmsFactory::getAdapter($adapter, $config->sms->{$adapter}, $di); return $smsAdapter; } @@ -279,11 +280,11 @@ private static function injectSessionService(){ $session = new \Phalcon\Session\Adapter\Files($sessionOption); $option = $sessionOption; } - self::$di->setShared('session', function() use($option){ + self::$di->setShared('session', function() use($option,$session){ if (isset($_POST['sessid'])){ session_id($_POST['sessid']); } - $session = new \Phalcon\Session\Adapter\Redis($option); + //$session = new \Phalcon\Session\Adapter\Redis($option); ini_set('session.cookie_domain', \Qing\Lib\Application::getCookieDomain()); ini_set('session.cookie_path', '/'); ini_set('session.cookie_lifetime', 86400);