user_slotscore.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package gatesink
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/coreservice/client"
  5. "fmt"
  6. "strconv"
  7. )
  8. func (this *user) getSlotScore(msg, data string) {
  9. userId := this.getUserId()
  10. if userId == 0 {
  11. return
  12. }
  13. score := client.GetSlotScore(userId)
  14. this.WriteMsg(msg, fmt.Sprintf("%d", score))
  15. }
  16. func (this *user) getSlotScoreExchange(msg, data string) {
  17. log.Debug("getSlotScoreExchange")
  18. userId := this.getUserId()
  19. if userId == 0 {
  20. log.Debug("getSlotScoreExchange userId == 0")
  21. this.WriteMsg(msg, "")
  22. return
  23. }
  24. list := client.GetSlotScoreExchangeList()
  25. log.Debug("getSlotScoreExchange list == %s", list)
  26. this.WriteMsg(msg, list)
  27. }
  28. func (this *user) slotScoreExchange(msg, data string) {
  29. userId := this.getUserId()
  30. if userId == 0 {
  31. return
  32. }
  33. productId, err := strconv.Atoi(data)
  34. if err != nil {
  35. log.Release("user.slotScoreExchange invalid argument [%d] %s", userId, data)
  36. return
  37. }
  38. ret := client.SlotScoreExchange(this.getUserId(), productId)
  39. retMsg := "success"
  40. if !ret {
  41. retMsg = "failed"
  42. log.Debug("user.slotScoreExchange failed [%d]", userId)
  43. }
  44. this.WriteMsg(msg, retMsg)
  45. }
  46. func (this *user) getSlotScoreExchangeHistory(msg, data string) {
  47. userId := this.getUserId()
  48. if userId == 0 {
  49. return
  50. }
  51. list := client.GetSlotScoreExchangeHistory(userId)
  52. this.WriteMsg(msg, list)
  53. }