Menu.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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\model\store;
  13. use app\common\model\store\Menu as MenuModel;
  14. /**
  15. * 商家后台菜单模型
  16. * Class Menu
  17. * @package app\store\model\store
  18. */
  19. class Menu extends MenuModel
  20. {
  21. // 隐藏的字段
  22. protected $hidden = [
  23. 'action_mark',
  24. 'sort',
  25. 'create_time',
  26. 'update_time'
  27. ];
  28. /**
  29. * 根据菜单ID集获取列表
  30. * @param array $menuIds
  31. * @return mixed
  32. * @throws \think\db\exception\DataNotFoundException
  33. * @throws \think\db\exception\DbException
  34. * @throws \think\db\exception\ModelNotFoundException
  35. */
  36. public static function getListByIds(array $menuIds)
  37. {
  38. // 菜单列表
  39. $list = static::getAll([['menu_id', 'in', $menuIds]]);
  40. // 整理菜单绑定的apiID集
  41. return (new static)->getTreeData($list);
  42. }
  43. }