Setting.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.thinkphp.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: thinkphp <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\api\controller;
  13. use app\api\service\Payment;
  14. use app\api\service\Setting as SettingService;
  15. /**
  16. * 商城设置控制器
  17. * Class Setting
  18. * @package app\store\controller
  19. */
  20. class Setting extends Controller
  21. {
  22. /**
  23. * 商城公共设置(仅展示可公开的信息)
  24. * @return array|\think\response\Json
  25. * @throws \think\db\exception\DataNotFoundException
  26. * @throws \think\db\exception\DbException
  27. * @throws \think\db\exception\ModelNotFoundException
  28. */
  29. public function data()
  30. {
  31. $service = new SettingService;
  32. $setting = $service->getPublic();
  33. return $this->renderSuccess(compact('setting'));
  34. }
  35. /**
  36. * @return \think\response\Json
  37. * @throws \app\common\exception\BaseException
  38. * @throws \think\db\exception\DataNotFoundException
  39. * @throws \think\db\exception\DbException
  40. * @throws \think\db\exception\ModelNotFoundException
  41. */
  42. public function pay()
  43. {
  44. $paySetting = Payment::getPaySetting();
  45. return $this->renderSuccess(compact('paySetting'));
  46. }
  47. }