group.go 837 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package controllers
  2. import (
  3. "net/http"
  4. "pmail/dto"
  5. "pmail/dto/response"
  6. "pmail/i18n"
  7. )
  8. type groupItem struct {
  9. Label string `json:"label"`
  10. Tag string `json:"tag"`
  11. Children []*groupItem `json:"children"`
  12. }
  13. func GetUserGroup(ctx *dto.Context, w http.ResponseWriter, req *http.Request) {
  14. retData := []*groupItem{
  15. {
  16. Label: i18n.GetText(ctx.Lang, "all_email"),
  17. Children: []*groupItem{
  18. {
  19. Label: i18n.GetText(ctx.Lang, "inbox"),
  20. Tag: dto.SearchTag{Type: 0, Status: -1}.ToString(),
  21. },
  22. {
  23. Label: i18n.GetText(ctx.Lang, "outbox"),
  24. Tag: dto.SearchTag{Type: 1, Status: 1}.ToString(),
  25. },
  26. {
  27. Label: i18n.GetText(ctx.Lang, "sketch"),
  28. Tag: dto.SearchTag{Type: 1, Status: 0}.ToString(),
  29. },
  30. },
  31. },
  32. }
  33. response.NewSuccessResponse(retData).FPrint(w)
  34. }