sys_auth_rule.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * @desc:菜单api
  3. * @company:云南奇讯科技有限公司
  4. * @Author: yixiaohu<yxh669@qq.com>
  5. * @Date: 2022/3/18 10:27
  6. */
  7. package system
  8. import (
  9. "github.com/gogf/gf/v2/frame/g"
  10. "github.com/tiger1103/gfast/v3/internal/app/system/model"
  11. "github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
  12. )
  13. type RuleAddReq struct {
  14. g.Meta `path:"/menu/add" tags:"菜单管理" method:"post" summary:"添加菜单"`
  15. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  16. MenuType uint `p:"menuType" v:"min:0|max:2#菜单类型最小值为:min|菜单类型最大值为:max"`
  17. Pid uint `p:"parentId" v:"min:0"`
  18. Name string `p:"name" v:"required#请填写规则名称"`
  19. Title string `p:"menuName" v:"required|length:1,100#请填写标题|标题长度在:min到:max位"`
  20. Icon string `p:"icon"`
  21. Weigh int `p:"menuSort" `
  22. Condition string `p:"condition" `
  23. Remark string `p:"remark" `
  24. IsHide uint `p:"isHide"`
  25. Path string `p:"path"`
  26. Redirect string `p:"redirect"` // 路由重定向
  27. Roles []uint `p:"roles"` // 角色ids
  28. Component string `p:"component" v:"required-if:menuType,1#组件路径不能为空"`
  29. IsLink uint `p:"isLink"`
  30. IsIframe uint `p:"isIframe"`
  31. IsCached uint `p:"isKeepAlive"`
  32. IsAffix uint `p:"isAffix"`
  33. LinkUrl string `p:"linkUrl"`
  34. }
  35. type RuleAddRes struct {
  36. }
  37. type RuleGetParamsReq struct {
  38. g.Meta `path:"/menu/getParams" tags:"菜单管理" method:"get" summary:"获取添加、编辑菜单相关参数"`
  39. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  40. }
  41. type RuleGetParamsRes struct {
  42. g.Meta `mime:"application/json"`
  43. Roles []*entity.SysRole `json:"roles"`
  44. Menus []*model.SysAuthRuleInfoRes `json:"menus"`
  45. }
  46. type RuleInfoReq struct {
  47. g.Meta `path:"/menu/get" tags:"菜单管理" method:"get" summary:"获取菜单信息"`
  48. Authorization string `p:"Authorization" in:"header" dc:"Bearer {{token}}"`
  49. Id uint `p:"required#菜单id必须"`
  50. }
  51. type RuleInfoRes struct {
  52. g.Meta `mime:"application/json"`
  53. Rule *entity.SysAuthRule `json:"rule"`
  54. }