push modify

pull/103/head
Gordon 3 years ago
parent 7dbaa1b8c1
commit 52e15fc9d4

@ -83,7 +83,7 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
enc := gob.NewEncoder(&replyBytes) enc := gob.NewEncoder(&replyBytes)
err := enc.Encode(mReply) err := enc.Encode(mReply)
if err != nil { if err != nil {
fmt.Println(err) log.NewError(in.OperationID, "data encode err", err.Error())
} }
switch in.GetSessionType() { switch in.GetSessionType() {
case constant.SingleChatType: case constant.SingleChatType:
@ -92,10 +92,11 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
RecvID = strings.Split(in.GetRecvID(), " ")[0] RecvID = strings.Split(in.GetRecvID(), " ")[0]
} }
var tag bool var tag bool
var UIDAndPID []string
userIDList := genUidPlatformArray(RecvID) userIDList := genUidPlatformArray(RecvID)
for _, v := range userIDList { for _, v := range userIDList {
UIDAndPID = strings.Split(v, " ")
if conn := ws.getUserConn(v); conn != nil { if conn := ws.getUserConn(v); conn != nil {
UIDAndPID := strings.Split(v, " ")
tag = true tag = true
resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0]) resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0])
temp := &pbRelay.SingleMsgToUser{ temp := &pbRelay.SingleMsgToUser{
@ -104,6 +105,13 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
RecvPlatFormID: utils.PlatformNameToID(UIDAndPID[1]), RecvPlatFormID: utils.PlatformNameToID(UIDAndPID[1]),
} }
resp = append(resp, temp) resp = append(resp, temp)
} else {
temp := &pbRelay.SingleMsgToUser{
ResultCode: -1,
RecvID: UIDAndPID[0],
RecvPlatFormID: utils.PlatformNameToID(UIDAndPID[1]),
}
resp = append(resp, temp)
} }
} }
if !tag { if !tag {

Loading…
Cancel
Save