添加client测试端
This commit is contained in:
parent
7b18e9a8b6
commit
3752feb4ef
@ -158,7 +158,8 @@ func (s *GateService) OnMessage(data []byte) error {
|
|||||||
*/
|
*/
|
||||||
func (s *GateService) findTopic(userId int64, serviceTypeId pb.ServiceTypeId) (topic, sName string) {
|
func (s *GateService) findTopic(userId int64, serviceTypeId pb.ServiceTypeId) (topic, sName string) {
|
||||||
if userId != 0 {
|
if userId != 0 {
|
||||||
if sName, err := s.bindService.FindServiceName(userId, serviceTypeId); err == nil {
|
var err error
|
||||||
|
if sName, err = s.bindService.FindServiceName(userId, serviceTypeId); err == nil {
|
||||||
return service.TopicEx(sName), sName
|
return service.TopicEx(sName), sName
|
||||||
} else {
|
} else {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
@ -181,6 +182,12 @@ func (s *GateService) WsOnMessage(conn ws.IConn, data []byte) {
|
|||||||
topic, msg.ServiceName = s.findTopic(conn.UserId(), msg.ServiceTid)
|
topic, msg.ServiceName = s.findTopic(conn.UserId(), msg.ServiceTid)
|
||||||
}
|
}
|
||||||
if topic != "" {
|
if topic != "" {
|
||||||
|
if msg.MsgId == int32(pb.MsgId_C2SUserLoginId) {
|
||||||
|
req := &pb.C2SUserLogin{}
|
||||||
|
_ = proto.Unmarshal(msg.Data, req)
|
||||||
|
req.Ip = conn.Addr()
|
||||||
|
msg.Data, _ = proto.Marshal(req)
|
||||||
|
}
|
||||||
s.SendServiceData(topic, conn, msg.MsgId, msg.Data)
|
s.SendServiceData(topic, conn, msg.MsgId, msg.Data)
|
||||||
} else {
|
} else {
|
||||||
log.Error(s.Log("topic:%v not exist.user:%v", topic, conn.UserId()))
|
log.Error(s.Log("topic:%v not exist.user:%v", topic, conn.UserId()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user