app_auth.go 572 B

123456789101112131415161718192021222324252627
  1. package http
  2. import (
  3. "go-common/app/service/main/msm/model"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func scope(c *bm.Context) {
  7. var (
  8. err error
  9. scopeMap map[int64]*model.Scope
  10. param = new(struct {
  11. AppTreeID int64 `form:"app_tree_id" validate:"gt=0"`
  12. })
  13. )
  14. if err = c.Bind(param); err != nil {
  15. return
  16. }
  17. if scopeMap, err = svr.ServiceScopes(c, param.AppTreeID); err != nil {
  18. c.JSON(nil, err)
  19. return
  20. }
  21. data := make(map[string]interface{}, 2)
  22. data["service_tree_id"] = param.AppTreeID
  23. data["scopes"] = scopeMap
  24. c.JSON(data, nil)
  25. }