Page.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 文字配置
  7. */
  8. namespace app\citys\controller;
  9. use app\citys\model\CitysPage;
  10. use think\facade\Request;
  11. class Page extends Common {
  12. public function initialize() {
  13. parent::initialize();
  14. $this->assign('pathMaps', [['name'=>'权益声明','url'=>'javascript:;']]);
  15. }
  16. /**
  17. * 免责申明
  18. */
  19. public function index(){
  20. $companyInfo = CitysPage::where($this->mini_program)->find();
  21. $this->assign('companyInfo',$companyInfo);
  22. return $this->fetch();
  23. }
  24. /**
  25. * 关于我们
  26. */
  27. public function about(){
  28. $companyInfo = CitysPage::where($this->mini_program)->find();
  29. $this->assign('companyInfo',$companyInfo);
  30. return $this->fetch();
  31. }
  32. /**
  33. * 服务协议
  34. */
  35. public function agreement(){
  36. $companyInfo = CitysPage::where($this->mini_program)->find();
  37. $this->assign('companyInfo',$companyInfo);
  38. return $this->fetch();
  39. }
  40. /**
  41. * 防骗警示
  42. */
  43. public function fraud(){
  44. $companyInfo = CitysPage::where($this->mini_program)->find();
  45. $this->assign('companyInfo',$companyInfo);
  46. return $this->fetch();
  47. }
  48. /**
  49. * 客服电话
  50. */
  51. public function tel(){
  52. $companyInfo = CitysPage::where($this->mini_program)->find();
  53. $this->assign('companyInfo',$companyInfo);
  54. return $this->fetch();
  55. }
  56. /**
  57. * 信息修改
  58. */
  59. public function update(){
  60. if(Request::instance()->isPost()){
  61. switch ($this->request->param('type/d')) {
  62. case 1:
  63. $data['disclaimer'] = $this->request->param('disclaimer');
  64. break;
  65. case 2:
  66. $data['about'] = $this->request->param('about');
  67. break;
  68. case 3:
  69. $data['agreement'] = $this->request->param('agreement');
  70. break;
  71. case 4:
  72. $param['title'] = $this->request->param('title/a');
  73. $param['phone'] = $this->request->param('phone/a');
  74. $phone = [];
  75. foreach ($param['title'] as $key => $value) {
  76. $phone[$key]['title'] = $value;
  77. $phone[$key]['phone'] = $param['phone'][$key] ?: 0;
  78. }
  79. $data['phone'] = $phone;
  80. break;
  81. case 5:
  82. $data['fraud'] = $this->request->param('fraud');
  83. break;
  84. default:
  85. return enjson(401,'设置失败');
  86. break;
  87. }
  88. $res = CitysPage::where($this->mini_program)->find();
  89. if($res){
  90. $res = CitysPage::where($this->mini_program)->update($data);
  91. }else{
  92. $data['member_miniapp_id'] = $this->member_miniapp_id;
  93. $res = CitysPage::create($data);
  94. }
  95. return enjson($res?200:0);
  96. }
  97. }
  98. }