DiyConfigService.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\service\api\diy;
  12. use app\service\core\diy\CoreDiyConfigService;
  13. use app\service\core\site\CoreSiteService;
  14. use core\base\BaseApiService;
  15. /**
  16. * 自定义页面相关配置服务层
  17. * Class DiyConfigService
  18. * @package app\service\admin\diy
  19. */
  20. class DiyConfigService extends BaseApiService
  21. {
  22. /**
  23. * 获取底部导航列表
  24. * @param array $params
  25. * @return array|mixed
  26. */
  27. public function getBottomList($params = [])
  28. {
  29. $list = ( new CoreDiyConfigService() )->getBottomList($params);
  30. $site_addon = ( new CoreSiteService() )->getSiteCache($this->request->defaultSiteId());
  31. // 单应用,排除 系统 底部导航设置
  32. if (count($list) > 1 && count($site_addon[ 'apps' ]) == 1) {
  33. foreach ($list as $k => $v) {
  34. if ($v[ 'key' ] = 'app') {
  35. unset($list[ $k ]);
  36. break;
  37. }
  38. }
  39. $list = array_values($list);
  40. }
  41. $res = [];
  42. foreach ($list as $k => $v) {
  43. $res[] = $this->getBottomConfig($v[ 'key' ]);
  44. }
  45. return $res;
  46. }
  47. /**
  48. * 获取底部导航配置
  49. * @param $key
  50. * @return array
  51. */
  52. public function getBottomConfig()
  53. {
  54. return ( new CoreDiyConfigService() )->getBottomConfig(0);
  55. }
  56. /**
  57. * 获取启动页配置
  58. * @return array
  59. */
  60. public function getStartUpPageConfig($type)
  61. {
  62. return ( new CoreDiyConfigService() )->getStartUpPageConfig(0, $type);
  63. }
  64. }