SettingController.php 822 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace addons\Authority\merchant\controllers;
  3. use Yii;
  4. use common\helpers\ArrayHelper;
  5. use addons\Authority\common\models\SettingForm;
  6. /**
  7. * 参数设置
  8. *
  9. * Class SettingController
  10. * @package addons\Authority\merchant\controllers
  11. */
  12. class SettingController extends BaseController
  13. {
  14. /**
  15. * @return mixed|string
  16. */
  17. public function actionDisplay()
  18. {
  19. $request = Yii::$app->request;
  20. $model = new SettingForm();
  21. $model->attributes = $this->getConfig();
  22. if ($model->load($request->post()) && $model->validate()) {
  23. $this->setConfig(ArrayHelper::toArray($model));
  24. return $this->message('修改成功', $this->redirect(['display']));
  25. }
  26. return $this->render('display',[
  27. 'model' => $model,
  28. ]);
  29. }
  30. }
粤ICP备19079148号