Config.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. namespace app\admin\controller;
  3. /**
  4. * 站点管理
  5. */
  6. class Config extends Admin{
  7. protected $Config = null;
  8. protected function _initialize(){
  9. parent::_initialize();
  10. $this->Config = model('Config');
  11. }
  12. public function save(){
  13. if ($this->request->isPost()) {
  14. $value = input('post.value/a',[]);
  15. $key = input('post.key');
  16. $result = cnf($key,$value);
  17. if ($result) {
  18. return json(['data'=>null,'code'=>0,'msg'=>'设置成功']);
  19. }
  20. return json(['data'=>$_POST,'code'=>1,'msg'=>'设置失败']);
  21. }
  22. }
  23. public function site(){
  24. $setting = $this->Config->where(['key'=>'site'])->find();
  25. $site = $setting->value;
  26. $this->assign('site',$site);
  27. $this->assign('meta_title','站点设置');
  28. return $this->fetch();
  29. }
  30. public function withdraw(){
  31. $withdraw = cnf('withdraw');
  32. $this->assign('withdraw',$withdraw);
  33. $this->assign('meta_title','提现配置');
  34. return $this->fetch();
  35. }
  36. public function recharge(){
  37. $recharge = cnf('recharge');
  38. $this->assign('recharge',$recharge);
  39. $this->assign('meta_title','充值配置');
  40. return $this->fetch();
  41. }
  42. public function sms(){
  43. $sms = cnf('sms');
  44. $this->assign('sms',$sms);
  45. $this->assign('meta_title','短信配置');
  46. return $this->fetch();
  47. }
  48. public function invite(){
  49. $invite = cnf('invite');
  50. $this->assign('invite',$invite);
  51. $this->assign('meta_title','邀请配置');
  52. return $this->fetch();
  53. }
  54. public function order(){
  55. $order = cnf('order');
  56. $this->assign('order',$order);
  57. $this->assign('meta_title','订单配置');
  58. return $this->fetch();
  59. }
  60. public function express(){
  61. $express = cnf('express');
  62. $this->assign('express',$express);
  63. $this->assign('meta_title','快递配置');
  64. return $this->fetch();
  65. }
  66. public function app(){
  67. $app = cnf('app');
  68. $this->assign('app',$app);
  69. $this->assign('meta_title','APP配置');
  70. return $this->fetch();
  71. }
  72. public function signin(){
  73. $signin = cnf('signin');
  74. $this->assign('signin',$signin);
  75. $this->assign('meta_title','签到配置');
  76. return $this->fetch();
  77. }
  78. public function other(){
  79. $other = cnf('other');
  80. $this->assign('other',$other);
  81. $this->assign('meta_title','其他配置');
  82. return $this->fetch();
  83. }
  84. }