go_dreamfactory/modules/chat/api_crosschannel.go
2023-06-06 11:08:14 +08:00

41 lines
1.0 KiB
Go

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