where(['store_id' => get_store_id()])->one(); if (!$model) { $model = new QAndASetting(); $model->store_id = get_store_id(); } if (\Yii::$app->request->isPost) { $form = new DefaultForm(); $form->attributes = post_params(); $form->model =$model; return $this->asJson($form->save()); } return $this->asJson([ 'code' => 0, 'data' => [ 'model' => $model ] ]); } public function actionAdSetting() { $model = QAndAAdSetting::find()->where(['store_id' => get_store_id()])->one(); if (!$model) { $model = new QAndAAdSetting(); $model->store_id = get_store_id(); } if (\Yii::$app->request->isPost) { $form = new DefaultForm(); $form->attributes = post_params(); $form->model =$model; return $this->asJson($form->ad_save()); } return $this->asJson([ 'code' => 0, 'data' => [ 'model' => $model, 'callback_url' => \Yii::$app->request->hostInfo . '/index.php/ad/callback/'.get_store_id(), ] ]); } }