Config.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://demo.thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  12. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  13. // +----------------------------------------------------------------------
  14. namespace app\store\controller;
  15. use app\store\service\ExtendService;
  16. use library\Controller;
  17. /**
  18. * 活动参数配置
  19. * Class Config
  20. * @package app\store\controller
  21. */
  22. class Config extends Controller
  23. {
  24. /**
  25. * 活动参数配置
  26. * @auth true
  27. * @menu true
  28. * @throws \think\Exception
  29. * @throws \think\exception\PDOException
  30. */
  31. public function index()
  32. {
  33. $this->title = '参数配置';
  34. $this->applyCsrfToken('save');
  35. $this->query = ExtendService::queryChinaSmsBalance();
  36. $this->query2 = ExtendService::queryGlobeSmsBalance();
  37. $this->crystal_switch = sysconf('crystal_switch');
  38. $this->fetch();
  39. }
  40. /**
  41. * 保存商城参数
  42. * @auth true
  43. * @throws \think\Exception
  44. * @throws \think\exception\PDOException
  45. */
  46. public function save()
  47. {
  48. if ($this->request->isPost()) {
  49. $this->applyCsrfToken('save');
  50. foreach ($this->request->post() as $k => $v) sysconf($k, $v);
  51. $this->success('活动参数设置保存成功!');
  52. }
  53. }
  54. }