コード例 #1
0
 public function actionInstall($code, $shop_domain)
 {
     $store = Store::findOne(['domain' => $shop_domain]);
     if (!$store) {
         $store = new Store();
         $store->domain = $shop_domain;
     }
     $client = $store->getClient();
     if (!$client->validateSignature(Yii::$app->request->get())) {
         throw new UnauthorizedHttpException(__('Error validate signature'));
     }
     $store->access_token = $client->requestAccessToken($code);
     $store->save();
     Yii::$app->session->set('shop_domain', $shop_domain);
     return $this->redirect(['index']);
 }