package request import ( "errors" ) type CreateTalkRoomRequest struct { BaseRequest RootId string RoomName string } // 参数合法性检验 func (request *CreateTalkRoomRequest) CheckParameter() (err error) { if len(request.RootId) == 0 { return errors.New("RootId 不能为空") } if len(request.RoomName) == 0 { return errors.New("RoomName 不能为空") } if request.AccessToken != "admin_inner_client" { return errors.New("AccessToken 不能为空") } return } type OpenRoomRequest struct { BaseRequest UserId string RoomName string TabId string // 聊天室分类ID RoomAvatar string // 房间头像 } // 参数合法性检验 func (request *OpenRoomRequest) CheckParameter() (err error) { if len(request.UserId) == 0 { err = errors.New("UserId不能为空") return } return } type InnerOpenRoomRequest struct { OpenRoomRequest GuildId string } type CreateRoomGroupRequest struct { BaseRequest Name string Comment string SortNo string RootChatroomId string // 根房间ID ParentChatroomId string // 父房间ID } // 参数合法性检验 func (request *CreateRoomGroupRequest) CheckParameter() (err error) { if len(request.RootChatroomId) == 0 { request.RootChatroomId = request.ParentChatroomId } if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.Name) == 0 { err = errors.New("Name不能为空") return } if len(request.ParentChatroomId) == 0 { err = errors.New("ParentChatroomId不能为空") return } return } type UpdateRoomGroupRequest struct { BaseRequest GroupId string Name string Comment string SortNo string } // 参数合法性检验 func (request *UpdateRoomGroupRequest) CheckParameter() (err error) { if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.Name) == 0 { err = errors.New("Name不能为空") return } return } type CreateChildRoomRequest struct { BaseRequest RoomName string GroupId string // 分组ID RootChatroomId string // 根房间ID ParentChatroomId string // 父房间ID TemplateId string // 模板ID } // 参数合法性检验 func (request *CreateChildRoomRequest) CheckParameter() (err error) { if len(request.RootChatroomId) == 0 { request.RootChatroomId = request.ParentChatroomId } if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.RoomName) == 0 { err = errors.New("RoomName不能为空") return } if len(request.ParentChatroomId) == 0 { err = errors.New("ParentChatroomId不能为空") return } if len(request.TemplateId) > 0 { if request.TemplateId != "5007" && request.TemplateId != "5008" { err = errors.New("模板ID不合法") return } } return }