查询用户 是否在线
(appId uint32, userId string)
| 63 | |
| 64 | // 查询用户 是否在线 |
| 65 | func checkUserOnline(appId uint32, userId string) (online bool, err error) { |
| 66 | key := GetUserKey(appId, userId) |
| 67 | userOnline, err := cache.GetUserOnlineInfo(key) |
| 68 | if err != nil { |
| 69 | if err == redis.Nil { |
| 70 | fmt.Println("GetUserOnlineInfo", appId, userId, err) |
| 71 | |
| 72 | return false, nil |
| 73 | } |
| 74 | |
| 75 | fmt.Println("GetUserOnlineInfo", appId, userId, err) |
| 76 | |
| 77 | return |
| 78 | } |
| 79 | |
| 80 | online = userOnline.IsOnline() |
| 81 | |
| 82 | return |
| 83 | } |
| 84 | |
| 85 | // 给用户发送消息 |
| 86 | func SendUserMessage(appId uint32, userId string, msgId, message string) (sendResults bool, err error) { |
no test coverage detected