elec.go 662 B

1234567891011121314151617181920212223242526272829303132
  1. package http
  2. import (
  3. "strconv"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func elecShow(c *bm.Context) {
  8. var (
  9. mid, loginID, aid int64
  10. err error
  11. )
  12. params := c.Request.Form
  13. midStr := params.Get("mid")
  14. if mid, err = strconv.ParseInt(midStr, 10, 64); err != nil || mid <= 0 {
  15. c.JSON(nil, ecode.RequestErr)
  16. return
  17. }
  18. aidStr := params.Get("aid")
  19. if aid, err = strconv.ParseInt(aidStr, 10, 64); err != nil || aid <= 0 {
  20. c.JSON(nil, ecode.RequestErr)
  21. return
  22. }
  23. // login mid
  24. if loginIDStr, ok := c.Get("mid"); ok {
  25. loginID = loginIDStr.(int64)
  26. }
  27. c.JSON(webSvc.ElecShow(c, mid, aid, loginID))
  28. }