video.go 789 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package http
  2. import (
  3. "go-common/library/ecode"
  4. "go-common/library/log"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func obtainCid(c *bm.Context) {
  8. params := c.Request.Form
  9. fn := params.Get("filename")
  10. if fn == "" {
  11. log.Error("filename not exist")
  12. c.JSON(nil, ecode.NothingFound)
  13. return
  14. }
  15. cid, err := vdpSvc.ObtainCid(c, fn)
  16. if err != nil {
  17. c.JSON(nil, ecode.RequestErr)
  18. return
  19. }
  20. c.JSON(map[string]int64{
  21. "cid": cid,
  22. }, nil)
  23. }
  24. func queryCid(c *bm.Context) {
  25. params := c.Request.Form
  26. fn := params.Get("filename")
  27. if fn == "" {
  28. log.Error("filename not exist")
  29. c.JSON(nil, ecode.NothingFound)
  30. return
  31. }
  32. cid, err := vdpSvc.FindCidByFn(c, fn)
  33. if err != nil {
  34. c.JSON(nil, ecode.RequestErr)
  35. return
  36. }
  37. c.JSON(map[string]int64{
  38. "cid": cid,
  39. }, nil)
  40. }