39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package chat
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) ChanageChannelCheck(session comm.IUserSession, req *pb.ChatChanageChannelReq) (code pb.ErrorCode) {
|
|
if req.ChannelId < 0 {
|
|
code = pb.ErrorCode_ReqParameterError
|
|
}
|
|
return
|
|
}
|
|
|
|
///改变跨服聊天频道
|
|
func (this *apiComp) ChanageChannel(session comm.IUserSession, req *pb.ChatChanageChannelReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
|
var (
|
|
err error
|
|
ok bool
|
|
)
|
|
|
|
if err, ok = this.module.modelChat.chanageChannel(session, req.ChannelId); err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
return
|
|
}
|
|
if ok {
|
|
if err = this.module.modelChat.removeCrossChannelMember(session.GetUserId()); err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
return
|
|
}
|
|
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
|
"chatchannel": req.ChannelId,
|
|
})
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "chanagechannel", &pb.ChatChanageChannelResp{ChannelId: req.ChannelId, IsSucc: ok})
|
|
return
|
|
}
|