playurl.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package http
  2. import (
  3. "fmt"
  4. "go-common/app/interface/main/app-player/model"
  5. "go-common/library/conf/env"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. bm "go-common/library/net/http/blademaster"
  9. )
  10. func playurl(c *bm.Context) {
  11. params := &model.Param{}
  12. if err := c.Bind(params); err != nil {
  13. return
  14. }
  15. var mid int64
  16. if midInter, ok := c.Get("mid"); ok {
  17. mid = midInter.(int64)
  18. }
  19. header := c.Request.Header
  20. buvid := header.Get("Buvid")
  21. fp := header.Get("X-BVC-FINGERPRINT")
  22. if params.AID <= 0 {
  23. errCount.Incr(fmt.Sprintf("%s_%d", params.MobiApp, params.Build))
  24. log.Warn("juranmeichuan aid %s", c.Request.URL.Path+"?"+c.Request.Form.Encode())
  25. if env.DeployEnv != env.DeployEnvProd {
  26. c.JSON(nil, ecode.RequestErr)
  27. return
  28. }
  29. }
  30. if params.CID <= 0 {
  31. c.JSON(nil, ecode.RequestErr)
  32. return
  33. }
  34. if params.Qn < 0 {
  35. c.JSON(nil, ecode.RequestErr)
  36. return
  37. }
  38. if params.Npcybs < 0 {
  39. c.JSON(nil, ecode.RequestErr)
  40. return
  41. }
  42. if params.Otype != "json" && params.Otype != "xml" {
  43. params.Otype = "json"
  44. }
  45. plat := model.Plat(params.MobiApp, params.Device)
  46. c.JSON(svr.Playurl(c, mid, params, plat, buvid, fp))
  47. }