| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\modules\admin\controllers\q_and_a;
- use app\models\QAndAAdSetting;
- use app\models\QAndASetting;
- use app\modules\admin\controllers\BaseController;
- use app\modules\admin\models\q_and_a\DefaultForm;
- class DefaultController extends BaseController
- {
- public function actionSetting()
- {
- $model = QAndASetting::find()->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(),
- ]
- ]);
- }
- }
|