(c *gin.Context)
| 70 | } |
| 71 | |
| 72 | func PushRoom(c *gin.Context) { |
| 73 | var formRoom FormRoom |
| 74 | if err := c.ShouldBindBodyWith(&formRoom, binding.JSON); err != nil { |
| 75 | tools.FailWithMsg(c, err.Error()) |
| 76 | return |
| 77 | } |
| 78 | authToken := formRoom.AuthToken |
| 79 | msg := formRoom.Msg |
| 80 | roomId := formRoom.RoomId |
| 81 | checkAuthReq := &proto.CheckAuthRequest{AuthToken: authToken} |
| 82 | authCode, fromUserId, fromUserName := rpc.RpcLogicObj.CheckAuth(checkAuthReq) |
| 83 | if authCode == tools.CodeFail { |
| 84 | tools.FailWithMsg(c, "rpc fail get self info") |
| 85 | return |
| 86 | } |
| 87 | req := &proto.Send{ |
| 88 | Msg: msg, |
| 89 | FromUserId: fromUserId, |
| 90 | FromUserName: fromUserName, |
| 91 | RoomId: roomId, |
| 92 | Op: config.OpRoomSend, |
| 93 | } |
| 94 | code, msg := rpc.RpcLogicObj.PushRoom(req) |
| 95 | if code == tools.CodeFail { |
| 96 | tools.FailWithMsg(c, "rpc push room msg fail!") |
| 97 | return |
| 98 | } |
| 99 | tools.SuccessWithMsg(c, "ok", msg) |
| 100 | return |
| 101 | } |
| 102 | |
| 103 | type FormCount struct { |
| 104 | RoomId int `form:"roomId" json:"roomId" binding:"required"` |
nothing calls this directly
no test coverage detected