join.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 joinAv(c *bm.Context) {
  8. v := new(struct {
  9. AccountType int `form:"account_type"`
  10. SignType int `form:"sign_type"`
  11. })
  12. var err error
  13. if err = c.Bind(v); err != nil {
  14. return
  15. }
  16. midI, ok := c.Get("mid")
  17. if !ok {
  18. c.JSON(nil, ecode.NoLogin)
  19. return
  20. }
  21. mid, _ := midI.(int64)
  22. if err = svc.JoinAv(c, v.AccountType, mid, v.SignType); err != nil {
  23. log.Error("svc.Join accountType(%d) mid(%d) signType(%d) error(%v)", v.AccountType, mid, v.SignType, err)
  24. }
  25. c.JSON(nil, err)
  26. }
  27. func joinBgm(c *bm.Context) {
  28. v := new(struct {
  29. AccountType int `form:"account_type"`
  30. SignType int `form:"sign_type"`
  31. })
  32. var err error
  33. if err = c.Bind(v); err != nil {
  34. return
  35. }
  36. midI, ok := c.Get("mid")
  37. if !ok {
  38. c.JSON(nil, ecode.NoLogin)
  39. return
  40. }
  41. mid, _ := midI.(int64)
  42. if err = svc.JoinBgm(c, mid, v.AccountType, v.SignType); err != nil {
  43. log.Error("svc.JoinBgm accountType(%d) mid(%d) signType(%d) error(%v)", v.AccountType, mid, v.SignType, err)
  44. }
  45. c.JSON(nil, err)
  46. }