web_cm.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package http
  2. import (
  3. "go-common/app/interface/main/creative/model/order"
  4. "go-common/library/ecode"
  5. bm "go-common/library/net/http/blademaster"
  6. "go-common/library/net/metadata"
  7. "strconv"
  8. )
  9. func webCmOasisStat(c *bm.Context) {
  10. ip := metadata.String(c, metadata.RemoteIP)
  11. midI, ok := c.Get("mid")
  12. if !ok {
  13. c.JSON(nil, ecode.NoLogin)
  14. return
  15. }
  16. mid, _ := midI.(int64)
  17. var (
  18. oasisEarnings *order.OasisEarnings
  19. )
  20. oa, _ := arcSvc.Oasis(c, mid, ip)
  21. oasisEarnings = &order.OasisEarnings{}
  22. if oa != nil {
  23. oasisEarnings.State = oa.State
  24. oasisEarnings.Realese = oa.RealeseOrder
  25. oasisEarnings.Total = oa.TotalOrder
  26. }
  27. c.JSON(oasisEarnings, nil)
  28. }
  29. func arcCommercial(c *bm.Context) {
  30. ip := metadata.String(c, metadata.RemoteIP)
  31. params := c.Request.Form
  32. aidStr := params.Get("aid")
  33. aid, err := strconv.ParseInt(aidStr, 10, 64)
  34. if err != nil || aid <= 0 {
  35. c.JSON(nil, ecode.RequestErr)
  36. return
  37. }
  38. pd, err := arcSvc.ArcCommercial(c, aid, ip)
  39. if err != nil {
  40. c.JSON(nil, err)
  41. return
  42. }
  43. if pd == nil || pd.GameID == 0 {
  44. c.JSON(nil, ecode.NothingFound)
  45. return
  46. }
  47. c.JSON(pd, nil)
  48. }