MCPcopy Index your code
hub / github.com/RaymondCode/simple-demo / MessageChat

Function MessageChat

controller/message.go:50–62  ·  view source on GitHub ↗

MessageChat all users have same follow list

(c *gin.Context)

Source from the content-addressed store, hash-verified

48
49// MessageChat all users have same follow list
50func 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
64func genChatKey(userIdA int64, userIdB int64) string {
65 if userIdA > userIdB {

Callers

nothing calls this directly

Calls 1

genChatKeyFunction · 0.85

Tested by

no test coverage detected