Config.php 798 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\admin\controller\shopro\wechat;
  3. use app\admin\model\shopro\Config as ShoproConfig;
  4. use app\admin\controller\shopro\Common;
  5. class Config extends Common
  6. {
  7. /**
  8. * 公众号配置
  9. */
  10. public function index()
  11. {
  12. if (!$this->request->isAjax()) {
  13. return $this->view->fetch();
  14. }
  15. if ('GET' === $this->request->method()) {
  16. $configs = ShoproConfig::getConfigs('wechat.officialAccount', false);
  17. $configs['server_url'] = request()->domain() . '/addons/shopro/wechat.serve';
  18. } elseif ('POST' === $this->request->method()) {
  19. $configs = ShoproConfig::setConfigs('wechat.officialAccount', $this->request->param());
  20. }
  21. $this->success('操作成功', null, $configs);
  22. }
  23. }