1
0

api.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package model
  2. type Api struct {
  3. ServiceId int `json:"serviceId" gorm:"size:4;not null;comment:服务ID"` // 服务ID
  4. Name string `json:"name" gorm:"size:256;comment:标题"` // 标题
  5. Path string `json:"path" gorm:"size:256;comment:地址"` // 地址
  6. Action string `json:"action" gorm:"size:16;comment:请求类型"` // 请求类型
  7. RoleKey string `json:"roleKey" gorm:"size:128;comment:角色编码" swaggerignore:"true"` // 角色编码
  8. }
  9. type BeegoApi struct {
  10. ServiceId int `json:"serviceId" orm:"size(4)" example:"1"` // 服务ID
  11. Name string `json:"name" orm:"size(256)" example:"test"` // 标题
  12. Path string `json:"path" orm:"size(256)" example:"/test"` // 地址
  13. Action string `json:"action" orm:"size(16)" example:"Get"` // 请求类型
  14. RoleKey string `json:"roleKey" orm:"size(128)" swaggerignore:"true"` // 角色编码
  15. }
  16. // SetCreateBy 设置创建人id
  17. func (e *Api) SetApi(ServiceId int, Name, Path, Action, RoleKey string) {
  18. e.ServiceId = ServiceId
  19. e.Name = Name
  20. e.Path = Path
  21. e.Action = Action
  22. e.RoleKey = RoleKey
  23. }
  24. // SetCreateBy 设置创建人id
  25. func (e *BeegoApi) SetApi(ServiceId int, Name, Path, Action, RoleKey string) {
  26. e.ServiceId = ServiceId
  27. e.Name = Name
  28. e.Path = Path
  29. e.Action = Action
  30. e.RoleKey = RoleKey
  31. }