mask.go 1003 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package http
  2. import (
  3. "strconv"
  4. "strings"
  5. "go-common/library/ecode"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. func updateMask(c *bm.Context) {
  9. p := c.Request.Form
  10. var (
  11. cid, plat, fps, maskTime int64
  12. list string
  13. err error
  14. )
  15. if cid, err = strconv.ParseInt(p.Get("cid"), 10, 64); err != nil || cid <= 0 {
  16. c.JSON(nil, ecode.RequestErr)
  17. return
  18. }
  19. if plat, err = strconv.ParseInt(p.Get("plat"), 10, 64); err != nil || plat < 0 {
  20. c.JSON(nil, ecode.RequestErr)
  21. return
  22. }
  23. if p.Get("time") != "" {
  24. if maskTime, err = strconv.ParseInt(p.Get("time"), 10, 64); err != nil || maskTime < 0 {
  25. c.JSON(nil, ecode.RequestErr)
  26. return
  27. }
  28. }
  29. if p.Get("fps") != "" {
  30. fps, err = strconv.ParseInt(p.Get("fps"), 10, 64)
  31. if err != nil || fps <= 0 {
  32. c.JSON(nil, ecode.RequestErr)
  33. return
  34. }
  35. }
  36. list = strings.Replace(p.Get("list"), " ", "", -1)
  37. err = dmSvc.UpdateMask(c, cid, maskTime, int32(fps), int8(plat), list)
  38. c.JSON(nil, err)
  39. }