bnj.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package http
  2. import bm "go-common/library/net/http/blademaster"
  3. func previewInfo(c *bm.Context) {
  4. var loginMid int64
  5. if midInter, ok := c.Get("mid"); ok {
  6. loginMid = midInter.(int64)
  7. }
  8. c.JSON(bnjSvc.PreviewInfo(c, loginMid), nil)
  9. }
  10. func timeline(c *bm.Context) {
  11. var loginMid int64
  12. if midInter, ok := c.Get("mid"); ok {
  13. loginMid = midInter.(int64)
  14. }
  15. c.JSON(bnjSvc.Timeline(c, loginMid), nil)
  16. }
  17. func reset(c *bm.Context) {
  18. midStr, _ := c.Get("mid")
  19. mid := midStr.(int64)
  20. cd, err := bnjSvc.TimeReset(c, mid)
  21. if err != nil {
  22. c.JSON(nil, err)
  23. return
  24. }
  25. c.JSON(map[string]int64{"cd": cd}, nil)
  26. }
  27. func reward(c *bm.Context) {
  28. v := new(struct {
  29. Step int `form:"step" validate:"min=1"`
  30. })
  31. if err := c.Bind(v); err != nil {
  32. return
  33. }
  34. midStr, _ := c.Get("mid")
  35. mid := midStr.(int64)
  36. c.JSON(nil, likeSvc.Reward(c, mid, v.Step))
  37. }
  38. func delTime(c *bm.Context) {
  39. v := new(struct {
  40. Key string `form:"key" validate:"required"`
  41. })
  42. if err := c.Bind(v); err != nil {
  43. return
  44. }
  45. c.JSON(nil, bnjSvc.DelTime(c, v.Key))
  46. }
  47. func fail(c *bm.Context) {
  48. c.JSON(nil, nil)
  49. }