diff --git a/bin/json/game_mainlineeasy.json b/bin/json/game_mainlineeasy.json index 2059cc2bd..35e1de83c 100644 --- a/bin/json/game_mainlineeasy.json +++ b/bin/json/game_mainlineeasy.json @@ -50,10 +50,17 @@ "text": "故事发生在很久以前的古代中国,而且要从一只喜欢滚来滚去、滚来滚去的大熊猫身上说起。" }, "stroyid": [ + 3, + 3, + 3, + -1, 3 ], "condition": [ - 0 + 0, + 1, + 2, + 4 ] }, { diff --git a/bin/json/game_msgdistrib.json b/bin/json/game_msgdistrib.json index c9236b4f3..b8f2453ec 100644 --- a/bin/json/game_msgdistrib.json +++ b/bin/json/game_msgdistrib.json @@ -18,5 +18,25 @@ "msgid": "forum.watchhero", "routrules": "~/worker", "describe": "论坛查看目标英雄接口" + }, + { + "msgid": "chat.crosschannel", + "routrules": "~/worker", + "describe": "聊天系统跨服聊天频道请求" + }, + { + "msgid": "chat.chanagechannel", + "routrules": "~/worker", + "describe": "切换聊天频道" + }, + { + "msgid": "chat.getlist", + "routrules": "~/worker", + "describe": "获取聊天记录" + }, + { + "msgid": "chat.send", + "routrules": "~/worker", + "describe": "聊天消息发送" } ] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index 3fb3d00e9..aeaf38096 100644 --- a/comm/const.go +++ b/comm/const.go @@ -100,6 +100,7 @@ const ( //Rpc Rpc_GatewaySendBatchMsg core.Rpc_Key = "Rpc_GatewaySendBatchMsg" //向多个用户发送消息 Rpc_GatewaySendRadioMsg core.Rpc_Key = "Rpc_GatewaySendRadioMsg" //广播消息 Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接 + Rpc_GatewayNoticeUserLogin core.Rpc_Key = "Rpc_NoticeUserLogin" //通知用户登录 Rpc_GatewayNoticeUserClose core.Rpc_Key = "Rpc_NoticeUserClose" //通知用户离线 //GM 后台消息 Rpc_GMReleaseChatSystemMessage core.Rpc_Key = "Rpc_GMChatReleaseSystemMessage" //发布聊天系统消息 diff --git a/lego/base/core.go b/lego/base/core.go index 714cbdd5b..067216238 100644 --- a/lego/base/core.go +++ b/lego/base/core.go @@ -81,5 +81,6 @@ type IRPCXService interface { RpcGo(ctx context.Context, servicePath string, serviceMethod string, args interface{}, reply interface{}) (call *client.Call, err error) AcrossClusterRpcCall(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) AcrossClusterRpcGo(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (call *client.Call, err error) + AcrossClusterBroadcast(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) ClusterBroadcast(ctx context.Context, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) } diff --git a/lego/base/rpcx/service.go b/lego/base/rpcx/service.go index c8896742b..c06cb5b2e 100644 --- a/lego/base/rpcx/service.go +++ b/lego/base/rpcx/service.go @@ -179,6 +179,17 @@ func (this *RPCXService) AcrossClusterRpcGo(ctx context.Context, clusterTag stri return rpcx.AcrossClusterGo(ctx, clusterTag, servicePath, serviceMethod, args, reply, nil) } +//目标集群广播消息 +//clusterTag 集群标签 +///servicePath = worker 表示采用负载的方式调用 worker类型服务执行rpc方法 +///servicePath = worker/worker_1 表示寻找目标服务节点调用rpc方法 +///servicePath = worker/!worker_1 表示选择非worker_1的节点随机选择节点执行rpc方法 +///servicePath = worker/[worker_1,worker_2] 表示随机选择[]里面的服务节点执行rpc方法 +///servicePath = worker/![worker_1,worker_2] 表示随机选择非[]里面的服务节点执行rpc方法 +func (this *RPCXService) AcrossClusterBroadcast(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) { + return rpcx.AcrossClusterBroadcast(ctx, clusterTag, servicePath, serviceMethod, args, reply) +} + ///全集群广播 执行目标远程服务方法 ///servicePath = worker 表示采用负载的方式调用 worker类型服务执行rpc方法 func (this *RPCXService) ClusterBroadcast(ctx context.Context, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) { diff --git a/lego/sys/gin/sys_test.go b/lego/sys/gin/sys_test.go index b4e4723ef..1746868c5 100644 --- a/lego/sys/gin/sys_test.go +++ b/lego/sys/gin/sys_test.go @@ -14,7 +14,7 @@ import ( ) func Test_sys(t *testing.T) { - if err := log.OnInit(nil, log.SetFileName("test"), log.SetReportCaller(true)); err != nil { + if err := log.OnInit(nil, log.SetFileName("test")); err != nil { fmt.Printf("log init err:%v", err) return } diff --git a/lego/sys/log/flieout.go b/lego/sys/log/flieout.go index a7be8dc66..db40c42d9 100644 --- a/lego/sys/log/flieout.go +++ b/lego/sys/log/flieout.go @@ -96,7 +96,7 @@ func (l *LogFileOut) openExistingOrNew(writeLen int) error { return l.rotate() } - file, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0644) + file, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666) if err != nil { // if we fail to open the old log file for some reason, just ignore // it and open a new log file. @@ -217,7 +217,7 @@ func (l *LogFileOut) openNew() error { } name := l.filename() - mode := os.FileMode(0600) + mode := os.FileMode(0666) info, err := osStat(name) //备份老的日志文件 if err == nil { diff --git a/lego/sys/log/logger.go b/lego/sys/log/logger.go index 207f8491f..b25c1e64c 100644 --- a/lego/sys/log/logger.go +++ b/lego/sys/log/logger.go @@ -45,7 +45,7 @@ type Logger struct { formatter Formatter //日志格式化 name string //日志标签 out IWrite //日志输出 - addCaller bool //是否打印堆栈信息 + addCaller LevelEnabler //是否打印堆栈信息 addStack LevelEnabler //堆栈信息输出级别 callerSkip int //堆栈输出深度 } @@ -167,7 +167,8 @@ func (this *Logger) check(level Loglevel, msg string, args ...Field) (entry *Ent entry.Message = msg entry.WithFields(args...) addStack := this.addStack.Enabled(level) - if !this.addCaller && !addStack { + addCaller := this.addCaller.Enabled(level) + if !addCaller && !addStack { return } stackDepth := stacktraceFirst @@ -177,7 +178,7 @@ func (this *Logger) check(level Loglevel, msg string, args ...Field) (entry *Ent stack := captureStacktrace(this.callerSkip+callerSkipOffset, stackDepth) defer stack.Free() if stack.Count() == 0 { - if this.addCaller { + if addCaller { if entry.Err != "" { entry.Err = entry.Err + ",error: failed to get caller" } else { @@ -187,7 +188,7 @@ func (this *Logger) check(level Loglevel, msg string, args ...Field) (entry *Ent return } frame, more := stack.Next() - if this.addCaller { + if addCaller { entry.Caller.Defined = frame.PC != 0 entry.Caller.PC = frame.PC entry.Caller.File = frame.File diff --git a/lego/sys/log/options.go b/lego/sys/log/options.go index 1795cee19..a0c5e8815 100644 --- a/lego/sys/log/options.go +++ b/lego/sys/log/options.go @@ -18,7 +18,7 @@ type Options struct { FileName string //日志文件名包含 Loglevel Loglevel //日志输出级别 IsDebug bool //是否是开发模式 - ReportCaller bool //是否输出堆栈信息 + ReportCaller Loglevel //是否输出堆栈信息 CallerSkip int //堆栈深度 Encoder LogEncoder //日志输出样式 CupTimeTime int //日志分割时间 单位 小时 @@ -48,7 +48,7 @@ func SetLoglevel(v Loglevel) Option { } } -func SetReportCaller(v bool) Option { +func SetReportCaller(v Loglevel) Option { return func(o *Options) { o.ReportCaller = v } @@ -103,7 +103,7 @@ func newOptions(config map[string]interface{}, opts ...Option) (options *Options Compress: false, Encoder: TextEncoder, CallerSkip: 0, - ReportCaller: false, + ReportCaller: ErrorLevel, IsDebug: true, } if config != nil { @@ -129,7 +129,7 @@ func newOptionsByOption(opts ...Option) (options *Options, err error) { Compress: false, Encoder: TextEncoder, CallerSkip: 0, - ReportCaller: false, + ReportCaller: ErrorLevel, IsDebug: true, } for _, o := range opts { diff --git a/lego/sys/rpcx/client.go b/lego/sys/rpcx/client.go index 6fad78324..d7456e734 100644 --- a/lego/sys/rpcx/client.go +++ b/lego/sys/rpcx/client.go @@ -22,29 +22,33 @@ func newClient(options *Options) (sys *Client, err error) { sys = &Client{ options: options, metadata: fmt.Sprintf("stag=%s&stype=%s&sid=%s&version=%s&addr=%s", options.ServiceTag, options.ServiceType, options.ServiceId, options.ServiceVersion, "tcp@"+options.ServiceAddr), - clusterClients: make(map[string]map[string]client.XClient), + clusterClients: make(map[string]*clusterClients), conns: make(map[string]net.Conn), - connecting: make(map[string]struct{}), serviceMap: make(map[string]*service), msgChan: make(chan *protocol.Message, 1000), } return } +type clusterClients struct { + Mu sync.RWMutex + clients map[string]client.XClient //其他集群客户端 +} + type Client struct { options *Options metadata string writeTimeout time.Duration AsyncWrite bool clusterMu sync.RWMutex - clusterClients map[string]map[string]client.XClient //其他集群客户端 + clusterClients map[string]*clusterClients //其他集群客户端 connsMapMu sync.RWMutex conns map[string]net.Conn - connectMapMu sync.RWMutex - connecting map[string]struct{} - serviceMapMu sync.RWMutex - serviceMap map[string]*service - msgChan chan *protocol.Message // 接收rpcXServer推送消息 + // connectMapMu sync.RWMutex + // connecting map[string]struct{} + serviceMapMu sync.RWMutex + serviceMap map[string]*service + msgChan chan *protocol.Message // 接收rpcXServer推送消息 } // DoMessage 服务端消息处理 @@ -78,11 +82,15 @@ func (this *Client) Start() (err error) { //停止RPC 服务 func (this *Client) Stop() (err error) { + this.clusterMu.Lock() for _, v := range this.clusterClients { - for _, v1 := range v { + v.Mu.Lock() + for _, v1 := range v.clients { v1.Close() } + v.Mu.Unlock() } + this.clusterMu.RUnlock() close(this.msgChan) //关闭消息处理 return } @@ -210,12 +218,15 @@ func (this *Client) ClusterBroadcast(ctx context.Context, servicePath string, se ServiceMetaKey: this.metadata, }) clients = make([]client.XClient, 0) + this.clusterMu.RLock() for _, v := range this.clusterClients { - if _client, ok := v[spath[0]]; ok { + v.Mu.RLock() + if _client, ok := v.clients[spath[0]]; ok { clients = append(clients, _client) } + v.Mu.RUnlock() } - + this.clusterMu.RUnlock() l := len(clients) done := make(chan error, l) for _, v := range clients { @@ -244,32 +255,55 @@ check: //监控服务发现,发现没有连接上的额服务端 就连接上去 func (this *Client) UpdateServer(servers map[string]*ServiceNode) { for _, v := range servers { - this.connsMapMu.RLock() - _, ok := this.conns[v.ServiceAddr] - this.connsMapMu.RUnlock() - if !ok { - this.connectMapMu.RLock() - _, ok := this.connecting[v.ServiceAddr] - this.connectMapMu.RUnlock() - if !ok { - this.connectMapMu.Lock() - this.connecting[v.ServiceAddr] = struct{}{} - this.connectMapMu.Unlock() - if err := this.Call(context.Background(), fmt.Sprintf("%s/%s", v.ServiceType, v.ServiceId), RpcX_ShakeHands, &ServiceNode{ - ServiceTag: this.options.ServiceTag, - ServiceId: this.options.ServiceId, - ServiceType: this.options.ServiceType, - ServiceAddr: this.options.ServiceAddr}, - &ServiceNode{}); err != nil { - this.options.Log.Errorf("ShakeHands new node addr:%s err:%v", v.ServiceAddr, err) - this.connectMapMu.Lock() - delete(this.connecting, v.ServiceAddr) - this.connectMapMu.Unlock() - } else { - this.options.Log.Debugf("UpdateServer addr:%s ", v.ServiceAddr) - } + this.clusterMu.RLock() + cluster, ok := this.clusterClients[v.ServiceTag] + this.clusterMu.RUnlock() + if ok { + cluster.Mu.RLock() + _, ok = cluster.clients[v.ServiceType] + cluster.Mu.RUnlock() + if ok { + continue } } + //没有建立客户端 主动发起握手 + if err := this.Call(context.Background(), fmt.Sprintf("%s/%s", v.ServiceType, v.ServiceId), RpcX_ShakeHands, &ServiceNode{ + ServiceTag: this.options.ServiceTag, + ServiceId: this.options.ServiceId, + ServiceType: this.options.ServiceType, + ServiceAddr: this.options.ServiceAddr}, + &ServiceNode{}); err != nil { + this.options.Log.Errorf("ShakeHands new node addr:%s err:%v", v.ServiceAddr, err) + } else { + this.options.Log.Debugf("UpdateServer addr:%s ", v.ServiceAddr) + } + + // this.connsMapMu.RLock() + // _, ok := this.conns[v.ServiceAddr] + // this.connsMapMu.RUnlock() + // if !ok { + // this.connectMapMu.RLock() + // _, ok := this.connecting[v.ServiceAddr] + // this.connectMapMu.RUnlock() + // if !ok { + // this.connectMapMu.Lock() + // this.connecting[v.ServiceAddr] = struct{}{} + // this.connectMapMu.Unlock() + // if err := this.Call(context.Background(), fmt.Sprintf("%s/%s", v.ServiceType, v.ServiceId), RpcX_ShakeHands, &ServiceNode{ + // ServiceTag: this.options.ServiceTag, + // ServiceId: this.options.ServiceId, + // ServiceType: this.options.ServiceType, + // ServiceAddr: this.options.ServiceAddr}, + // &ServiceNode{}); err != nil { + // this.options.Log.Errorf("ShakeHands new node addr:%s err:%v", v.ServiceAddr, err) + // this.connectMapMu.Lock() + // delete(this.connecting, v.ServiceAddr) + // this.connectMapMu.Unlock() + // } else { + // this.options.Log.Debugf("UpdateServer addr:%s ", v.ServiceAddr) + // } + // } + // } } } @@ -301,29 +335,39 @@ func (this *Client) getclient(ctx *context.Context, clusterTag string, servicePa } var ( spath []string - clients map[string]client.XClient + cluster *clusterClients d *client.ConsulDiscovery ok bool ) spath = strings.Split(servicePath, "/") - if clients, ok = this.clusterClients[clusterTag]; !ok { - this.clusterClients[clusterTag] = make(map[string]client.XClient) - clients = this.clusterClients[clusterTag] + this.clusterMu.RLock() + cluster, ok = this.clusterClients[clusterTag] + this.clusterMu.RUnlock() + if !ok { + cluster = &clusterClients{clients: make(map[string]client.XClient)} + this.clusterMu.Lock() + this.clusterClients[clusterTag] = cluster + this.clusterMu.Unlock() } - - if c, ok = clients[spath[0]]; !ok { + cluster.Mu.RLock() + c, ok = cluster.clients[spath[0]] + cluster.Mu.RUnlock() + if !ok { if d, err = client.NewConsulDiscovery(clusterTag, spath[0], this.options.ConsulServers, nil); err != nil { return } c = client.NewBidirectionalXClient(spath[0], client.Failfast, client.RandomSelect, d, client.DefaultOption, this.msgChan) + cluster.Mu.Lock() + cluster.clients[spath[0]] = c + cluster.Mu.Unlock() c.GetPlugins().Add(this) if this.options.RpcxStartType == RpcxStartByClient && this.options.AutoConnect { - c.SetSelector(newSelector(this.UpdateServer)) + c.SetSelector(newSelector(this.options.Log, clusterTag, this.UpdateServer)) } else { - c.SetSelector(newSelector(nil)) + c.SetSelector(newSelector(this.options.Log, clusterTag, nil)) } - clients[spath[0]] = c } + *ctx = context.WithValue(*ctx, share.ReqMetaDataKey, map[string]string{ ServiceClusterTag: this.options.ServiceTag, CallRoutRulesKey: servicePath, diff --git a/lego/sys/rpcx/core.go b/lego/sys/rpcx/core.go index 6fad3f0c7..6a1b3daea 100644 --- a/lego/sys/rpcx/core.go +++ b/lego/sys/rpcx/core.go @@ -98,7 +98,9 @@ func AcrossClusterCall(ctx context.Context, clusterTag string, servicePath strin func AcrossClusterGo(ctx context.Context, clusterTag, servicePath string, serviceMethod string, args interface{}, reply interface{}, done chan *client.Call) (_call *client.Call, err error) { return defsys.AcrossClusterGo(ctx, clusterTag, servicePath, serviceMethod, args, reply, done) } - +func AcrossClusterBroadcast(ctx context.Context, clusterTag string, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) { + return defsys.AcrossClusterBroadcast(ctx, clusterTag, servicePath, serviceMethod, args, reply) +} func ClusterBroadcast(ctx context.Context, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error) { return defsys.ClusterBroadcast(ctx, servicePath, serviceMethod, args, reply) } diff --git a/lego/sys/rpcx/options.go b/lego/sys/rpcx/options.go index 0710814b4..cb231ab8d 100644 --- a/lego/sys/rpcx/options.go +++ b/lego/sys/rpcx/options.go @@ -100,7 +100,7 @@ func newOptions(config map[string]interface{}, opts ...Option) (options *Options return options, errors.New("[Sys.RPCX] newOptions err: 启动参数异常") } - if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.rpc", 2)); options.Log == nil { + if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.rpc", 3)); options.Log == nil { err = errors.New("log is nil") } @@ -118,7 +118,7 @@ func newOptionsByOption(opts ...Option) (options *Options, err error) { if len(options.ServiceTag) == 0 || len(options.ServiceType) == 0 || len(options.ServiceId) == 0 || len(options.ConsulServers) == 0 { return options, errors.New("[Sys.RPCX] newOptions err: 启动参数异常") } - if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.rpc", 2)); options.Log == nil { + if options.Log = log.NewTurnlog(options.Debug, log.Clone("sys.rpc", 3)); options.Log == nil { err = errors.New("log is nil") } return options, nil diff --git a/lego/sys/rpcx/selector.go b/lego/sys/rpcx/selector.go index 46f4eaf22..d0858cd82 100644 --- a/lego/sys/rpcx/selector.go +++ b/lego/sys/rpcx/selector.go @@ -14,8 +14,10 @@ var rex_nogather = regexp.MustCompile(`\!\[([^)]+)\]`) var rex_noid = regexp.MustCompile(`\!([^)]+)`) var rex_gather = regexp.MustCompile(`\[([^)]+)\]`) -func newSelector(fn func(map[string]*ServiceNode)) *Selector { +func newSelector(log log.ILogger, stag string, fn func(map[string]*ServiceNode)) *Selector { return &Selector{ + log: log, + stag: stag, updateServerEvent: fn, servers: make(map[string]*ServiceNode), serversType: make(map[string][]*ServiceNode), @@ -32,6 +34,8 @@ type ServiceNode struct { } type Selector struct { + log log.ILogger + stag string updateServerEvent func(map[string]*ServiceNode) servers map[string]*ServiceNode serversType map[string][]*ServiceNode @@ -56,7 +60,7 @@ func (this *Selector) Select(ctx context.Context, servicePath, serviceMethod str } else if leng == 2 { result := this.ParseRoutRules(service[1]) if len(result) == 0 { - log.Errorf("Select no found any node servicePath:%v serviceMethod:%v RoutRules:%v \n", servicePath, serviceMethod, routrules) + this.log.Error("Select no found any node", log.Field{"stag", this.stag}, log.Field{"servicePath", servicePath}, log.Field{"serviceMethod", serviceMethod}, log.Field{"routrules", routrules}) return "" } i := fastrand.Uint32n(uint32(len(result))) @@ -64,7 +68,7 @@ func (this *Selector) Select(ctx context.Context, servicePath, serviceMethod str return node.ServiceAddr } } - log.Errorf("Select no found any node servicePath:%v serviceMethod:%v RoutRules:%v \n", servicePath, serviceMethod, routrules) + this.log.Error("Select no found any node", log.Field{"stag", this.stag}, log.Field{"servicePath", servicePath}, log.Field{"serviceMethod", serviceMethod}, log.Field{"routrules", routrules}) return "" } @@ -86,7 +90,7 @@ func (this *Selector) UpdateServer(servers map[string]string) { sst := make(map[string][]*ServiceNode) for _, v := range servers { if node, err := smetaToServiceNode(v); err != nil { - log.Errorf("smetaToServiceNode:%s err:%v", v, err) + this.log.Errorf("smetaToServiceNode:%s err:%v", v, err) continue } else { ss[node.ServiceId] = node diff --git a/lego/sys/rpcx/service.go b/lego/sys/rpcx/service.go index 67fc6cedc..718279190 100644 --- a/lego/sys/rpcx/service.go +++ b/lego/sys/rpcx/service.go @@ -223,7 +223,7 @@ func (this *Service) PostReadRequest(ctx context.Context, r *protocol.Message, e selector, ok = this.selectors[stag] this.selectormutex.RUnlock() if !ok { - selector = newSelector(nil) + selector = newSelector(this.options.Log, stag, nil) this.selectormutex.Lock() this.selectors[stag] = selector this.selectormutex.Unlock() diff --git a/modules/chat/api_getlist.go b/modules/chat/api_getlist.go index 7d2dd38b7..eda689c9d 100644 --- a/modules/chat/api_getlist.go +++ b/modules/chat/api_getlist.go @@ -9,25 +9,28 @@ import ( //参数校验 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 - list []*pb.DBChat + err error + result *pb.DBUserExpand + list []*pb.DBChat ) switch req.Channel { case pb.ChatChannel_World: - if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0, 0); err != nil { + if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0); err != nil { code = pb.ErrorCode_DBError return } break case pb.ChatChannel_Union: - if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0, 0); err != nil { + if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0); err != nil { code = pb.ErrorCode_DBError return } @@ -38,6 +41,26 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq) return } break + case pb.ChatChannel_CrossServer: + if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { + this.module.Errorf("err:%v", err) + return + } + if req.ChannelId != result.Chatchannel { + code = pb.ErrorCode_ReqParameterError + return + } + if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, req.ChannelId); err != nil { + code = pb.ErrorCode_DBError + return + } + break + case pb.ChatChannel_System: + if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0); err != nil { + code = pb.ErrorCode_DBError + return + } + break } session.SendMsg(string(this.module.GetType()), "getlist", &pb.ChatGetListResp{Chats: list}) return diff --git a/modules/chat/api_send.go b/modules/chat/api_send.go index 9b6f05f36..bcc1337c2 100644 --- a/modules/chat/api_send.go +++ b/modules/chat/api_send.go @@ -21,26 +21,22 @@ func (this *apiComp) SendCheck(session comm.IUserSession, req *pb.ChatSendReq) ( ///消息发送请求 func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code pb.ErrorCode, data proto.Message) { var ( - err error - max int32 - msg *pb.DBChat - user *pb.DBUser - max_chat int32 + err error + max int32 + msg *pb.DBChat + userexpand *pb.DBUserExpand + max_chat int32 ) if code = this.SendCheck(session, req); code != pb.ErrorCode_Success { return } - if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil { - this.module.Errorf("GetUser is nill") - code = pb.ErrorCode_DBError - return - } msg = &pb.DBChat{ Id: primitive.NewObjectID().Hex(), Channel: req.Channel, Suid: session.GetUserId(), - Avatar: user.Avatar, + Stag: session.GetServiecTag(), + Avatar: req.Avatar, Content: req.Content, Ctime: time.Now().Unix(), } @@ -54,7 +50,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code } switch msg.Channel { case pb.ChatChannel_World: - if err = this.module.modelChat.addChatMsg(worldchatkey, int64(max), msg); err != nil { + if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%s", worldchatkey, session.GetServiecTag()), int64(max), msg); err != nil { code = pb.ErrorCode_DBError return } @@ -81,6 +77,18 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code return } 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) + break } session.SendMsg(string(this.module.GetType()), "send", &pb.ChatSendResp{}) return diff --git a/modules/chat/api_spangetlist.go b/modules/chat/api_spangetlist.go deleted file mode 100644 index b01a9850a..000000000 --- a/modules/chat/api_spangetlist.go +++ /dev/null @@ -1,52 +0,0 @@ -package chat - -import ( - "go_dreamfactory/comm" - "go_dreamfactory/pb" - - "google.golang.org/protobuf/proto" -) - -//参数校验 -func (this *apiComp) SpanGetListCheck(session comm.IUserSession, req *pb.ChatSpanGetListReq) (code pb.ErrorCode) { - - return -} - -///获取跨服聊天消息记录 -func (this *apiComp) SpanGetList(session comm.IUserSession, req *pb.ChatSpanGetListReq) (code pb.ErrorCode, data proto.Message) { - var ( - err error - result *pb.DBUserExpand - list []*pb.DBChat - group int32 - ) - if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { - this.module.Errorf("err:%v", err) - return - } - if req.ChannelId != result.Chatchannel { - code = pb.ErrorCode_ReqParameterError - return - } - if group, err = this.module.configure.GetServiecTagGroup(session.GetServiecTag()); err != nil { - code = pb.ErrorCode_ConfigNoFound - return - } - switch req.Channel { - case pb.ChatChannel_CrossServer: - if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, group, req.ChannelId); err != nil { - code = pb.ErrorCode_DBError - return - } - break - case pb.ChatChannel_System: - if list, err = this.module.modelChat.GetChatQueue(req.Channel, 0, 0, 0); err != nil { - code = pb.ErrorCode_DBError - return - } - break - } - session.SendMsg(string(this.module.GetType()), "spangetlist", &pb.ChatSpanGetListResp{Chats: list}) - return -} diff --git a/modules/chat/api_spansend.go b/modules/chat/api_spansend.go deleted file mode 100644 index dec9ae684..000000000 --- a/modules/chat/api_spansend.go +++ /dev/null @@ -1,60 +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) SpanSendCheck(session comm.IUserSession, req *pb.ChatSpanSendReq) (code pb.ErrorCode) { - - return -} - -///跨越服务消息请求 -func (this *apiComp) SpanSend(session comm.IUserSession, req *pb.ChatSpanSendReq) (code pb.ErrorCode, data proto.Message) { - var ( - err error - msg *pb.DBChat - user *pb.DBUser - userexpand *pb.DBUserExpand - group int32 - max_chat int32 - ) - if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { - code = pb.ErrorCode_DBError - return - } - msg = &pb.DBChat{ - Id: primitive.NewObjectID().Hex(), - Channel: req.Channel, - Suid: session.GetUserId(), - AreaId: userexpand.Chatchannel, - Avatar: user.Avatar, - Content: req.Content, - Ctime: time.Now().Unix(), - } - if group, err = this.module.configure.GetServiecTagGroup(session.GetServiecTag()); err != nil { - code = pb.ErrorCode_ConfigNoFound - return - } - if max_chat, err = this.module.configure.GetChannelRecordMax(); err != nil { - return - } - switch msg.Channel { - case pb.ChatChannel_CrossServer: - if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s:%d--%d", crosschatkey, group, userexpand.Chatchannel), int64(max_chat), msg); err != nil { - code = pb.ErrorCode_DBError - return - } - this.module.PushToUsers(group, userexpand.Chatchannel, msg) - break - } - session.SendMsg(string(this.module.GetType()), "spansend", &pb.ChatSendResp{}) - return -} diff --git a/modules/chat/configure.go b/modules/chat/configure.go index 95d69755a..3fb8e4cec 100644 --- a/modules/chat/configure.go +++ b/modules/chat/configure.go @@ -27,29 +27,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp this.module = module.(*Chat) this.LoadConfigure(game_chatchannel, cfg.NewGame_chatChannel) this.LoadConfigure(game_chatsystem, cfg.NewGame_chatSystem) - this.LoadConfigure(game_chatservergroup, cfg.NewGame_chatServerGroup) - this.LoadConfigure(game_chatchannelcom, cfg.NewGame_chatChannelCom) - return -} -//获取服务区 分组 -func (this *configureComp) GetServiecTagGroup(stag string) (group int32, err error) { - var ( - v interface{} - configure *cfg.Game_chatServerGroupData - ok bool - ) - if v, err = this.GetConfigure(game_chatservergroup); err != nil { - this.module.Errorf("err:%v", err) - return - } else { - if configure, ok = v.(*cfg.Game_chatServerGroup).GetDataMap()[stag]; !ok { - err = fmt.Errorf("cfg.Game_chatServerGroupData on found %v", stag) - this.module.Errorf("err:%v", err) - return - } - group = configure.Group - } + this.LoadConfigure(game_chatchannelcom, cfg.NewGame_chatChannelCom) return } diff --git a/modules/chat/modelChat.go b/modules/chat/modelChat.go index 0a945e51c..64f91095b 100644 --- a/modules/chat/modelChat.go +++ b/modules/chat/modelChat.go @@ -63,7 +63,7 @@ func (this *modelChatComp) QueryUserMsg(uid string) (result []*pb.DBChat, err er } //查询用户未读消息 -func (this *modelChatComp) GetChatQueue(channel pb.ChatChannel, union, group, area int32) (result []*pb.DBChat, err error) { +func (this *modelChatComp) GetChatQueue(channel pb.ChatChannel, union, area int32) (result []*pb.DBChat, err error) { var ( key string find bson.M @@ -82,8 +82,8 @@ func (this *modelChatComp) GetChatQueue(channel pb.ChatChannel, union, group, ar find = bson.M{"channel": channel, "unionId": union} break case pb.ChatChannel_CrossServer: - key = fmt.Sprintf("%s:%d--%d", crosschatkey, group, area) - find = bson.M{"channel": channel, "group": group, "areaId": area} + key = fmt.Sprintf("%s:%d", crosschatkey, area) + find = bson.M{"channel": channel, "areaId": area} break case pb.ChatChannel_System: key = systemchatkey @@ -131,18 +131,14 @@ func (this *modelChatComp) AddCrossChannelMember(session comm.IUserSession) (cha } var ( count int - group int32 maxnum int32 ) channel = 1 - if group, err = this.module.configure.GetServiecTagGroup(session.GetServiecTag()); err != nil { - return - } if maxnum, err = this.module.configure.GetAutoIntoChannelMax(); err != nil { return } for { - key := fmt.Sprintf("%s:%d--%d-member", crosschatkey, group, channel) + key := fmt.Sprintf("%s:%d-member", crosschatkey, channel) if count, err = this.Redis.Hlen(key); err != nil { this.module.Errorf("err:%v", err) return @@ -169,13 +165,9 @@ func (this *modelChatComp) ChanageChannel(session comm.IUserSession, channel int Ip: session.GetIP(), } var ( - group int32 maxnum int32 ) - if group, err = this.module.configure.GetServiecTagGroup(session.GetServiecTag()); err != nil { - return - } - key := fmt.Sprintf("%s:%d--%d-member", crosschatkey, group, channel) + key := fmt.Sprintf("%s:%d-member", crosschatkey, channel) count := 0 if maxnum, err = this.module.configure.GetChanageChannelMax(); err != nil { return @@ -195,8 +187,8 @@ func (this *modelChatComp) ChanageChannel(session comm.IUserSession, channel int } //读取跨服聊天频道下成员 -func (this *modelChatComp) GetCrossChannelMember(group, channel int32) (result []*pb.CacheUser, err error) { - key := fmt.Sprintf("%s:%d--%d-member", crosschatkey, group, channel) +func (this *modelChatComp) GetCrossChannelMember(channel int32) (result []*pb.CacheUser, err error) { + key := fmt.Sprintf("%s:%d-member", crosschatkey, channel) result = make([]*pb.CacheUser, 0) if err = this.Redis.HGetAll(key, &result); err != nil { this.module.Errorf("err:%v", err) @@ -214,11 +206,8 @@ func (this *modelChatComp) RemoveCrossChannelMember(session comm.IUserSession) ( this.module.Errorf("err:%v", err) return } - var group int32 - if group, err = this.module.configure.GetServiecTagGroup(session.GetServiecTag()); err != nil { - return - } - key := fmt.Sprintf("%s:%d--%d-member", crosschatkey, group, result.Chatchannel) + + key := fmt.Sprintf("%s:%d-member", crosschatkey, result.Chatchannel) if err = this.Redis.HDel(key, session.GetUserId()); err != nil { this.module.Errorf("err:%v", err) return diff --git a/modules/chat/module.go b/modules/chat/module.go index 4537734eb..5effcbf8b 100644 --- a/modules/chat/module.go +++ b/modules/chat/module.go @@ -65,16 +65,12 @@ func (this *Chat) EventUserOffline(session comm.IUserSession) { //Push-------------------------------------------------------------------------------------------------------------- //推送消息到世界 func (this *Chat) PushWorld(msg *pb.DBChat) (err error) { - var ( - reply *pb.RPCMessageReply - ) - reply = &pb.RPCMessageReply{} data, _ := anypb.New(&pb.ChatMessagePush{Chat: msg}) - if err = this.service.RpcBroadcast(context.Background(), comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{ + if err = this.service.AcrossClusterBroadcast(context.Background(), msg.Stag, comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{ MainType: string(this.GetType()), SubType: "message", Data: data, - }, reply); err != nil { + }, nil); err != nil { this.Errorf("err:%v", err) } return @@ -99,33 +95,29 @@ func (this *Chat) PushUser(msg *pb.DBChat) (err error) { return } -//全集群推送 -func (this *Chat) PushToUsers(group, channel int32, msg *pb.DBChat) { +//推送消息到指定用户群 +func (this *Chat) PushToUsers(channel int32, msg *pb.DBChat) (err error) { var ( - err error users []*pb.CacheUser ) - if users, err = this.modelChat.GetCrossChannelMember(group, channel); err == nil { + if users, err = this.modelChat.GetCrossChannelMember(channel); err == nil { if err = this.SendMsgToUsers(string(this.GetType()), "message", &pb.ChatMessagePush{Chat: msg}, users...); err != nil { this.Errorf("err:%v", err) return } } + return } //全集群推送 -func (this *Chat) PushAllWorld(msg *pb.DBChat) { - var ( - err error - reply *pb.RPCMessageReply - ) - reply = &pb.RPCMessageReply{} +func (this *Chat) PushAllWorld(msg *pb.DBChat) (err error) { data, _ := anypb.New(&pb.ChatMessagePush{Chat: msg}) if err = this.service.ClusterBroadcast(context.Background(), comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{ MainType: string(this.GetType()), SubType: "message", Data: data, - }, reply); err != nil { + }, nil); err != nil { this.Errorf("err:%v", err) } + return } diff --git a/modules/gateway/agentmgr_comp.go b/modules/gateway/agentmgr_comp.go index 24e2e7fb8..5a071e353 100644 --- a/modules/gateway/agentmgr_comp.go +++ b/modules/gateway/agentmgr_comp.go @@ -43,14 +43,13 @@ func (this *AgentMgrComp) Connect(a IAgent) { func (this *AgentMgrComp) DisConnect(a IAgent) { this.agents.Delete(a.SessionId()) if a.UserId() != "" { //登录用户 通知业务服务处理玩家离线相关 - reply := &pb.RPCMessageReply{} if _, err := this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Worker, a.WorkerId()), string(comm.Rpc_GatewayNoticeUserClose), &pb.NoticeUserCloseReq{ Ip: a.IP(), ServiceTag: this.service.GetTag(), GatewayServiceId: this.service.GetId(), UserSessionId: a.SessionId(), UserId: a.UserId(), - }, reply); err != nil { + }, nil); err != nil { log.Errorf("uId:%s Rpc_NoticeUserClose err:%v", a.UserId(), err) } @@ -61,7 +60,7 @@ func (this *AgentMgrComp) DisConnect(a IAgent) { GatewayServiceId: this.service.GetId(), UserSessionId: a.SessionId(), UserId: a.UserId(), - }, reply); err != nil { + }, nil); err != nil { log.Errorf("uId:%s Rpc_NoticeUserClose err:%v", a.UserId(), err) } if this.options.SpanServiceTag != "" { @@ -72,7 +71,7 @@ func (this *AgentMgrComp) DisConnect(a IAgent) { GatewayServiceId: this.service.GetId(), UserSessionId: a.SessionId(), UserId: a.UserId(), - }, reply); err != nil { + }, nil); err != nil { log.Errorf("uId:%s Rpc_NoticeUserClose err:%v", a.UserId(), err) } } @@ -82,7 +81,20 @@ func (this *AgentMgrComp) DisConnect(a IAgent) { // Bind 用户绑定Id func (this *AgentMgrComp) Bind(ctx context.Context, args *pb.AgentBuildReq, reply *pb.RPCMessageReply) error { if a, ok := this.agents.Load(args.UserSessionId); ok { - a.(IAgent).Bind(args.UserId, args.WorkerId) + agent := a.(IAgent) + agent.Bind(args.UserId, args.WorkerId) + if this.options.SpanServiceTag != "" { //跨服集群配置存在 推送通知过去 + //推送跨服集群处理 + if _, err := this.service.AcrossClusterRpcGo(context.Background(), this.options.SpanServiceTag, comm.Service_Worker, string(comm.Rpc_GatewayNoticeUserLogin), &pb.NoticeUserLoginReq{ + Ip: agent.IP(), + ServiceTag: this.service.GetTag(), + GatewayServiceId: this.service.GetId(), + UserSessionId: agent.SessionId(), + UserId: agent.UserId(), + }, nil); err != nil { + log.Errorf("uId:%s Rpc_NoticeUserLogin err:%v", agent.UserId(), err) + } + } } else { reply.Code = pb.ErrorCode_UserSessionNobeing reply.ErrorMessage = pb.GetErrorCodeMsg(pb.ErrorCode_UserSessionNobeing) diff --git a/modules/user/api_login.go b/modules/user/api_login.go index e36771d73..f1259647c 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -86,9 +86,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod "serviceTag": session.GetServiecTag(), "gatewayServiceId": session.GetGatewayServiceId(), "ip": session.GetIP(), - }, - db.SetDBExpire(time.Hour*12), - db.SetDBMgoLog(false)) + }, db.SetDBMgoLog(false)) if err != nil { code = pb.ErrorCode_DBError return diff --git a/pb/chat_db.pb.go b/pb/chat_db.pb.go index 60f1d04cd..23ee19f70 100644 --- a/pb/chat_db.pb.go +++ b/pb/chat_db.pb.go @@ -80,17 +80,17 @@ type DBChat struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id - Channel ChatChannel `protobuf:"varint,2,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 - Suid string `protobuf:"bytes,3,opt,name=suid,proto3" json:"suid"` //发送用户id - Ruid string `protobuf:"bytes,4,opt,name=ruid,proto3" json:"ruid"` //接收用户id channel == Private 有效 - Groud int32 `protobuf:"varint,5,opt,name=groud,proto3" json:"groud"` //跨服频道 分组id - AreaId int32 `protobuf:"varint,6,opt,name=areaId,proto3" json:"areaId"` //跨服频道 频道Id - UnionId string `protobuf:"bytes,7,opt,name=unionId,proto3" json:"unionId"` //工会id - Avatar string `protobuf:"bytes,8,opt,name=avatar,proto3" json:"avatar"` //用户头像 - Uname string `protobuf:"bytes,9,opt,name=uname,proto3" json:"uname"` //用户名 - Content string `protobuf:"bytes,10,opt,name=content,proto3" json:"content"` //内容 - Ctime int64 `protobuf:"varint,11,opt,name=ctime,proto3" json:"ctime"` //创建时间 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id + Channel ChatChannel `protobuf:"varint,2,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 + Suid string `protobuf:"bytes,3,opt,name=suid,proto3" json:"suid"` //发送用户id + Ruid string `protobuf:"bytes,4,opt,name=ruid,proto3" json:"ruid"` //接收用户id channel == Private 有效 + ChannelId int32 `protobuf:"varint,6,opt,name=channelId,proto3" json:"channelId"` //跨服频道 频道Id + UnionId string `protobuf:"bytes,7,opt,name=unionId,proto3" json:"unionId"` //工会id + Stag string `protobuf:"bytes,8,opt,name=stag,proto3" json:"stag"` //区服id + Avatar string `protobuf:"bytes,9,opt,name=avatar,proto3" json:"avatar"` //用户头像 + Uname string `protobuf:"bytes,10,opt,name=uname,proto3" json:"uname"` //用户名 + Content string `protobuf:"bytes,11,opt,name=content,proto3" json:"content"` //内容 + Ctime int64 `protobuf:"varint,12,opt,name=ctime,proto3" json:"ctime"` //创建时间 } func (x *DBChat) Reset() { @@ -153,16 +153,9 @@ func (x *DBChat) GetRuid() string { return "" } -func (x *DBChat) GetGroud() int32 { +func (x *DBChat) GetChannelId() int32 { if x != nil { - return x.Groud - } - return 0 -} - -func (x *DBChat) GetAreaId() int32 { - if x != nil { - return x.AreaId + return x.ChannelId } return 0 } @@ -174,6 +167,13 @@ func (x *DBChat) GetUnionId() string { return "" } +func (x *DBChat) GetStag() string { + if x != nil { + return x.Stag + } + return "" +} + func (x *DBChat) GetAvatar() string { if x != nil { return x.Avatar @@ -206,30 +206,30 @@ var File_chat_chat_db_proto protoreflect.FileDescriptor var file_chat_chat_db_proto_rawDesc = []byte{ 0x0a, 0x12, 0x63, 0x68, 0x61, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, 0x12, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x75, 0x69, 0x64, 0x12, - 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x67, 0x72, 0x6f, 0x75, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x72, 0x65, 0x61, 0x49, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x72, 0x65, 0x61, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, - 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, - 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x4d, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x72, 0x6f, 0x73, 0x73, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x67, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x61, + 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, + 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x4d, 0x0a, 0x0b, 0x43, 0x68, 0x61, + 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x57, 0x6f, 0x72, 0x6c, + 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x0b, + 0x0a, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x43, + 0x72, 0x6f, 0x73, 0x73, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/chat_msg.pb.go b/pb/chat_msg.pb.go index a8c238151..06d323a25 100644 --- a/pb/chat_msg.pb.go +++ b/pb/chat_msg.pb.go @@ -265,7 +265,8 @@ type ChatGetListReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Channel ChatChannel `protobuf:"varint,1,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 + Channel ChatChannel `protobuf:"varint,1,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 + ChannelId int32 `protobuf:"varint,2,opt,name=channelId,proto3" json:"channelId"` //跨服频道id } func (x *ChatGetListReq) Reset() { @@ -307,6 +308,13 @@ func (x *ChatGetListReq) GetChannel() ChatChannel { return ChatChannel_World } +func (x *ChatGetListReq) GetChannelId() int32 { + if x != nil { + return x.ChannelId + } + return 0 +} + //请求聊天消息 回应 type ChatGetListResp struct { state protoimpl.MessageState @@ -355,110 +363,6 @@ func (x *ChatGetListResp) GetChats() []*DBChat { return nil } -//请求跨服聊天消息 -type ChatSpanGetListReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Channel ChatChannel `protobuf:"varint,1,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 - ChannelId int32 `protobuf:"varint,2,opt,name=channelId,proto3" json:"channelId"` //跨服频道id -} - -func (x *ChatSpanGetListReq) Reset() { - *x = ChatSpanGetListReq{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_chat_msg_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChatSpanGetListReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChatSpanGetListReq) ProtoMessage() {} - -func (x *ChatSpanGetListReq) ProtoReflect() protoreflect.Message { - mi := &file_chat_chat_msg_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChatSpanGetListReq.ProtoReflect.Descriptor instead. -func (*ChatSpanGetListReq) Descriptor() ([]byte, []int) { - return file_chat_chat_msg_proto_rawDescGZIP(), []int{7} -} - -func (x *ChatSpanGetListReq) GetChannel() ChatChannel { - if x != nil { - return x.Channel - } - return ChatChannel_World -} - -func (x *ChatSpanGetListReq) GetChannelId() int32 { - if x != nil { - return x.ChannelId - } - return 0 -} - -//请求跨服聊天消息 回应 -type ChatSpanGetListResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Chats []*DBChat `protobuf:"bytes,1,rep,name=chats,proto3" json:"chats"` -} - -func (x *ChatSpanGetListResp) Reset() { - *x = ChatSpanGetListResp{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_chat_msg_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChatSpanGetListResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChatSpanGetListResp) ProtoMessage() {} - -func (x *ChatSpanGetListResp) ProtoReflect() protoreflect.Message { - mi := &file_chat_chat_msg_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChatSpanGetListResp.ProtoReflect.Descriptor instead. -func (*ChatSpanGetListResp) Descriptor() ([]byte, []int) { - return file_chat_chat_msg_proto_rawDescGZIP(), []int{8} -} - -func (x *ChatSpanGetListResp) GetChats() []*DBChat { - if x != nil { - return x.Chats - } - return nil -} - //消息发送请求 type ChatSendReq struct { state protoimpl.MessageState @@ -475,7 +379,7 @@ type ChatSendReq struct { func (x *ChatSendReq) Reset() { *x = ChatSendReq{} if protoimpl.UnsafeEnabled { - mi := &file_chat_chat_msg_proto_msgTypes[9] + mi := &file_chat_chat_msg_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -488,7 +392,7 @@ func (x *ChatSendReq) String() string { func (*ChatSendReq) ProtoMessage() {} func (x *ChatSendReq) ProtoReflect() protoreflect.Message { - mi := &file_chat_chat_msg_proto_msgTypes[9] + mi := &file_chat_chat_msg_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -501,7 +405,7 @@ func (x *ChatSendReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ChatSendReq.ProtoReflect.Descriptor instead. func (*ChatSendReq) Descriptor() ([]byte, []int) { - return file_chat_chat_msg_proto_rawDescGZIP(), []int{9} + return file_chat_chat_msg_proto_rawDescGZIP(), []int{7} } func (x *ChatSendReq) GetAvatar() string { @@ -549,7 +453,7 @@ type ChatSendResp struct { func (x *ChatSendResp) Reset() { *x = ChatSendResp{} if protoimpl.UnsafeEnabled { - mi := &file_chat_chat_msg_proto_msgTypes[10] + mi := &file_chat_chat_msg_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -562,7 +466,7 @@ func (x *ChatSendResp) String() string { func (*ChatSendResp) ProtoMessage() {} func (x *ChatSendResp) ProtoReflect() protoreflect.Message { - mi := &file_chat_chat_msg_proto_msgTypes[10] + mi := &file_chat_chat_msg_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -575,118 +479,7 @@ func (x *ChatSendResp) ProtoReflect() protoreflect.Message { // Deprecated: Use ChatSendResp.ProtoReflect.Descriptor instead. func (*ChatSendResp) Descriptor() ([]byte, []int) { - return file_chat_chat_msg_proto_rawDescGZIP(), []int{10} -} - -//跨服消息发送请求 -type ChatSpanSendReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像 - Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名 - Channel ChatChannel `protobuf:"varint,3,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道 - Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content"` //内容 -} - -func (x *ChatSpanSendReq) Reset() { - *x = ChatSpanSendReq{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_chat_msg_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChatSpanSendReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChatSpanSendReq) ProtoMessage() {} - -func (x *ChatSpanSendReq) ProtoReflect() protoreflect.Message { - mi := &file_chat_chat_msg_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChatSpanSendReq.ProtoReflect.Descriptor instead. -func (*ChatSpanSendReq) Descriptor() ([]byte, []int) { - return file_chat_chat_msg_proto_rawDescGZIP(), []int{11} -} - -func (x *ChatSpanSendReq) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *ChatSpanSendReq) GetUname() string { - if x != nil { - return x.Uname - } - return "" -} - -func (x *ChatSpanSendReq) GetChannel() ChatChannel { - if x != nil { - return x.Channel - } - return ChatChannel_World -} - -func (x *ChatSpanSendReq) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -//跨服消息发送请求 回应 -type ChatSpanSendResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ChatSpanSendResp) Reset() { - *x = ChatSpanSendResp{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_chat_msg_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChatSpanSendResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChatSpanSendResp) ProtoMessage() {} - -func (x *ChatSpanSendResp) ProtoReflect() protoreflect.Message { - mi := &file_chat_chat_msg_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChatSpanSendResp.ProtoReflect.Descriptor instead. -func (*ChatSpanSendResp) Descriptor() ([]byte, []int) { - return file_chat_chat_msg_proto_rawDescGZIP(), []int{12} + return file_chat_chat_msg_proto_rawDescGZIP(), []int{8} } var File_chat_chat_msg_proto protoreflect.FileDescriptor @@ -710,44 +503,28 @@ var file_chat_chat_msg_proto_rawDesc = []byte{ 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x38, 0x0a, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x56, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, - 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0x30, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x74, 0x47, - 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05, 0x63, 0x68, - 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x43, 0x68, - 0x61, 0x74, 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0x5a, 0x0a, 0x12, 0x43, 0x68, 0x61, - 0x74, 0x53, 0x70, 0x61, 0x6e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, - 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x74, 0x53, 0x70, 0x61, - 0x6e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05, - 0x63, 0x68, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, - 0x43, 0x68, 0x61, 0x74, 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x0b, - 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, - 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x74, 0x53, - 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x81, 0x01, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x74, - 0x53, 0x70, 0x61, 0x6e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, - 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x43, - 0x68, 0x61, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x42, - 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x30, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x74, 0x47, 0x65, 0x74, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74, + 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74, + 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, + 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1a, 0x0a, + 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -762,7 +539,7 @@ func file_chat_chat_msg_proto_rawDescGZIP() []byte { return file_chat_chat_msg_proto_rawDescData } -var file_chat_chat_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_chat_chat_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_chat_chat_msg_proto_goTypes = []interface{}{ (*ChatMessagePush)(nil), // 0: ChatMessagePush (*ChatCrossChannelReq)(nil), // 1: ChatCrossChannelReq @@ -771,28 +548,21 @@ var file_chat_chat_msg_proto_goTypes = []interface{}{ (*ChatChanageChannelResp)(nil), // 4: ChatChanageChannelResp (*ChatGetListReq)(nil), // 5: ChatGetListReq (*ChatGetListResp)(nil), // 6: ChatGetListResp - (*ChatSpanGetListReq)(nil), // 7: ChatSpanGetListReq - (*ChatSpanGetListResp)(nil), // 8: ChatSpanGetListResp - (*ChatSendReq)(nil), // 9: ChatSendReq - (*ChatSendResp)(nil), // 10: ChatSendResp - (*ChatSpanSendReq)(nil), // 11: ChatSpanSendReq - (*ChatSpanSendResp)(nil), // 12: ChatSpanSendResp - (*DBChat)(nil), // 13: DBChat - (ChatChannel)(0), // 14: ChatChannel + (*ChatSendReq)(nil), // 7: ChatSendReq + (*ChatSendResp)(nil), // 8: ChatSendResp + (*DBChat)(nil), // 9: DBChat + (ChatChannel)(0), // 10: ChatChannel } var file_chat_chat_msg_proto_depIdxs = []int32{ - 13, // 0: ChatMessagePush.chat:type_name -> DBChat - 14, // 1: ChatGetListReq.channel:type_name -> ChatChannel - 13, // 2: ChatGetListResp.chats:type_name -> DBChat - 14, // 3: ChatSpanGetListReq.channel:type_name -> ChatChannel - 13, // 4: ChatSpanGetListResp.chats:type_name -> DBChat - 14, // 5: ChatSendReq.channel:type_name -> ChatChannel - 14, // 6: ChatSpanSendReq.channel:type_name -> ChatChannel - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 9, // 0: ChatMessagePush.chat:type_name -> DBChat + 10, // 1: ChatGetListReq.channel:type_name -> ChatChannel + 9, // 2: ChatGetListResp.chats:type_name -> DBChat + 10, // 3: ChatSendReq.channel:type_name -> ChatChannel + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_chat_chat_msg_proto_init() } @@ -887,30 +657,6 @@ func file_chat_chat_msg_proto_init() { } } file_chat_chat_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatSpanGetListReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_chat_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatSpanGetListResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_chat_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChatSendReq); i { case 0: return &v.state @@ -922,7 +668,7 @@ func file_chat_chat_msg_proto_init() { return nil } } - file_chat_chat_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_chat_chat_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChatSendResp); i { case 0: return &v.state @@ -934,30 +680,6 @@ func file_chat_chat_msg_proto_init() { return nil } } - file_chat_chat_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatSpanSendReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_chat_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatSpanSendResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -965,7 +687,7 @@ func file_chat_chat_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_chat_chat_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/comm.pb.go b/pb/comm.pb.go index 8506bd913..529b5dc1a 100644 --- a/pb/comm.pb.go +++ b/pb/comm.pb.go @@ -678,6 +678,86 @@ func (x *AgentCloseeReq) GetUserSessionId() string { return "" } +//通知用户登录 +type NoticeUserLoginReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ip string `protobuf:"bytes,1,opt,name=Ip,proto3" json:"Ip"` + UserSessionId string `protobuf:"bytes,2,opt,name=UserSessionId,proto3" json:"UserSessionId"` + UserId string `protobuf:"bytes,3,opt,name=UserId,proto3" json:"UserId"` + ServiceTag string `protobuf:"bytes,4,opt,name=ServiceTag,proto3" json:"ServiceTag"` + GatewayServiceId string `protobuf:"bytes,5,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId"` +} + +func (x *NoticeUserLoginReq) Reset() { + *x = NoticeUserLoginReq{} + if protoimpl.UnsafeEnabled { + mi := &file_comm_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NoticeUserLoginReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoticeUserLoginReq) ProtoMessage() {} + +func (x *NoticeUserLoginReq) ProtoReflect() protoreflect.Message { + mi := &file_comm_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NoticeUserLoginReq.ProtoReflect.Descriptor instead. +func (*NoticeUserLoginReq) Descriptor() ([]byte, []int) { + return file_comm_proto_rawDescGZIP(), []int{9} +} + +func (x *NoticeUserLoginReq) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *NoticeUserLoginReq) GetUserSessionId() string { + if x != nil { + return x.UserSessionId + } + return "" +} + +func (x *NoticeUserLoginReq) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *NoticeUserLoginReq) GetServiceTag() string { + if x != nil { + return x.ServiceTag + } + return "" +} + +func (x *NoticeUserLoginReq) GetGatewayServiceId() string { + if x != nil { + return x.GatewayServiceId + } + return "" +} + //通知用户离线 type NoticeUserCloseReq struct { state protoimpl.MessageState @@ -694,7 +774,7 @@ type NoticeUserCloseReq struct { func (x *NoticeUserCloseReq) Reset() { *x = NoticeUserCloseReq{} if protoimpl.UnsafeEnabled { - mi := &file_comm_proto_msgTypes[9] + mi := &file_comm_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -707,7 +787,7 @@ func (x *NoticeUserCloseReq) String() string { func (*NoticeUserCloseReq) ProtoMessage() {} func (x *NoticeUserCloseReq) ProtoReflect() protoreflect.Message { - mi := &file_comm_proto_msgTypes[9] + mi := &file_comm_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -720,7 +800,7 @@ func (x *NoticeUserCloseReq) ProtoReflect() protoreflect.Message { // Deprecated: Use NoticeUserCloseReq.ProtoReflect.Descriptor instead. func (*NoticeUserCloseReq) Descriptor() ([]byte, []int) { - return file_comm_proto_rawDescGZIP(), []int{9} + return file_comm_proto_rawDescGZIP(), []int{10} } func (x *NoticeUserCloseReq) GetIp() string { @@ -772,7 +852,7 @@ type UserAssets struct { func (x *UserAssets) Reset() { *x = UserAssets{} if protoimpl.UnsafeEnabled { - mi := &file_comm_proto_msgTypes[10] + mi := &file_comm_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -785,7 +865,7 @@ func (x *UserAssets) String() string { func (*UserAssets) ProtoMessage() {} func (x *UserAssets) ProtoReflect() protoreflect.Message { - mi := &file_comm_proto_msgTypes[10] + mi := &file_comm_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -798,7 +878,7 @@ func (x *UserAssets) ProtoReflect() protoreflect.Message { // Deprecated: Use UserAssets.ProtoReflect.Descriptor instead. func (*UserAssets) Descriptor() ([]byte, []int) { - return file_comm_proto_rawDescGZIP(), []int{10} + return file_comm_proto_rawDescGZIP(), []int{11} } func (x *UserAssets) GetA() string { @@ -834,7 +914,7 @@ type TaskParam struct { func (x *TaskParam) Reset() { *x = TaskParam{} if protoimpl.UnsafeEnabled { - mi := &file_comm_proto_msgTypes[11] + mi := &file_comm_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -847,7 +927,7 @@ func (x *TaskParam) String() string { func (*TaskParam) ProtoMessage() {} func (x *TaskParam) ProtoReflect() protoreflect.Message { - mi := &file_comm_proto_msgTypes[11] + mi := &file_comm_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -860,7 +940,7 @@ func (x *TaskParam) ProtoReflect() protoreflect.Message { // Deprecated: Use TaskParam.ProtoReflect.Descriptor instead. func (*TaskParam) Descriptor() ([]byte, []int) { - return file_comm_proto_rawDescGZIP(), []int{11} + return file_comm_proto_rawDescGZIP(), []int{12} } func (x *TaskParam) GetFirst() int32 { @@ -957,7 +1037,7 @@ var file_comm_proto_rawDesc = []byte{ 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xae, 0x01, 0x0a, 0x12, 0x4e, - 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, + 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, @@ -967,20 +1047,31 @@ var file_comm_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x61, 0x67, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x0a, 0x55, - 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x0c, 0x0a, 0x01, 0x41, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x41, 0x12, 0x0c, 0x0a, 0x01, 0x54, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x01, 0x54, 0x12, 0x0c, 0x0a, 0x01, 0x4e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x01, 0x4e, 0x22, 0x39, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x2a, 0x43, - 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, - 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, - 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, - 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0xae, 0x01, 0x0a, 0x12, + 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, + 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x49, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x61, 0x67, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x61, 0x67, + 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x0a, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x0c, 0x0a, 0x01, 0x41, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x41, 0x12, 0x0c, 0x0a, 0x01, 0x54, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x01, 0x54, 0x12, 0x0c, 0x0a, 0x01, 0x4e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x01, 0x4e, 0x22, 0x39, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x2a, + 0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, + 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, + 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, + 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -996,7 +1087,7 @@ func file_comm_proto_rawDescGZIP() []byte { } var file_comm_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_comm_proto_goTypes = []interface{}{ (HeroAttributesType)(0), // 0: HeroAttributesType (*UserMessage)(nil), // 1: UserMessage @@ -1008,21 +1099,22 @@ var file_comm_proto_goTypes = []interface{}{ (*BatchMessageReq)(nil), // 7: BatchMessageReq (*BroadCastMessageReq)(nil), // 8: BroadCastMessageReq (*AgentCloseeReq)(nil), // 9: AgentCloseeReq - (*NoticeUserCloseReq)(nil), // 10: NoticeUserCloseReq - (*UserAssets)(nil), // 11: UserAssets - (*TaskParam)(nil), // 12: TaskParam - (*anypb.Any)(nil), // 13: google.protobuf.Any - (ErrorCode)(0), // 14: ErrorCode + (*NoticeUserLoginReq)(nil), // 10: NoticeUserLoginReq + (*NoticeUserCloseReq)(nil), // 11: NoticeUserCloseReq + (*UserAssets)(nil), // 12: UserAssets + (*TaskParam)(nil), // 13: TaskParam + (*anypb.Any)(nil), // 14: google.protobuf.Any + (ErrorCode)(0), // 15: ErrorCode } var file_comm_proto_depIdxs = []int32{ - 13, // 0: UserMessage.data:type_name -> google.protobuf.Any - 13, // 1: AgentMessage.Message:type_name -> google.protobuf.Any - 14, // 2: RPCMessageReply.Code:type_name -> ErrorCode - 13, // 3: RPCMessageReply.ErrorData:type_name -> google.protobuf.Any + 14, // 0: UserMessage.data:type_name -> google.protobuf.Any + 14, // 1: AgentMessage.Message:type_name -> google.protobuf.Any + 15, // 2: RPCMessageReply.Code:type_name -> ErrorCode + 14, // 3: RPCMessageReply.ErrorData:type_name -> google.protobuf.Any 1, // 4: RPCMessageReply.Reply:type_name -> UserMessage 1, // 5: AgentSendMessageReq.Reply:type_name -> UserMessage - 13, // 6: BatchMessageReq.Data:type_name -> google.protobuf.Any - 13, // 7: BroadCastMessageReq.Data:type_name -> google.protobuf.Any + 14, // 6: BatchMessageReq.Data:type_name -> google.protobuf.Any + 14, // 7: BroadCastMessageReq.Data:type_name -> google.protobuf.Any 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name @@ -1146,7 +1238,7 @@ func file_comm_proto_init() { } } file_comm_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NoticeUserCloseReq); i { + switch v := v.(*NoticeUserLoginReq); i { case 0: return &v.state case 1: @@ -1158,7 +1250,7 @@ func file_comm_proto_init() { } } file_comm_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserAssets); i { + switch v := v.(*NoticeUserCloseReq); i { case 0: return &v.state case 1: @@ -1170,6 +1262,18 @@ func file_comm_proto_init() { } } file_comm_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserAssets); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comm_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TaskParam); i { case 0: return &v.state @@ -1188,7 +1292,7 @@ func file_comm_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_comm_proto_rawDesc, NumEnums: 1, - NumMessages: 12, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/friend_msg.pb.go b/pb/friend_msg.pb.go index efee3d021..b8a3c4b79 100644 --- a/pb/friend_msg.pb.go +++ b/pb/friend_msg.pb.go @@ -1379,6 +1379,101 @@ func (x *FriendTotalResp) GetTotal() int32 { return 0 } +// 点赞 +type FriendZanReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FriendId string `protobuf:"bytes,1,opt,name=friendId,proto3" json:"friendId"` +} + +func (x *FriendZanReq) Reset() { + *x = FriendZanReq{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendZanReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendZanReq) ProtoMessage() {} + +func (x *FriendZanReq) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendZanReq.ProtoReflect.Descriptor instead. +func (*FriendZanReq) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{27} +} + +func (x *FriendZanReq) GetFriendId() string { + if x != nil { + return x.FriendId + } + return "" +} + +type FriendZanResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Flag bool `protobuf:"varint,1,opt,name=flag,proto3" json:"flag"` +} + +func (x *FriendZanResp) Reset() { + *x = FriendZanResp{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendZanResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendZanResp) ProtoMessage() {} + +func (x *FriendZanResp) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendZanResp.ProtoReflect.Descriptor instead. +func (*FriendZanResp) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{28} +} + +func (x *FriendZanResp) GetFlag() bool { + if x != nil { + return x.Flag + } + return false +} + var File_friend_friend_msg_proto protoreflect.FileDescriptor var file_friend_friend_msg_proto_rawDesc = []byte{ @@ -1479,8 +1574,13 @@ var file_friend_friend_msg_proto_rawDesc = []byte{ 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x2a, 0x0a, 0x0c, 0x46, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x5a, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x23, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5a, + 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1495,7 +1595,7 @@ func file_friend_friend_msg_proto_rawDescGZIP() []byte { return file_friend_friend_msg_proto_rawDescData } -var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 27) +var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 29) var file_friend_friend_msg_proto_goTypes = []interface{}{ (*FriendBase)(nil), // 0: FriendBase (*FriendListReq)(nil), // 1: FriendListReq @@ -1524,6 +1624,8 @@ var file_friend_friend_msg_proto_goTypes = []interface{}{ (*FriendGiveResp)(nil), // 24: FriendGiveResp (*FriendTotalReq)(nil), // 25: FriendTotalReq (*FriendTotalResp)(nil), // 26: FriendTotalResp + (*FriendZanReq)(nil), // 27: FriendZanReq + (*FriendZanResp)(nil), // 28: FriendZanResp } var file_friend_friend_msg_proto_depIdxs = []int32{ 0, // 0: FriendListResp.list:type_name -> FriendBase @@ -1867,6 +1969,30 @@ func file_friend_friend_msg_proto_init() { return nil } } + file_friend_friend_msg_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendZanReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_friend_friend_msg_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendZanResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1874,7 +2000,7 @@ func file_friend_friend_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_friend_friend_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 27, + NumMessages: 29, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/user_msg.pb.go b/pb/user_msg.pb.go index b1fe33391..2d507ca79 100644 --- a/pb/user_msg.pb.go +++ b/pb/user_msg.pb.go @@ -1061,6 +1061,7 @@ type UserModifynameResp struct { Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count"` //剩余修改次数 + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` } func (x *UserModifynameResp) Reset() { @@ -1109,6 +1110,13 @@ func (x *UserModifynameResp) GetCount() uint32 { return 0 } +func (x *UserModifynameResp) GetName() string { + if x != nil { + return x.Name + } + return "" +} + // 图鉴 type UserGetTujianReq struct { state protoimpl.MessageState @@ -1587,46 +1595,47 @@ var file_user_user_msg_proto_rawDesc = []byte{ 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x27, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3c, 0x0a, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x50, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x55, - 0x73, 0x65, 0x72, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x22, - 0x2d, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x73, 0x22, 0x45, - 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x50, 0x75, 0x73, - 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0xe3, 0x01, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x46, 0x69, - 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x69, 0x6e, - 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x72, 0x65, - 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x19, 0x0a, 0x04, 0x68, 0x61, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, - 0x48, 0x61, 0x69, 0x72, 0x52, 0x04, 0x68, 0x61, 0x69, 0x72, 0x12, 0x19, 0x0a, 0x04, 0x65, 0x79, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x45, 0x79, 0x65, 0x73, 0x52, - 0x04, 0x65, 0x79, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x74, 0x68, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x4d, 0x6f, 0x75, 0x74, 0x68, 0x52, 0x05, 0x6d, 0x6f, - 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x05, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x2b, - 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x6f, 0x6e, 0x52, - 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x0e, 0x55, - 0x73, 0x65, 0x72, 0x46, 0x69, 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, - 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x06, 0x66, 0x69, 0x67, 0x75, 0x72, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x46, 0x69, 0x67, 0x75, 0x72, 0x65, - 0x52, 0x06, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x22, 0x27, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, - 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x73, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, - 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x69, 0x67, - 0x6e, 0x22, 0x26, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x73, - 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x12, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, + 0x52, 0x65, 0x71, 0x22, 0x2d, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x47, 0x65, 0x74, 0x54, 0x75, + 0x6a, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, + 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x69, + 0x64, 0x73, 0x22, 0x45, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0xe3, 0x01, 0x0a, 0x0d, 0x55, 0x73, + 0x65, 0x72, 0x46, 0x69, 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x70, + 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0a, 0x70, 0x72, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x04, 0x68, 0x61, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x05, 0x2e, 0x48, 0x61, 0x69, 0x72, 0x52, 0x04, 0x68, 0x61, 0x69, 0x72, 0x12, 0x19, + 0x0a, 0x04, 0x65, 0x79, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x45, + 0x79, 0x65, 0x73, 0x52, 0x04, 0x65, 0x79, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x05, 0x6d, 0x6f, 0x75, + 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x4d, 0x6f, 0x75, 0x74, 0x68, + 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x12, 0x2b, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x6f, 0x6e, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, + 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x69, 0x6f, 0x6e, 0x22, + 0x5b, 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x46, 0x69, 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x06, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x46, 0x69, + 0x67, 0x75, 0x72, 0x65, 0x52, 0x06, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x22, 0x27, 0x0a, 0x11, + 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x73, 0x69, 0x67, 0x6e, 0x52, 0x65, + 0x71, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x73, 0x69, 0x67, 0x6e, 0x22, 0x26, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x64, + 0x69, 0x66, 0x79, 0x73, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go index 65892df7e..466266e84 100644 --- a/services/comp_gateroute.go +++ b/services/comp_gateroute.go @@ -5,6 +5,7 @@ import ( "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" + "go_dreamfactory/sys/db" "reflect" "sync" "time" @@ -85,6 +86,7 @@ func (this *SCompGateRoute) Init(service core.IService, comp core.IServiceComp, //组件启动时注册rpc服务监听 func (this *SCompGateRoute) Start() (err error) { this.service.RegisterFunctionName(string(comm.Rpc_GatewayRoute), this.ReceiveMsg) //注册网关路由接收接口 + this.service.RegisterFunctionName(string(comm.Rpc_GatewayNoticeUserLogin), this.NoticeUserLogin) //注册用户登录通知 this.service.RegisterFunctionName(string(comm.Rpc_GatewayNoticeUserClose), this.NoticeUserClose) //注册用户离线通知 err = this.ServiceCompBase.Start() return @@ -181,6 +183,19 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag return nil } +//RPC_NoticeUserClose 接收用户登录通知 +func (this *SCompGateRoute) NoticeUserLogin(ctx context.Context, args *pb.NoticeUserLoginReq, reply *pb.RPCMessageReply) error { + model := db.NewDBModel(comm.TableSession, db.Local()) + model.Change(args.UserId, map[string]interface{}{ + "uid": args.UserId, + "sessionId": args.UserSessionId, + "serviceTag": args.ServiceTag, + "gatewayServiceId": args.GatewayServiceId, + "ip": args.Ip, + }) + return nil +} + //RPC_NoticeUserClose 接收用户离线通知 func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error { session := this.pools.Get().(comm.IUserSession)