go_dreamfactory/modules/chat/api_crosschannel.go

35 lines
911 B
Go

package chat
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) CrossChannelCheck(session comm.IUserSession, req *pb.ChatCrossChannelReq) (code pb.ErrorCode) {
return
}
///请求跨服聊天频道
func (this *apiComp) CrossChannel(session comm.IUserSession, req *pb.ChatCrossChannelReq) (code pb.ErrorCode, data proto.Message) {
var (
channel int32
err error
)
if code = this.CrossChannelCheck(session, req); code != pb.ErrorCode_Success {
return
}
if channel, err = this.module.modelChat.AddCrossChannelMember(session); err != nil {
code = pb.ErrorCode_DBError
return
}
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
"chatchannel": channel,
})
session.SendMsg(string(this.module.GetType()), "crosschannel", &pb.ChatCrossChannelResp{ChannelId: channel})
return
}