AdminSettingController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 小夏 < 449134904@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\teahouse\controller;
  12. use cmf\controller\AdminBaseController;
  13. use think\Validate;
  14. class AdminSettingController extends AdminBaseController
  15. {
  16. public function index()
  17. {
  18. $setting = cmf_get_option('teahouse_setting');
  19. $this->assign($setting);
  20. return $this->fetch();
  21. }
  22. public function indexPost()
  23. {
  24. $post = array_map('trim', $this->request->param());
  25. if (in_array('', $post) && !empty($post['teahouse_setting'])) {
  26. $this->error("不能留空!");
  27. }
  28. cmf_set_option('teahouse_setting', $post);
  29. $this->success("保存成功!");
  30. }
  31. }