friend.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package friend
  2. import "bet24.com/log"
  3. var mgr *friendmgr
  4. func Run() {
  5. log.Debug("bank running")
  6. mgr = newFriendMgr()
  7. }
  8. func AddUser(userId int) {
  9. mgr.onUserEnter(userId)
  10. }
  11. func RemoveUser(userId int) {
  12. mgr.onUserExit(userId)
  13. }
  14. func GetSearchUserinfo(userId, targetUserID int, targetNickName string) []*SearchInfo {
  15. return mgr.searchInfo(userId, targetUserID, targetNickName)
  16. }
  17. func GetFriendList(userId int) []*FriendItem {
  18. return mgr.getFriendList(userId)
  19. }
  20. func FriendApply(userId, targetUserID int) int {
  21. return mgr.friendApply(userId, targetUserID)
  22. }
  23. func DelFriend(userId, targetUserID int) []*FriendItem {
  24. return mgr.delFriend(userId, targetUserID)
  25. }
  26. func FriendVerifyList(userId int) []*FriendBase {
  27. return mgr.friendVerifyList(userId)
  28. }
  29. func FriendHandleApply(userId, targetUserID, apply int) []*FriendItem {
  30. return mgr.friendHandleApply(userId, targetUserID, apply)
  31. }
  32. func FriendGiveGift(userId, targetUserID int) int {
  33. return mgr.friendGiveGift(userId, targetUserID)
  34. }
  35. func FriendGetGift(userId, targetUserID int, ipAddress string) int {
  36. return mgr.friendGetGift(userId, targetUserID, ipAddress)
  37. }
  38. func SetUserStatus(userId, isOnline int, serverName string) {
  39. mgr.setUserStatus(userId, isOnline, serverName)
  40. }
  41. func IfFriend(userId, targetId int) int {
  42. return mgr.ifFriend(userId, targetId)
  43. }
  44. // 大厅邀请好友
  45. func RoomInvite(userId int, nickName string, toUserId, roomNo int) {
  46. mgr.roomInvite(userId, nickName, toUserId, roomNo)
  47. }
  48. // 获取房间邀请列表
  49. func GetRoomInviteList(userId int) []*RoomInviteInfo {
  50. return mgr.getRoomInviteList(userId)
  51. }
  52. // 房间邀请无效
  53. func RoomInviteInvalid(userId, roomNo int) {
  54. mgr.roomInviteInvalid(userId, roomNo)
  55. }
  56. // 获取好友上限
  57. func GetMaxFriendCount(userId int) FriendCount {
  58. return mgr.getMaxFriendCount(userId)
  59. }
  60. func Dump(param1, param2 string) {
  61. mgr.dumpFriends()
  62. }
  63. func GetPotentialList(userId int) string {
  64. return mgr.getPotentialFriendList(userId)
  65. }
  66. func AddPotentialFriend(userId int, toUserId int, memo string) {
  67. mgr.addPotentialFriend(userId, toUserId, memo)
  68. }
  69. // 黑名单列表
  70. func GetBlackList(userId int) []BlackItem {
  71. return mgr.getBlackList(userId)
  72. }
  73. // 添加黑名单
  74. func AddBlack(userId, toUserId int) (retCode int, message string) {
  75. return mgr.addBlack(userId, toUserId)
  76. }
  77. // 删除黑名单
  78. func DelBlack(userId, toUserId int) (retCode int, message string) {
  79. return mgr.delBlack(userId, toUserId)
  80. }
  81. func IsBlackListUser(userId, toUserId int) bool {
  82. return mgr.isBlackListUser(userId, toUserId)
  83. }
  84. func IsBlackListUserIn(userId int, toUserIds []int) bool {
  85. return mgr.isBlackListUserIn(userId, toUserIds)
  86. }