DecorateTabbar.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\common\model\decorate;
  15. use app\common\model\BaseModel;
  16. use app\common\service\FileService;
  17. /**
  18. * 装修配置-底部导航
  19. * Class DecorateTabbar
  20. * @package app\common\model\decorate
  21. */
  22. class DecorateTabbar extends BaseModel
  23. {
  24. // 设置json类型字段
  25. protected $json = ['link'];
  26. // 设置JSON数据返回数组
  27. protected $jsonAssoc = true;
  28. /**
  29. * @notes 获取底部导航列表
  30. * @return array
  31. * @throws \think\db\exception\DataNotFoundException
  32. * @throws \think\db\exception\DbException
  33. * @throws \think\db\exception\ModelNotFoundException
  34. * @author 段誉
  35. * @date 2022/9/23 12:07
  36. */
  37. public static function getTabbarLists()
  38. {
  39. $tabbar = self::select()->toArray();
  40. if (empty($tabbar)) {
  41. return $tabbar;
  42. }
  43. foreach ($tabbar as &$item) {
  44. if (!empty($item['selected'])) {
  45. $item['selected'] = FileService::getFileUrl($item['selected']);
  46. }
  47. if (!empty($item['unselected'])) {
  48. $item['unselected'] = FileService::getFileUrl($item['unselected']);
  49. }
  50. }
  51. return $tabbar;
  52. }
  53. }