Config.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Think.Admin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2016~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://think.ctolog.com
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | github开源项目:https://github.com/zoujingli/Think.Admin
  12. // +----------------------------------------------------------------------
  13. namespace app\admin\controller;
  14. use controller\BasicAdmin;
  15. use library\Data;
  16. /**
  17. * 后台参数配置控制器
  18. * Class Config
  19. * @package app\admin\controller
  20. * @author Anyon <zoujingli@qq.com>
  21. * @date 2017/02/15 18:05
  22. */
  23. class Config extends BasicAdmin {
  24. /**
  25. * 当前默认数据模型
  26. * @var string
  27. */
  28. protected $table = 'SystemConfig';
  29. /**
  30. * 当前页面标题
  31. * @var string
  32. */
  33. protected $title = '网站参数配置';
  34. /**
  35. * 显示系统常规配置
  36. */
  37. public function index() {
  38. if (!$this->request->isPost()) {
  39. parent::_list($this->table);
  40. } else {
  41. $data = $this->request->post();
  42. foreach ($data as $key => $vo) {
  43. Data::save($this->table, ['name' => $key, 'value' => $vo], 'name');
  44. }
  45. $this->success('数据修改成功!', '');
  46. }
  47. }
  48. /**
  49. * 文件存储配置
  50. */
  51. public function file() {
  52. $alert = [
  53. 'type' => 'info',
  54. 'title' => '操作提示',
  55. 'content' => '文件引擎参数影响全局文件上传功能,请勿随意修改!'
  56. ];
  57. $this->assign('alert', $alert);
  58. $this->title = '文件存储配置';
  59. $this->index();
  60. }
  61. /**
  62. * 邮件账号配置
  63. */
  64. public function mail() {
  65. $this->title = '邮箱账号配置';
  66. $this->index();
  67. }
  68. /**
  69. * 短信通道账号配置
  70. */
  71. public function sms() {
  72. $this->title = '短信账号配置';
  73. $this->index();
  74. }
  75. }