Wxapp.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\store\controller\client;
  13. use app\store\controller\Controller;
  14. use app\store\model\Wxapp as WxappModel;
  15. /**
  16. * 微信小程序管理
  17. * Class Wxapp
  18. * @package app\store\controller
  19. */
  20. class Wxapp extends Controller
  21. {
  22. /**
  23. * 微信小程序详情
  24. * @return array
  25. * @throws \think\db\exception\DataNotFoundException
  26. * @throws \think\db\exception\DbException
  27. * @throws \think\db\exception\ModelNotFoundException
  28. */
  29. public function detail()
  30. {
  31. // 当前小程序信息
  32. $detail = WxappModel::detail($this->storeId);
  33. return $this->renderSuccess(compact('detail'));
  34. }
  35. /**
  36. * 微信小程序设置
  37. * @return array
  38. * @throws \think\db\exception\DataNotFoundException
  39. * @throws \think\db\exception\DbException
  40. * @throws \think\db\exception\ModelNotFoundException
  41. */
  42. public function setting()
  43. {
  44. // 当前小程序信息
  45. $model = WxappModel::detail($this->storeId);
  46. // 更新小程序设置
  47. if ($model->edit($this->postForm())) {
  48. return $this->renderSuccess('更新成功');
  49. }
  50. return $this->renderError($model->getError() ?: '更新失败');
  51. }
  52. }