plugin.go 794 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package http
  2. import (
  3. "strconv"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func plugin(c *bm.Context) {
  8. var (
  9. params = c.Request.Form
  10. build int
  11. baseCode int
  12. seed int
  13. err error
  14. )
  15. name := params.Get("name")
  16. buildStr := params.Get("build")
  17. baseCodeStr := params.Get("base_code")
  18. seedStr := params.Get("seed")
  19. if build, err = strconv.Atoi(buildStr); err != nil {
  20. c.JSON(nil, ecode.RequestErr)
  21. return
  22. }
  23. if seed, err = strconv.Atoi(seedStr); err != nil {
  24. c.JSON(nil, ecode.RequestErr)
  25. return
  26. }
  27. if baseCode, err = strconv.Atoi(baseCodeStr); err != nil {
  28. c.JSON(nil, ecode.RequestErr)
  29. return
  30. }
  31. if pg := pgSvr.Plugin(build, baseCode, seed, name); pg != nil {
  32. c.JSON(pg, nil)
  33. } else {
  34. c.JSON(struct{}{}, nil)
  35. }
  36. }