Auth::class, ] ]; if ($this->isRoute()) { $merge[] = [ 'class' => UserLogin::class, ]; } return ArrayHelper::merge($merge, parent::behaviors()); } public function isRoute() { $route = \Yii::$app->controller->getRoute(); if (in_array($route, self::ALLOW_LIST)) { return false; } else { return true; } } public function init() { parent::init(); if (\Yii::$app->prod_is_dandianpu()) { $alipay_config = Option::get('one_store_alipay_config', 0, 'saas')['value']; if ($alipay_config) { $alipay_config = json_decode($alipay_config, true); } } else { $config_cache = \Yii::$app->cache->get('alipay_config_cache_' . get_store_id()); if ($config_cache) { $alipay_config = Json::decode($config_cache); } else { $alipay_config = Json::decode(Option::get(Option::OPTOPN_KEY, get_store_id(), 'alipay')['value']); } } $this->alipayConfig = $alipay_config; $config = [ 'alipay' => [ // This can also be named as 'app_id' like the official documentation. 'client_id' => $alipay_config['app_id'], // Please refer to the official documentation, in the official management background configuration RSA2. // Note: This is your own private key. // Note: Do not allow the private key content to have extra characters. // Recommendation: For security, you can read directly from the file. But here as long as the value, please remember to remove the head and tail of the decoration. 'rsa_private_key' => $alipay_config['app_private_key'], // Be sure to set this value and make sure that it is the same address value as set in the official admin system. // This can also be named as 'redirect_url' like the official documentation. // 'redirect' => 'http://localhost/socialite/callback.php', ] ]; \Yii::warning($config); $this->socialite = new SocialiteManager($config); } }