main.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package userinfo
  2. import (
  3. "bet24.com/log"
  4. pb "bet24.com/servers/micros/userservices/proto"
  5. )
  6. var mgr *usermgr
  7. func Run() {
  8. log.Debug("user running")
  9. mgr = newUserMgr()
  10. }
  11. func GetInfo(userId int) *pb.UserHotInfo {
  12. if userId <= 0 {
  13. return nil
  14. }
  15. if mgr == nil {
  16. u := newUserBaseInfo(userId)
  17. if u == nil {
  18. return nil
  19. }
  20. return &u.UserHotInfo
  21. }
  22. return mgr.getInfo(userId)
  23. }
  24. func GetUserInfoInBulk(userIds []int) []pb.UserHotInfo {
  25. return mgr.getUserInfoInBulk(userIds)
  26. }
  27. // 保存国家地区
  28. func SaveCountry(userId int, countryName, currency string) int {
  29. return mgr.saveCountry(userId, countryName, currency)
  30. }
  31. // 锁定国家地区
  32. func LockCountry(userId int, currency string) int {
  33. return mgr.lockCountry(userId, currency)
  34. }
  35. func UpdateUserInfo(userId int) {
  36. mgr.clear(userId)
  37. }
  38. func Dump(param1, param2 string) {
  39. mgr.dumpUser(param1)
  40. }
  41. func SetUserDecoration(userId int, decorationType int, itemId int) bool {
  42. return mgr.setUserDecoration(userId, decorationType, itemId)
  43. }
  44. func OnDecorationExpired(userId int, itemId int) {
  45. mgr.onDecorationExpired(userId, itemId)
  46. }
  47. func ChangeSwitchStatus(userId int, switchType string, switchStatus int) {
  48. mgr.changeSwitchStatus(userId, switchType, switchStatus)
  49. }
  50. func GetSwitchLevelInfo() []pb.SwitchLevel {
  51. return mgr.getSwitchLevelInfo()
  52. }
  53. func AddUserCharm(userId int, charm int) {
  54. mgr.addUserCharm(userId, charm)
  55. }