移除聊天系统废弃消息
This commit is contained in:
parent
e5f8fe912c
commit
bb2daca70b
@ -1,77 +0,0 @@
|
|||||||
package chat
|
|
||||||
|
|
||||||
// import (
|
|
||||||
// "go_dreamfactory/comm"
|
|
||||||
// "go_dreamfactory/pb"
|
|
||||||
|
|
||||||
// "google.golang.org/protobuf/proto"
|
|
||||||
// )
|
|
||||||
|
|
||||||
// //参数校验
|
|
||||||
// func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.ChatGetListReq) (code pb.ErrorCode) {
|
|
||||||
// if req.Channel == pb.ChatChannel_World && req.ChannelId == 0 {
|
|
||||||
// code = pb.ErrorCode_ReqParameterError
|
|
||||||
// }
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ///获取本服聊天消息记录
|
|
||||||
// func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq) (code pb.ErrorCode, data proto.Message) {
|
|
||||||
// var (
|
|
||||||
// err error
|
|
||||||
// // result *pb.DBUserExpand
|
|
||||||
// list []*pb.DBChat
|
|
||||||
// )
|
|
||||||
|
|
||||||
// if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// switch req.Channel {
|
|
||||||
// case pb.ChatChannel_World:
|
|
||||||
// if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// break
|
|
||||||
// case pb.ChatChannel_Union:
|
|
||||||
// if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// break
|
|
||||||
// case pb.ChatChannel_Private:
|
|
||||||
// if list, err = this.module.modelChat.QueryUserMsg(session.GetUserId()); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// break
|
|
||||||
// // case pb.ChatChannel_CrossServer:
|
|
||||||
// // if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
|
|
||||||
// // this.module.Errorf("err:%v", err)
|
|
||||||
// // code = pb.ErrorCode_DBError
|
|
||||||
// // return
|
|
||||||
// // }
|
|
||||||
// // if req.ChannelId != result.Chatchannel {
|
|
||||||
// // code = pb.ErrorCode_ReqParameterError
|
|
||||||
// // return
|
|
||||||
// // }
|
|
||||||
// // if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil {
|
|
||||||
// // code = pb.ErrorCode_DBError
|
|
||||||
// // return
|
|
||||||
// // }
|
|
||||||
// // break
|
|
||||||
// case pb.ChatChannel_System:
|
|
||||||
// if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// break
|
|
||||||
// default:
|
|
||||||
// code = pb.ErrorCode_ReqParameterError
|
|
||||||
// this.module.Errorf("getlist no support channel:%d ", req.Channel)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// session.SendMsg(string(this.module.GetType()), "getlist", &pb.ChatGetListResp{Chats: list})
|
|
||||||
// return
|
|
||||||
// }
|
|
@ -1,116 +0,0 @@
|
|||||||
package chat
|
|
||||||
|
|
||||||
// import (
|
|
||||||
// "fmt"
|
|
||||||
// "go_dreamfactory/comm"
|
|
||||||
// "go_dreamfactory/pb"
|
|
||||||
// "time"
|
|
||||||
|
|
||||||
// "go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
// "google.golang.org/protobuf/proto"
|
|
||||||
// )
|
|
||||||
|
|
||||||
// //参数校验
|
|
||||||
// func (this *apiComp) SendCheck(session comm.IUserSession, req *pb.ChatSendReq) (code pb.ErrorCode) {
|
|
||||||
// if (req.Channel == pb.ChatChannel_Union && req.TargetId == "") || (req.Channel == pb.ChatChannel_Private && req.TargetId == "") {
|
|
||||||
// code = pb.ErrorCode_ReqParameterError
|
|
||||||
// }
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ///消息发送请求
|
|
||||||
// func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code pb.ErrorCode, data proto.Message) {
|
|
||||||
// var (
|
|
||||||
// err error
|
|
||||||
// max int32
|
|
||||||
// msg *pb.DBChat
|
|
||||||
// // userexpand *pb.DBUserExpand
|
|
||||||
// max_chat int32
|
|
||||||
// )
|
|
||||||
// if code = this.SendCheck(session, req); code != pb.ErrorCode_Success {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// msg = &pb.DBChat{
|
|
||||||
// Id: primitive.NewObjectID().Hex(),
|
|
||||||
// Channel: req.Channel,
|
|
||||||
// Suid: session.GetUserId(),
|
|
||||||
// Slv: req.Ulv,
|
|
||||||
// Uname: req.Uname,
|
|
||||||
// Avatar: req.Avatar,
|
|
||||||
// Stag: session.GetServiecTag(),
|
|
||||||
// Ctype: req.Ctype,
|
|
||||||
// Content: req.Content,
|
|
||||||
// Ctime: time.Now().Unix(),
|
|
||||||
// AppendInt: req.AppendInt,
|
|
||||||
// AppendStr: req.AppendStr,
|
|
||||||
// AppendBool: req.AppendBool,
|
|
||||||
// AppendBytes: req.AppendBytes,
|
|
||||||
// }
|
|
||||||
// if max, err = this.module.configure.GetChannelRecordMax(); err != nil {
|
|
||||||
// code = pb.ErrorCode_ConfigNoFound
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// if max_chat, err = this.module.configure.GetChannelRecordMax(); err != nil {
|
|
||||||
// code = pb.ErrorCode_ConfigNoFound
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// switch msg.Channel {
|
|
||||||
// case pb.ChatChannel_World:
|
|
||||||
// if this.module.options.GM { //判断gm命令
|
|
||||||
// if code = this.module.gm.CreateCmd(session, req.Content); code == pb.ErrorCode_Success {
|
|
||||||
// session.SendMsg(string(this.module.GetType()), "send", &pb.ChatSendResp{Issucc: true})
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// code = pb.ErrorCode_Success
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if err = this.module.modelChat.addChatMsg(worldchatkey, int64(max), msg); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// if err = this.module.PushWorld(msg); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// //随机任务
|
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
|
|
||||||
// break
|
|
||||||
// case pb.ChatChannel_Union:
|
|
||||||
// msg.UnionId = req.TargetId
|
|
||||||
// if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s:%s", unionchatkey, req.TargetId), int64(max_chat), msg); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// if err = this.module.PushUnion(req.TargetId, msg); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// break
|
|
||||||
// case pb.ChatChannel_Private:
|
|
||||||
// msg.Ruid = req.TargetId
|
|
||||||
// if err = this.module.PushUser(msg); err != nil {
|
|
||||||
// code = pb.ErrorCode_DBError
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg})
|
|
||||||
// break
|
|
||||||
// // case pb.ChatChannel_CrossServer:
|
|
||||||
// // if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
|
|
||||||
// // code = pb.ErrorCode_DBError
|
|
||||||
// // return
|
|
||||||
// // }
|
|
||||||
// // msg.ChannelId = userexpand.Chatchannel //指定频道
|
|
||||||
// // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil {
|
|
||||||
// // code = pb.ErrorCode_DBError
|
|
||||||
// // return
|
|
||||||
// // }
|
|
||||||
// // this.module.PushToUsers(userexpand.Chatchannel, msg)
|
|
||||||
// default:
|
|
||||||
// code = pb.ErrorCode_ReqParameterError
|
|
||||||
// this.module.Errorf("getlist no support channel:%d ", req.Channel)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// session.SendMsg(string(this.module.GetType()), "send", &pb.ChatSendResp{Issucc: true})
|
|
||||||
// return
|
|
||||||
// }
|
|
Loading…
Reference in New Issue
Block a user