share.go 516 B

1234567891011121314151617181920212223242526
  1. package http
  2. import (
  3. "go-common/library/ecode"
  4. bm "go-common/library/net/http/blademaster"
  5. "go-common/library/net/metadata"
  6. "strconv"
  7. )
  8. func addShare(c *bm.Context) {
  9. var (
  10. id int64
  11. mid int64
  12. params = c.Request.Form
  13. )
  14. idStr := params.Get("id")
  15. id, _ = strconv.ParseInt(idStr, 10, 64)
  16. if id <= 0 {
  17. c.JSON(nil, ecode.RequestErr)
  18. return
  19. }
  20. if midInter, ok := c.Get("mid"); ok {
  21. mid = midInter.(int64)
  22. }
  23. c.JSON(nil, artSrv.AddShare(c, id, mid, metadata.String(c, metadata.RemoteIP)))
  24. }