The backend for the project formerly known as signet, now known as beignet.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

42 行
888 B

  1. package endpoints
  2. import (
  3. "encoding/json"
  4. . "github.com/imosed/signet/data"
  5. "net/http"
  6. )
  7. type QueueMember struct {
  8. Asset string `json:"asset"`
  9. Title string `json:"title"`
  10. }
  11. type GetQueueMembersRequest struct {
  12. ID uint `json:"id"`
  13. }
  14. type GetQueueMembersResponse struct {
  15. Members []QueueMember `json:"members"`
  16. }
  17. func GetQueueMembers(w http.ResponseWriter, r *http.Request) {
  18. var req GetQueueMembersRequest
  19. err := json.NewDecoder(r.Body).Decode(&req)
  20. if err != nil {
  21. panic("Could not decode body")
  22. }
  23. var members []QueueMember
  24. Db.Table("queue_orders qo").Select("reward_fund_id, asset, title").Where("queue_id = ?", req.ID).
  25. Joins("inner join reward_funds rf on qo.reward_fund_id = rf.id").
  26. Scan(&members)
  27. var resp GetQueueMembersResponse
  28. resp.Members = members
  29. err = json.NewEncoder(w).Encode(resp)
  30. if err != nil {
  31. panic("Could not deliver response")
  32. }
  33. }