Setting.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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\CitysConfig;
  10. class Setting extends Common{
  11. /**
  12. * 同城信息配置
  13. * @return void
  14. */
  15. public function info(){
  16. if(request()->isAjax()){
  17. $data = [
  18. 'today' => $this->request->param('today/a'),
  19. 'money' => $this->request->param('money/a'),
  20. 'vip' => $this->request->param('vip/d'),
  21. 'charge' => $this->request->param('charge/d'),
  22. 'phone' => $this->request->param('phone/f',0),
  23. 'mch_id' => $this->request->param('mch_id/d',0),
  24. ];
  25. $validate = $this->validate($data,'info.config');
  26. if(true !== $validate){
  27. return json(['code'=>0,'msg'=>$validate]);
  28. }
  29. if(empty($data['today'])){
  30. return json(['code'=>0,'msg'=>'请设置城市号配置']);
  31. }
  32. $result = CitysConfig::edit($data,$this->member_miniapp_id);
  33. if($result){
  34. return json(['code'=>200,'data' => ['url' => url('setting/info')],'msg'=>'操作成功']);
  35. }else{
  36. return json(['code'=>0,'msg'=>'操作失败']);
  37. }
  38. }else{
  39. $view['config'] = CitysConfig::Config($this->member_miniapp_id);
  40. $view['pathMaps'] = [['name' =>'推广设置','url' => url("citys/setting/info")]];
  41. $view['tabs'] = [
  42. ['name' =>'主题管理','url' =>url('citys/cate/index')],
  43. ['name' =>'模板库','url' =>url('citys/tpl/index')],
  44. ['name' =>'应用设置','url' =>url('citys/setting/info'),'action' => 1],
  45. ];
  46. return view()->assign($view);
  47. }
  48. }
  49. }