Menu.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\cashier\model;
  11. use app\model\BaseModel;
  12. use think\facade\Cache;
  13. /**
  14. * @author Administrator
  15. */
  16. class Menu extends BaseModel
  17. {
  18. /**
  19. * 获取权限列表
  20. * @param $condition
  21. * @param $field
  22. */
  23. public function getMenuList($condition, $field){
  24. $data = model('cashier_auth')->getList($condition, $field);
  25. return $this->success($data);
  26. }
  27. /**
  28. * 获取权限信息
  29. * @param $condition
  30. * @param $field
  31. * @return array
  32. */
  33. public function getMenuValue($condition, $field){
  34. $key = json_encode([$condition, $field]);
  35. if (Cache::has("getMenuValue" . $key)) {
  36. return $this->success(Cache::get("getMenuValue" . $key));
  37. }
  38. $value = model('cashier_auth')->getValue($condition, $field);
  39. Cache::tag('cashier_menu')->set("getMenuValue" . $key, $value);
  40. return $this->success($value);
  41. }
  42. }