Prechádzať zdrojové kódy

v0.0.1开发:
1)调整服务的状态码类型为int32
2)晚上flwosrv中链路追踪

#Suyghur 2 rokov pred
rodič
commit
90ddce4521

+ 14 - 14
bff/cmdbff/api/desc/bean.api

@@ -16,17 +16,17 @@ type (
         CsNickname string `json:"cs_nickname"`
         CsAvatarUrl string `json:"cs_avatar_url"`
         CsSignature string `json:"cs_signature"`
-        OnlineStatus int64 `json:"online_status"`
+        OnlineStatus int32 `json:"online_status"`
     }
 
     PlayerFetchHistoryMsgReq {
-        Page int64 `json:"page"`
-        Limit int64 `json:"limit"`
+        Page int32 `json:"page"`
+        Limit int32 `json:"limit"`
     }
 
     PlayerFetchHistoryMsgResp {
-        TotalPage int64 `json:"total_page"`
-        CurrentPage int64 `json:"current_page"`
+        TotalPage int32 `json:"total_page"`
+        CurrentPage int32 `json:"current_page"`
         List []interface{} `json:"list"`
     }
 
@@ -38,7 +38,7 @@ type (
 
 type (
     CsFetchPlayerQueueReq {
-        Limit int64 `json:"limit"`
+        Limit int32 `json:"limit"`
     }
 
     CsFetchPlayerQueueResp {
@@ -51,26 +51,26 @@ type (
     }
 
     CsFetchHistoryChatReq {
-        Page int64 `json:"page"`
-        Limit int64 `json:"limit"`
+        Page int32 `json:"page"`
+        Limit int32 `json:"limit"`
     }
 
     CsFetchHistoryChatResp {
-        TotalPage int64 `json:"total_page"`
-        CurrentPage int64 `json:"current_page"`
+        TotalPage int32 `json:"total_page"`
+        CurrentPage int32 `json:"current_page"`
         List []interface{} `json:"list"`
     }
 
     CsFetchHistoryMsgReq {
         GameId string `json:"game_id"`
         PlayerId string `json:"player_id"`
-        Page int64 `json:"page"`
-        Limit int64 `json:"limit"`
+        Page int32 `json:"page"`
+        Limit int32 `json:"limit"`
     }
 
     CsFetchHistoryMsgResp {
-        TotalPage int64 `json:"total_page"`
-        CurrentPage int64 `json:"current_page"`
+        TotalPage int32 `json:"total_page"`
+        CurrentPage int32 `json:"current_page"`
         List []interface{} `json:"list"`
     }
 

+ 14 - 14
bff/cmdbff/api/internal/types/types.go

@@ -10,17 +10,17 @@ type PlayerFetchCsInfoResp struct {
 	CsNickname   string `json:"cs_nickname"`
 	CsAvatarUrl  string `json:"cs_avatar_url"`
 	CsSignature  string `json:"cs_signature"`
-	OnlineStatus int64  `json:"online_status"`
+	OnlineStatus int32  `json:"online_status"`
 }
 
 type PlayerFetchHistoryMsgReq struct {
-	Page  int64 `json:"page"`
-	Limit int64 `json:"limit"`
+	Page  int32 `json:"page"`
+	Limit int32 `json:"limit"`
 }
 
 type PlayerFetchHistoryMsgResp struct {
-	TotalPage   int64         `json:"total_page"`
-	CurrentPage int64         `json:"current_page"`
+	TotalPage   int32         `json:"total_page"`
+	CurrentPage int32         `json:"current_page"`
 	List        []interface{} `json:"list"`
 }
 
@@ -30,7 +30,7 @@ type PlayerSendMsgReq struct {
 }
 
 type CsFetchPlayerQueueReq struct {
-	Limit int64 `json:"limit"`
+	Limit int32 `json:"limit"`
 }
 
 type CsFetchPlayerQueueResp struct {
@@ -43,26 +43,26 @@ type CsConnectPlayerReq struct {
 }
 
 type CsFetchHistoryChatReq struct {
-	Page  int64 `json:"page"`
-	Limit int64 `json:"limit"`
+	Page  int32 `json:"page"`
+	Limit int32 `json:"limit"`
 }
 
 type CsFetchHistoryChatResp struct {
-	TotalPage   int64         `json:"total_page"`
-	CurrentPage int64         `json:"current_page"`
+	TotalPage   int32         `json:"total_page"`
+	CurrentPage int32         `json:"current_page"`
 	List        []interface{} `json:"list"`
 }
 
 type CsFetchHistoryMsgReq struct {
 	GameId   string `json:"game_id"`
 	PlayerId string `json:"player_id"`
-	Page     int64  `json:"page"`
-	Limit    int64  `json:"limit"`
+	Page     int32  `json:"page"`
+	Limit    int32  `json:"limit"`
 }
 
 type CsFetchHistoryMsgResp struct {
-	TotalPage   int64         `json:"total_page"`
-	CurrentPage int64         `json:"current_page"`
+	TotalPage   int32         `json:"total_page"`
+	CurrentPage int32         `json:"current_page"`
 	List        []interface{} `json:"list"`
 }
 

+ 1 - 1
comm/model/csinfo.go

@@ -9,5 +9,5 @@ type CsInfo struct {
 	CsNickname   string `json:"cs_nickname"`
 	CsAvatarUrl  string `json:"cs_avatar_url"`
 	CsSignature  string `json:"cs_signature"`
-	OnlineStatus int64  `json:"online_status"`
+	OnlineStatus int32  `json:"online_status"`
 }

+ 1 - 1
comm/model/message.go

@@ -21,7 +21,7 @@ type KqMessage struct {
 }
 
 type KqCmdMessage struct {
-	Opt        int64  `json:"opt"`
+	Opt        int32  `json:"opt"`
 	ReceiverId string `json:"receiver_id"`
 	GameId     string `json:"game_id"`
 	Uid        string `json:"uid"`

+ 1 - 1
comm/model/playerinfo.go

@@ -7,7 +7,7 @@ package model
 type PlayerInfo struct {
 	GameId     string `json:"game_id"`
 	PlayerId   string `json:"player_id"`
-	IsVip      int64  `json:"is_vip"`
+	IsVip      int32  `json:"is_vip"`
 	CsId       string `json:"cs_id"`
 	ConnectTs  int64  `json:"connect_ts"`
 	LastChatTs int64  `json:"last_chat_ts"`

+ 15 - 15
comm/result/err.go

@@ -11,19 +11,19 @@ import "fmt"
 */
 
 const (
-	Ok                 int64 = 0
-	ServerCommonError  int64 = 10001
-	RequestParamError  int64 = 10002
-	TokenExpireError   int64 = 10003
-	TokenParseError    int64 = 10004
-	TokenGenerateError int64 = 10005
-	DbError            int64 = 10006
+	Ok                 int32 = 0
+	ServerCommonError  int32 = 10001
+	RequestParamError  int32 = 10002
+	TokenExpireError   int32 = 10003
+	TokenParseError    int32 = 10004
+	TokenGenerateError int32 = 10005
+	DbError            int32 = 10006
 )
 
-var message map[int64]string
+var message map[int32]string
 
 func init() {
-	message = make(map[int64]string)
+	message = make(map[int32]string)
 	message[Ok] = "success"
 	message[ServerCommonError] = "some unknown error has occurred"
 	message[RequestParamError] = "request params error"
@@ -33,7 +33,7 @@ func init() {
 	message[DbError] = "database is busy, please try again late"
 }
 
-func MapErrMsg(code int64) string {
+func MapErrMsg(code int32) string {
 	if msg, ok := message[code]; ok {
 		return msg
 	} else {
@@ -41,7 +41,7 @@ func MapErrMsg(code int64) string {
 	}
 }
 
-func IsCodeErr(code int64) bool {
+func IsCodeErr(code int32) bool {
 	if _, ok := message[code]; ok {
 		return true
 	} else {
@@ -50,11 +50,11 @@ func IsCodeErr(code int64) bool {
 }
 
 type CodeError struct {
-	errCode int64
+	errCode int32
 	errMsg  string
 }
 
-func (e *CodeError) GetErrCode() int64 {
+func (e *CodeError) GetErrCode() int32 {
 	return e.errCode
 }
 
@@ -66,10 +66,10 @@ func (e *CodeError) Error() string {
 	return fmt.Sprintf("code:%d,msg:%s", e.errCode, e.errMsg)
 }
 
-func NewErrCodeMsg(code int64, msg string) *CodeError {
+func NewErrCodeMsg(code int32, msg string) *CodeError {
 	return &CodeError{errCode: code, errMsg: msg}
 }
-func NewErrCode(errCode int64) *CodeError {
+func NewErrCode(errCode int32) *CodeError {
 	return &CodeError{errCode: errCode, errMsg: MapErrMsg(errCode)}
 }
 

+ 1 - 1
comm/result/httpresult.go

@@ -28,7 +28,7 @@ func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err er
 			msg = e.GetErrMsg()
 		} else {
 			if gStatus, ok := status.FromError(cause); ok {
-				grpcCode := int64(gStatus.Code())
+				grpcCode := int32(gStatus.Code())
 				if IsCodeErr(grpcCode) {
 					code = grpcCode
 					msg = gStatus.Message()

+ 2 - 2
comm/result/responsebean.go

@@ -5,7 +5,7 @@
 package result
 
 type ResponseBean struct {
-	Code int64       `json:"code"`
+	Code int32       `json:"code"`
 	Msg  string      `json:"msg"`
 	Data interface{} `json:"data"`
 }
@@ -17,6 +17,6 @@ func Success(data interface{}) *ResponseBean {
 	return &ResponseBean{0, "success", data}
 }
 
-func Error(code int64, msg string) *ResponseBean {
+func Error(code int32, msg string) *ResponseBean {
 	return &ResponseBean{code, msg, map[string]interface{}{}}
 }

+ 42 - 42
core/cmd/rpc/pb/cmd.pb.go

@@ -95,7 +95,7 @@ type PlayerFetchCsInfoResp struct {
 	CsNickname   string `protobuf:"bytes,2,opt,name=cs_nickname,json=csNickname,proto3" json:"cs_nickname,omitempty"`
 	CsAvatarUrl  string `protobuf:"bytes,3,opt,name=cs_avatar_url,json=csAvatarUrl,proto3" json:"cs_avatar_url,omitempty"`
 	CsSignature  string `protobuf:"bytes,4,opt,name=cs_signature,json=csSignature,proto3" json:"cs_signature,omitempty"`
-	OnlineStatus int64  `protobuf:"varint,5,opt,name=online_status,json=onlineStatus,proto3" json:"online_status,omitempty"`
+	OnlineStatus int32  `protobuf:"varint,5,opt,name=online_status,json=onlineStatus,proto3" json:"online_status,omitempty"`
 }
 
 func (x *PlayerFetchCsInfoResp) Reset() {
@@ -158,7 +158,7 @@ func (x *PlayerFetchCsInfoResp) GetCsSignature() string {
 	return ""
 }
 
-func (x *PlayerFetchCsInfoResp) GetOnlineStatus() int64 {
+func (x *PlayerFetchCsInfoResp) GetOnlineStatus() int32 {
 	if x != nil {
 		return x.OnlineStatus
 	}
@@ -172,8 +172,8 @@ type PlayerFetchHistoryMsgReq struct {
 
 	GameId   string `protobuf:"bytes,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
 	PlayerId string `protobuf:"bytes,2,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
-	Page     int64  `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"`
-	Limit    int64  `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`
+	Page     int32  `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"`
+	Limit    int32  `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`
 }
 
 func (x *PlayerFetchHistoryMsgReq) Reset() {
@@ -222,14 +222,14 @@ func (x *PlayerFetchHistoryMsgReq) GetPlayerId() string {
 	return ""
 }
 
-func (x *PlayerFetchHistoryMsgReq) GetPage() int64 {
+func (x *PlayerFetchHistoryMsgReq) GetPage() int32 {
 	if x != nil {
 		return x.Page
 	}
 	return 0
 }
 
-func (x *PlayerFetchHistoryMsgReq) GetLimit() int64 {
+func (x *PlayerFetchHistoryMsgReq) GetLimit() int32 {
 	if x != nil {
 		return x.Limit
 	}
@@ -241,8 +241,8 @@ type PlayerFetchHistoryMsgResp struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	TotalPage   int64               `protobuf:"varint,1,opt,name=total_page,json=totalPage,proto3" json:"total_page,omitempty"`
-	CurrentPage int64               `protobuf:"varint,2,opt,name=current_page,json=currentPage,proto3" json:"current_page,omitempty"`
+	TotalPage   int32               `protobuf:"varint,1,opt,name=total_page,json=totalPage,proto3" json:"total_page,omitempty"`
+	CurrentPage int32               `protobuf:"varint,2,opt,name=current_page,json=currentPage,proto3" json:"current_page,omitempty"`
 	List        *structpb.ListValue `protobuf:"bytes,3,opt,name=list,proto3" json:"list,omitempty"`
 }
 
@@ -278,14 +278,14 @@ func (*PlayerFetchHistoryMsgResp) Descriptor() ([]byte, []int) {
 	return file_pb_cmd_proto_rawDescGZIP(), []int{3}
 }
 
-func (x *PlayerFetchHistoryMsgResp) GetTotalPage() int64 {
+func (x *PlayerFetchHistoryMsgResp) GetTotalPage() int32 {
 	if x != nil {
 		return x.TotalPage
 	}
 	return 0
 }
 
-func (x *PlayerFetchHistoryMsgResp) GetCurrentPage() int64 {
+func (x *PlayerFetchHistoryMsgResp) GetCurrentPage() int32 {
 	if x != nil {
 		return x.CurrentPage
 	}
@@ -508,7 +508,7 @@ type CsFetchPlayerQueueReq struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Limit int64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
+	Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
 }
 
 func (x *CsFetchPlayerQueueReq) Reset() {
@@ -543,7 +543,7 @@ func (*CsFetchPlayerQueueReq) Descriptor() ([]byte, []int) {
 	return file_pb_cmd_proto_rawDescGZIP(), []int{8}
 }
 
-func (x *CsFetchPlayerQueueReq) GetLimit() int64 {
+func (x *CsFetchPlayerQueueReq) GetLimit() int32 {
 	if x != nil {
 		return x.Limit
 	}
@@ -712,8 +712,8 @@ type CsFetchHistoryChatReq struct {
 	unknownFields protoimpl.UnknownFields
 
 	CsId  string `protobuf:"bytes,1,opt,name=cs_id,json=csId,proto3" json:"cs_id,omitempty"`
-	Page  int64  `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
-	Limit int64  `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
+	Page  int32  `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
+	Limit int32  `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
 }
 
 func (x *CsFetchHistoryChatReq) Reset() {
@@ -755,14 +755,14 @@ func (x *CsFetchHistoryChatReq) GetCsId() string {
 	return ""
 }
 
-func (x *CsFetchHistoryChatReq) GetPage() int64 {
+func (x *CsFetchHistoryChatReq) GetPage() int32 {
 	if x != nil {
 		return x.Page
 	}
 	return 0
 }
 
-func (x *CsFetchHistoryChatReq) GetLimit() int64 {
+func (x *CsFetchHistoryChatReq) GetLimit() int32 {
 	if x != nil {
 		return x.Limit
 	}
@@ -774,8 +774,8 @@ type CsFetchHistoryChatResp struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	TotalPage   int64               `protobuf:"varint,1,opt,name=total_page,json=totalPage,proto3" json:"total_page,omitempty"`
-	CurrentPage int64               `protobuf:"varint,2,opt,name=current_page,json=currentPage,proto3" json:"current_page,omitempty"`
+	TotalPage   int32               `protobuf:"varint,1,opt,name=total_page,json=totalPage,proto3" json:"total_page,omitempty"`
+	CurrentPage int32               `protobuf:"varint,2,opt,name=current_page,json=currentPage,proto3" json:"current_page,omitempty"`
 	List        *structpb.ListValue `protobuf:"bytes,3,opt,name=list,proto3" json:"list,omitempty"`
 }
 
@@ -811,14 +811,14 @@ func (*CsFetchHistoryChatResp) Descriptor() ([]byte, []int) {
 	return file_pb_cmd_proto_rawDescGZIP(), []int{13}
 }
 
-func (x *CsFetchHistoryChatResp) GetTotalPage() int64 {
+func (x *CsFetchHistoryChatResp) GetTotalPage() int32 {
 	if x != nil {
 		return x.TotalPage
 	}
 	return 0
 }
 
-func (x *CsFetchHistoryChatResp) GetCurrentPage() int64 {
+func (x *CsFetchHistoryChatResp) GetCurrentPage() int32 {
 	if x != nil {
 		return x.CurrentPage
 	}
@@ -840,8 +840,8 @@ type CsFetchHistoryMsgReq struct {
 	CsId     string `protobuf:"bytes,1,opt,name=cs_id,json=csId,proto3" json:"cs_id,omitempty"`
 	GameId   string `protobuf:"bytes,2,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
 	PlayerId string `protobuf:"bytes,3,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
-	Page     int64  `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"`
-	Limit    int64  `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
+	Page     int32  `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"`
+	Limit    int32  `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
 }
 
 func (x *CsFetchHistoryMsgReq) Reset() {
@@ -897,14 +897,14 @@ func (x *CsFetchHistoryMsgReq) GetPlayerId() string {
 	return ""
 }
 
-func (x *CsFetchHistoryMsgReq) GetPage() int64 {
+func (x *CsFetchHistoryMsgReq) GetPage() int32 {
 	if x != nil {
 		return x.Page
 	}
 	return 0
 }
 
-func (x *CsFetchHistoryMsgReq) GetLimit() int64 {
+func (x *CsFetchHistoryMsgReq) GetLimit() int32 {
 	if x != nil {
 		return x.Limit
 	}
@@ -917,8 +917,8 @@ type CsFetchHistoryMsgResp struct {
 	unknownFields protoimpl.UnknownFields
 
 	CsId        string              `protobuf:"bytes,1,opt,name=cs_id,json=csId,proto3" json:"cs_id,omitempty"`
-	TotalPage   int64               `protobuf:"varint,2,opt,name=total_page,json=totalPage,proto3" json:"total_page,omitempty"`
-	CurrentPage int64               `protobuf:"varint,3,opt,name=current_page,json=currentPage,proto3" json:"current_page,omitempty"`
+	TotalPage   int32               `protobuf:"varint,2,opt,name=total_page,json=totalPage,proto3" json:"total_page,omitempty"`
+	CurrentPage int32               `protobuf:"varint,3,opt,name=current_page,json=currentPage,proto3" json:"current_page,omitempty"`
 	List        *structpb.ListValue `protobuf:"bytes,4,opt,name=list,proto3" json:"list,omitempty"`
 }
 
@@ -961,14 +961,14 @@ func (x *CsFetchHistoryMsgResp) GetCsId() string {
 	return ""
 }
 
-func (x *CsFetchHistoryMsgResp) GetTotalPage() int64 {
+func (x *CsFetchHistoryMsgResp) GetTotalPage() int32 {
 	if x != nil {
 		return x.TotalPage
 	}
 	return 0
 }
 
-func (x *CsFetchHistoryMsgResp) GetCurrentPage() int64 {
+func (x *CsFetchHistoryMsgResp) GetCurrentPage() int32 {
 	if x != nil {
 		return x.CurrentPage
 	}
@@ -1122,20 +1122,20 @@ var file_pb_cmd_proto_rawDesc = []byte{
 	0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63,
 	0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x6e,
 	0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x0c, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
+	0x05, 0x52, 0x0c, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
 	0x7a, 0x0a, 0x18, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x46, 0x65, 0x74, 0x63, 0x68, 0x48, 0x69,
 	0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x67,
 	0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x61,
 	0x6d, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69,
 	0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49,
-	0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
 	0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x8d, 0x01, 0x0a, 0x19,
+	0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x8d, 0x01, 0x0a, 0x19,
 	0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x46, 0x65, 0x74, 0x63, 0x68, 0x48, 0x69, 0x73, 0x74, 0x6f,
 	0x72, 0x79, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x74,
-	0x61, 0x6c, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74,
+	0x61, 0x6c, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74,
 	0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72,
-	0x65, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b,
+	0x65, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b,
 	0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x6c,
 	0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
 	0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74,
@@ -1157,7 +1157,7 @@ var file_pb_cmd_proto_rawDesc = []byte{
 	0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x2d, 0x0a, 0x15, 0x43,
 	0x73, 0x46, 0x65, 0x74, 0x63, 0x68, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x51, 0x75, 0x65, 0x75,
 	0x65, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x5e, 0x0a, 0x16, 0x43, 0x73,
+	0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x5e, 0x0a, 0x16, 0x43, 0x73,
 	0x46, 0x65, 0x74, 0x63, 0x68, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x51, 0x75, 0x65, 0x75, 0x65,
 	0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20,
 	0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x69,
@@ -1174,14 +1174,14 @@ var file_pb_cmd_proto_rawDesc = []byte{
 	0x73, 0x70, 0x22, 0x56, 0x0a, 0x15, 0x43, 0x73, 0x46, 0x65, 0x74, 0x63, 0x68, 0x48, 0x69, 0x73,
 	0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x71, 0x12, 0x13, 0x0a, 0x05, 0x63,
 	0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x73, 0x49, 0x64,
-	0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04,
+	0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
 	0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x8a, 0x01, 0x0a, 0x16, 0x43,
+	0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x8a, 0x01, 0x0a, 0x16, 0x43,
 	0x73, 0x46, 0x65, 0x74, 0x63, 0x68, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61,
 	0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70,
-	0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c,
+	0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c,
 	0x50, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f,
-	0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72,
+	0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72,
 	0x65, 0x6e, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18,
 	0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
 	0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75,
@@ -1192,15 +1192,15 @@ var file_pb_cmd_proto_rawDesc = []byte{
 	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1b,
 	0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
 	0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70,
-	0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12,
-	0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
+	0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12,
+	0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
 	0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x15, 0x43, 0x73, 0x46, 0x65, 0x74, 0x63,
 	0x68, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12,
 	0x13, 0x0a, 0x05, 0x63, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
 	0x63, 0x73, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x61,
-	0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50,
+	0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50,
 	0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70,
-	0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65,
+	0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65,
 	0x6e, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x04,
 	0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
 	0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65,

+ 14 - 14
core/cmd/rpc/pb/cmd.proto

@@ -20,19 +20,19 @@ message PlayerFetchCsInfoResp{
   string cs_nickname = 2;
   string cs_avatar_url = 3;
   string cs_signature = 4;
-  int64 online_status = 5;
+  int32 online_status = 5;
 }
 
 message PlayerFetchHistoryMsgReq{
   string game_id = 1;
   string player_id = 2;
-  int64 page = 3;
-  int64 limit = 4;
+  int32 page = 3;
+  int32 limit = 4;
 }
 
 message PlayerFetchHistoryMsgResp{
-  int64 total_page = 1;
-  int64 current_page = 2;
+  int32 total_page = 1;
+  int32 current_page = 2;
   google.protobuf.ListValue list = 3;
 }
 
@@ -56,7 +56,7 @@ message PlayerDisconnectResp{}
 Cs Command Request Bean
  */
 message CsFetchPlayerQueueReq{
-  int64 limit = 1;
+  int32 limit = 1;
 }
 
 message CsFetchPlayerQueueResp{
@@ -74,13 +74,13 @@ message CsConnectPlayerResp{}
 
 message CsFetchHistoryChatReq{
   string cs_id = 1;
-  int64 page = 2;
-  int64 limit = 3;
+  int32 page = 2;
+  int32 limit = 3;
 }
 
 message CsFetchHistoryChatResp{
-  int64 total_page = 1;
-  int64 current_page = 2;
+  int32 total_page = 1;
+  int32 current_page = 2;
   google.protobuf.ListValue list = 3;
 }
 
@@ -88,14 +88,14 @@ message CsFetchHistoryMsgReq{
   string cs_id = 1;
   string game_id = 2;
   string player_id = 3;
-  int64 page = 4;
-  int64 limit = 5;
+  int32 page = 4;
+  int32 limit = 5;
 }
 
 message CsFetchHistoryMsgResp{
   string cs_id = 1;
-  int64 total_page = 2;
-  int64 current_page = 3;
+  int32 total_page = 2;
+  int32 current_page = 3;
   google.protobuf.ListValue list = 4;
 }
 

+ 1 - 1
core/inner/rpc/internal/logic/csconnectplayerlogic.go

@@ -69,7 +69,7 @@ func (l *CsConnectPlayerLogic) CsConnectPlayer(in *pb.InnerCsConnectPlayerReq) (
 		} else {
 			timeoutTs = time.Now().Unix() - playerInfo.LastChatTs
 		}
-		if timeoutTs >= 300 {
+		if timeoutTs >= 3600 {
 			// 释放计时器任务
 			_ = event.MustFire(globalkey.EventRemoveTimeoutJob, event.M{"entry_id": entryId})
 			l.Logger.Infof("trigger timeout event, remove cron job, entry id: %d", entryId)

+ 2 - 2
core/inner/rpc/internal/logic/csfetchplayerqueuelogic.go

@@ -29,7 +29,7 @@ func NewCsFetchPlayerQueueLogic(ctx context.Context, svcCtx *svc.ServiceContext)
 }
 
 func (l *CsFetchPlayerQueueLogic) CsFetchPlayerQueue(in *pb.InnerCsFetchPlayerQueueReq) (*pb.InnerCsFetchPlayerQueueResp, error) {
-	queueLen := int64(ext.WaitingList.Len())
+	queueLen := int32(ext.WaitingList.Len())
 	if queueLen == 0 {
 		// 等待队列为空直接返回
 		return &pb.InnerCsFetchPlayerQueueResp{
@@ -37,7 +37,7 @@ func (l *CsFetchPlayerQueueLogic) CsFetchPlayerQueue(in *pb.InnerCsFetchPlayerQu
 		}, nil
 	}
 
-	var index int64 = 0
+	var index int32 = 0
 	if in.Limit != 0 && in.Limit < queueLen {
 		queueLen = in.Limit
 	}

+ 11 - 7
core/inner/rpc/internal/logic/notifyuserofflinelogic.go

@@ -30,6 +30,7 @@ func NewNotifyUserOfflineLogic(ctx context.Context, svcCtx *svc.ServiceContext)
 }
 
 func (l *NotifyUserOfflineLogic) NotifyUserOffline(in *pb.NotifyUserStatusReq) (*pb.NotifyUserStatusResp, error) {
+	l.Logger.Infof("NotifyUserOffline")
 	switch in.Type {
 	case globalkey.ConnectTypePlayer:
 		// 修改玩家在线状态
@@ -39,17 +40,20 @@ func (l *NotifyUserOfflineLogic) NotifyUserOffline(in *pb.NotifyUserStatusReq) (
 			if onlinePlayerMap.Contains(in.Uid) {
 				// 有则清除,代表下线
 				onlinePlayerMap.Erase(in.Uid)
+				l.Logger.Infof("清除玩家在线状态")
 			}
 		}
 
-		for n := ext.WaitingList.FrontNode(); n != nil; n = n.Next() {
-			info := n.Value.(*model.PlayerInfo)
-			if info.GameId == in.GameId && info.PlayerId == in.Uid {
-				l.Logger.Infof("remove the player from the queue, game_id: %s, player_id: %s", in.GameId, in.Uid)
-				ext.WaitingList.Remove(nil, n)
-				break
+		go func() {
+			for n := ext.WaitingList.FrontNode(); n != nil; n = n.Next() {
+				info := n.Value.(*model.PlayerInfo)
+				if info.GameId == in.GameId && info.PlayerId == in.Uid {
+					l.Logger.Infof("remove the player from the queue, game_id: %s, player_id: %s", in.GameId, in.Uid)
+					ext.WaitingList.Remove(nil, n)
+					break
+				}
 			}
-		}
+		}()
 	case globalkey.ConnectTypeCs:
 		// 修改客服在线状态
 		if csInfo := ext.GetCsInfo(in.Uid); csInfo != nil {

+ 22 - 22
core/inner/rpc/pb/inner.pb.go

@@ -95,7 +95,7 @@ type InnerPlayerFetchCsInfoResp struct {
 	CsNickname   string `protobuf:"bytes,2,opt,name=cs_nickname,json=csNickname,proto3" json:"cs_nickname,omitempty"`
 	CsAvatarUrl  string `protobuf:"bytes,3,opt,name=cs_avatar_url,json=csAvatarUrl,proto3" json:"cs_avatar_url,omitempty"`
 	CsSignature  string `protobuf:"bytes,4,opt,name=cs_signature,json=csSignature,proto3" json:"cs_signature,omitempty"`
-	OnlineStatus int64  `protobuf:"varint,5,opt,name=online_status,json=onlineStatus,proto3" json:"online_status,omitempty"`
+	OnlineStatus int32  `protobuf:"varint,5,opt,name=online_status,json=onlineStatus,proto3" json:"online_status,omitempty"`
 }
 
 func (x *InnerPlayerFetchCsInfoResp) Reset() {
@@ -158,7 +158,7 @@ func (x *InnerPlayerFetchCsInfoResp) GetCsSignature() string {
 	return ""
 }
 
-func (x *InnerPlayerFetchCsInfoResp) GetOnlineStatus() int64 {
+func (x *InnerPlayerFetchCsInfoResp) GetOnlineStatus() int32 {
 	if x != nil {
 		return x.OnlineStatus
 	}
@@ -170,8 +170,8 @@ type InnerPlayerDisconnectReq struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	PlayerId string `protobuf:"bytes,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
-	GameId   string `protobuf:"bytes,2,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
+	GameId   string `protobuf:"bytes,1,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
+	PlayerId string `protobuf:"bytes,2,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
 }
 
 func (x *InnerPlayerDisconnectReq) Reset() {
@@ -206,16 +206,16 @@ func (*InnerPlayerDisconnectReq) Descriptor() ([]byte, []int) {
 	return file_pb_inner_proto_rawDescGZIP(), []int{2}
 }
 
-func (x *InnerPlayerDisconnectReq) GetPlayerId() string {
+func (x *InnerPlayerDisconnectReq) GetGameId() string {
 	if x != nil {
-		return x.PlayerId
+		return x.GameId
 	}
 	return ""
 }
 
-func (x *InnerPlayerDisconnectReq) GetGameId() string {
+func (x *InnerPlayerDisconnectReq) GetPlayerId() string {
 	if x != nil {
-		return x.GameId
+		return x.PlayerId
 	}
 	return ""
 }
@@ -265,7 +265,7 @@ type InnerCsFetchPlayerQueueReq struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Limit int64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
+	Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
 }
 
 func (x *InnerCsFetchPlayerQueueReq) Reset() {
@@ -300,7 +300,7 @@ func (*InnerCsFetchPlayerQueueReq) Descriptor() ([]byte, []int) {
 	return file_pb_inner_proto_rawDescGZIP(), []int{4}
 }
 
-func (x *InnerCsFetchPlayerQueueReq) GetLimit() int64 {
+func (x *InnerCsFetchPlayerQueueReq) GetLimit() int32 {
 	if x != nil {
 		return x.Limit
 	}
@@ -312,7 +312,7 @@ type InnerCsFetchPlayerQueueResp struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Total int64               `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
+	Total int32               `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
 	List  *structpb.ListValue `protobuf:"bytes,2,opt,name=list,proto3" json:"list,omitempty"`
 }
 
@@ -348,7 +348,7 @@ func (*InnerCsFetchPlayerQueueResp) Descriptor() ([]byte, []int) {
 	return file_pb_inner_proto_rawDescGZIP(), []int{5}
 }
 
-func (x *InnerCsFetchPlayerQueueResp) GetTotal() int64 {
+func (x *InnerCsFetchPlayerQueueResp) GetTotal() int32 {
 	if x != nil {
 		return x.Total
 	}
@@ -468,7 +468,7 @@ type NotifyUserStatusReq struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Type   int64  `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
+	Type   int32  `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
 	Uid    string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
 	GameId string `protobuf:"bytes,3,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
 }
@@ -505,7 +505,7 @@ func (*NotifyUserStatusReq) Descriptor() ([]byte, []int) {
 	return file_pb_inner_proto_rawDescGZIP(), []int{8}
 }
 
-func (x *NotifyUserStatusReq) GetType() int64 {
+func (x *NotifyUserStatusReq) GetType() int32 {
 	if x != nil {
 		return x.Type
 	}
@@ -587,21 +587,21 @@ var file_pb_inner_proto_rawDesc = []byte{
 	0x55, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
 	0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x73, 0x53, 0x69, 0x67,
 	0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65,
-	0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6f,
+	0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6f,
 	0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x50, 0x0a, 0x18, 0x49,
 	0x6e, 0x6e, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e,
-	0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65,
-	0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79,
-	0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18,
-	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x22, 0x1b, 0x0a,
+	0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x61, 0x6d, 0x65, 0x5f,
+	0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x49, 0x64,
+	0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x22, 0x1b, 0x0a,
 	0x19, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x73, 0x63,
 	0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x32, 0x0a, 0x1a, 0x49, 0x6e,
 	0x6e, 0x65, 0x72, 0x43, 0x73, 0x46, 0x65, 0x74, 0x63, 0x68, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
 	0x51, 0x75, 0x65, 0x75, 0x65, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69,
-	0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x63,
+	0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x63,
 	0x0a, 0x1b, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x73, 0x46, 0x65, 0x74, 0x63, 0x68, 0x50, 0x6c,
 	0x61, 0x79, 0x65, 0x72, 0x51, 0x75, 0x65, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a,
-	0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f,
+	0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f,
 	0x74, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
 	0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
 	0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x6c,
@@ -615,7 +615,7 @@ var file_pb_inner_proto_rawDesc = []byte{
 	0x65, 0x72, 0x43, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65,
 	0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x54, 0x0a, 0x13, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55,
 	0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04,
-	0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
+	0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
 	0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
 	0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20,
 	0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x22, 0x16, 0x0a, 0x14, 0x4e,

+ 6 - 7
core/inner/rpc/pb/inner.proto

@@ -20,12 +20,12 @@ message InnerPlayerFetchCsInfoResp{
   string cs_nickname = 2;
   string cs_avatar_url = 3;
   string cs_signature = 4;
-  int64 online_status = 5;
+  int32 online_status = 5;
 }
 
 message InnerPlayerDisconnectReq{
-  string player_id = 1;
-  string game_id = 2;
+  string game_id = 1;
+  string player_id = 2;
 }
 
 message InnerPlayerDisconnectResp{}
@@ -34,11 +34,11 @@ message InnerPlayerDisconnectResp{}
 Cs Command Request Bean
  */
 message InnerCsFetchPlayerQueueReq {
-  int64 limit = 1;
+  int32 limit = 1;
 }
 
 message InnerCsFetchPlayerQueueResp{
-  int64 total = 1;
+  int32 total = 1;
   google.protobuf.ListValue list = 2;
 }
 
@@ -50,9 +50,8 @@ message InnerCsConnectPlayerReq{
 
 message InnerCsConnectPlayerResp{}
 
-
 message NotifyUserStatusReq{
-  int64 type = 1;
+  int32 type = 1;
   string uid = 2;
   string game_id = 3;
 }

+ 0 - 2
flowsrv/rpc/internal/logic/connectlogic.go

@@ -63,7 +63,6 @@ func (l *ConnectLogic) Connect(in *pb.CommandReq, stream pb.Flowsrv_ConnectServe
 		EndFlow: make(chan int),
 		Message: make(chan string),
 		Stream:  stream,
-		Ctx:     l.ctx,
 		SvcCtx:  l.svcCtx,
 		Logger:  l.Logger,
 		Type:    in.Type,
@@ -79,7 +78,6 @@ func (l *ConnectLogic) Connect(in *pb.CommandReq, stream pb.Flowsrv_ConnectServe
 	mgr.GetFlowMgrInstance().Register(flow)
 
 	<-flow.EndFlow
-	l.Logger.Infof("end flow")
 	return nil
 }
 

+ 38 - 17
flowsrv/rpc/internal/mgr/flowmgr.go

@@ -5,10 +5,14 @@
 package mgr
 
 import (
+	"context"
 	treemap "github.com/liyue201/gostl/ds/map"
+	"github.com/zeromicro/go-zero/core/logx"
 	"sync"
 	"time"
+	"ylink/comm/ctxdata"
 	"ylink/comm/result"
+	"ylink/comm/trace"
 	"ylink/core/inner/rpc/inner"
 	"ylink/flowsrv/rpc/internal/model"
 	"ylink/flowsrv/rpc/pb"
@@ -46,11 +50,7 @@ func (manager *flowManager) registerFlow(flow *model.Flow) {
 			if manager.Has(flow.FlowId) {
 				flow.Logger.Infof("stream was disconnected abnormally")
 				manager.UnRegister(flow.FlowId)
-				flow.SvcCtx.InnerRpc.NotifyUserOffline(flow.Ctx, &inner.NotifyUserStatusReq{
-					Type:   flow.Type,
-					Uid:    flow.Uid,
-					GameId: flow.GameId,
-				})
+				manager.handleUserOffline(flow)
 			}
 			flow.EndFlow <- 1
 			return
@@ -70,20 +70,41 @@ func (manager *flowManager) registerFlow(flow *model.Flow) {
 }
 
 func (manager *flowManager) subscribeRmq(flow *model.Flow) {
-	for {
-		select {
-		case <-flow.Stream.Context().Done():
-			flow.Logger.Infof("unsubscribe rmq...")
-			return
-		default:
-			resultCmd := flow.SvcCtx.RedisClient.BRPop(flow.Ctx, 10*time.Second, flow.FlowId)
-			if message, err := resultCmd.Result(); err != nil {
-				flow.Logger.Errorf("get message from redis, key: %s, err: %v", flow.FlowId, err)
-			} else {
-				flow.Message <- message[1]
+	traceId := ctxdata.GetTraceIdFromCtx(flow.Stream.Context())
+	trace.RunOnTracing(traceId, func(ctx context.Context) {
+		for {
+			select {
+			case <-flow.Stream.Context().Done():
+				logx.WithContext(ctx).Infof("unsubscribe rmq...")
+				return
+			default:
+				resultCmd := flow.SvcCtx.RedisClient.BRPop(ctx, 30*time.Second, flow.FlowId)
+				if message, err := resultCmd.Result(); err != nil {
+					logx.WithContext(ctx).Errorf("get message from redis, key: %s, err: %v", flow.FlowId, err)
+				} else {
+					trace.StartTrace(ctx, "FlowsrvServer.flowmgr.handleRmqMessage", func(ctx context.Context) {
+						flow.Message <- message[1]
+					})
+				}
 			}
 		}
-	}
+	})
+}
+
+func (manager *flowManager) handleUserOffline(flow *model.Flow) {
+	traceId := ctxdata.GetTraceIdFromCtx(flow.Stream.Context())
+	trace.RunOnTracing(traceId, func(ctx context.Context) {
+		trace.StartTrace(ctx, "FlowsrvServer.flowmgr.handleUserOffline", func(ctx context.Context) {
+			_, err := flow.SvcCtx.InnerRpc.NotifyUserOffline(ctx, &inner.NotifyUserStatusReq{
+				Type:   flow.Type,
+				Uid:    flow.Uid,
+				GameId: flow.GameId,
+			})
+			if err != nil {
+				logx.WithContext(ctx).Errorf("notify user offline has some error: %v", err)
+			}
+		})
+	})
 }
 
 func (manager *flowManager) Get(flowId string) *model.Flow {

+ 1 - 3
flowsrv/rpc/internal/model/bean.go

@@ -5,7 +5,6 @@
 package model
 
 import (
-	"context"
 	"github.com/zeromicro/go-zero/core/logx"
 	"ylink/flowsrv/rpc/internal/svc"
 	"ylink/flowsrv/rpc/pb"
@@ -14,11 +13,10 @@ import (
 type Flow struct {
 	EndFlow chan int
 	Message chan string
-	Ctx     context.Context
 	SvcCtx  *svc.ServiceContext
 	Logger  logx.Logger
 	Stream  pb.Flowsrv_ConnectServer
-	Type    int64
+	Type    int32
 	Uid     string
 	GameId  string
 	FlowId  string

+ 2 - 1
flowsrv/rpc/internal/svc/servicecontext.go

@@ -105,6 +105,7 @@ func (s *ServiceContext) handleMessage(sess sarama.ConsumerGroupSession, msg *sa
 			logx.Errorf("unmarshal msg error: %v", err)
 			return
 		}
+		logx.WithContext(ctx).Infof("handle message: %s", msg.Value)
 		trace.StartTrace(ctx, "FlowsrvServer.handleMessage.PushMessage", func(ctx context.Context) {
 			// 投递到receiver_id对应的redis队列暂存
 			intCmd := s.RedisClient.LPush(ctx, message.ReceiverId, string(msg.Value))
@@ -129,8 +130,8 @@ func (s *ServiceContext) handleCommand(sess sarama.ConsumerGroupSession, msg *sa
 			logx.Errorf("unmarshal msg error: %v", err)
 			return
 		}
+		logx.WithContext(ctx).Infof("handle command: %s", msg.Value)
 		trace.StartTrace(ctx, "FlowsrvServer.handleCommand.PushMessage", func(ctx context.Context) {
-
 			// 投递到receiver_id对应的redis队列暂存
 			intCmd := s.RedisClient.LPush(ctx, message.ReceiverId, string(msg.Value))
 			if size, err := intCmd.Result(); err != nil {

+ 6 - 6
flowsrv/rpc/pb/flowsrv.pb.go

@@ -26,7 +26,7 @@ type CommandReq struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Type        int64  `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
+	Type        int32  `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"`
 	AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
 }
 
@@ -62,7 +62,7 @@ func (*CommandReq) Descriptor() ([]byte, []int) {
 	return file_pb_flowsrv_proto_rawDescGZIP(), []int{0}
 }
 
-func (x *CommandReq) GetType() int64 {
+func (x *CommandReq) GetType() int32 {
 	if x != nil {
 		return x.Type
 	}
@@ -81,7 +81,7 @@ type CommandResp struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Code int64  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
+	Code int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
 	Msg  string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
 	Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
 }
@@ -118,7 +118,7 @@ func (*CommandResp) Descriptor() ([]byte, []int) {
 	return file_pb_flowsrv_proto_rawDescGZIP(), []int{1}
 }
 
-func (x *CommandResp) GetCode() int64 {
+func (x *CommandResp) GetCode() int32 {
 	if x != nil {
 		return x.Code
 	}
@@ -146,12 +146,12 @@ var file_pb_flowsrv_proto_rawDesc = []byte{
 	0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
 	0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70,
 	0x72, 0x6f, 0x74, 0x6f, 0x22, 0x43, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
-	0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+	0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
 	0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
 	0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63,
 	0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x47, 0x0a, 0x0b, 0x43, 0x6f, 0x6d,
 	0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03,
 	0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x12,
 	0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61,
 	0x74, 0x61, 0x32, 0x37, 0x0a, 0x07, 0x46, 0x6c, 0x6f, 0x77, 0x73, 0x72, 0x76, 0x12, 0x2c, 0x0a,

+ 2 - 2
flowsrv/rpc/pb/flowsrv.proto

@@ -8,12 +8,12 @@ import "google/protobuf/struct.proto";
 
 
 message CommandReq {
-  int64 type = 1;
+  int32 type = 1;
   string access_token = 2;
 }
 
 message CommandResp {
-  int64 code = 1;
+  int32 code = 1;
   string  msg = 2;
   bytes data = 3;
 }