Client.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 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\api\service;
  13. use app\api\model\h5\Setting as H5SettingModel;
  14. use app\common\library\helper;
  15. use app\common\service\BaseService;
  16. /**
  17. * 服务类:客户端公共数据
  18. * Class Client
  19. * @package app\api\service
  20. */
  21. class Client extends BaseService
  22. {
  23. /**
  24. * 客户端公共数据
  25. * @return array
  26. * @throws \think\db\exception\DataNotFoundException
  27. * @throws \think\db\exception\DbException
  28. * @throws \think\db\exception\ModelNotFoundException
  29. */
  30. public function getPublic(): array
  31. {
  32. return [
  33. 'h5' => $this->getH5Public(),
  34. ];
  35. }
  36. /**
  37. * 获取H5端公共数据
  38. * @return array
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\DbException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. */
  43. private function getH5Public(): array
  44. {
  45. $values = H5SettingModel::getItem('basic');
  46. return ['setting' => helper::pick($values, ['enabled', 'baseUrl'])];
  47. }
  48. }