Auth::class, // ] // ]; $merge = []; 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(); $config_cache = \Yii::$app->cache->get('alipay_config_cache_' . get_store_id()); if ($config_cache) { $alipay_config = Json::decode($config_cache); } else { $keys = [ 'alipay_platform' ]; $data = Option::get($keys, 0, 'saas'); if(isset($data[0]['value'])) { $alipay_config = json_decode($data[0]['value'],true); }else{ return false; } } $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); } }