MessageChat all users have same follow list
(c *gin.Context)
| 48 | |
| 49 | // MessageChat all users have same follow list |
| 50 | func MessageChat(c *gin.Context) { |
| 51 | token := c.Query("token") |
| 52 | toUserId := c.Query("to_user_id") |
| 53 | |
| 54 | if user, exist := usersLoginInfo[token]; exist { |
| 55 | userIdB, _ := strconv.Atoi(toUserId) |
| 56 | chatKey := genChatKey(user.Id, int64(userIdB)) |
| 57 | |
| 58 | c.JSON(http.StatusOK, ChatResponse{Response: Response{StatusCode: 0}, MessageList: tempChat[chatKey]}) |
| 59 | } else { |
| 60 | c.JSON(http.StatusOK, Response{StatusCode: 1, StatusMsg: "User doesn't exist"}) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func genChatKey(userIdA int64, userIdB int64) string { |
| 65 | if userIdA > userIdB { |
nothing calls this directly
no test coverage detected