mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-17 07:19:02 +08:00
ws update
This commit is contained in:
@@ -278,6 +278,7 @@ const Token = "token"
|
||||
const RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数
|
||||
const CheckKey = "CheckKey"
|
||||
const TriggerID = "triggerID"
|
||||
const RemoteAddr = "remoteAddr"
|
||||
|
||||
const (
|
||||
UnreliableNotification = 1
|
||||
|
||||
@@ -148,6 +148,8 @@ func (l *ZapLogger) kvAppend(ctx context.Context, keysAndValues []interface{}) [
|
||||
opUserID := mcontext.GetOpUserID(ctx)
|
||||
connID := mcontext.GetConnID(ctx)
|
||||
triggerID := mcontext.GetTriggerID(ctx)
|
||||
opUserPlatform := mcontext.GetOpUserPlatform(ctx)
|
||||
remoteAddr := mcontext.GetRemoteAddr(ctx)
|
||||
if opUserID != "" {
|
||||
keysAndValues = append([]interface{}{constant.OpUserID, opUserID}, keysAndValues...)
|
||||
}
|
||||
@@ -160,6 +162,12 @@ func (l *ZapLogger) kvAppend(ctx context.Context, keysAndValues []interface{}) [
|
||||
if triggerID != "" {
|
||||
keysAndValues = append([]interface{}{constant.TriggerID, triggerID}, keysAndValues...)
|
||||
}
|
||||
if opUserPlatform != "" {
|
||||
keysAndValues = append([]interface{}{constant.OpUserPlatform, opUserPlatform}, keysAndValues...)
|
||||
}
|
||||
if remoteAddr != "" {
|
||||
keysAndValues = append([]interface{}{constant.RemoteAddr, remoteAddr}, keysAndValues...)
|
||||
}
|
||||
return keysAndValues
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,15 @@ func GetOpUserPlatform(ctx context.Context) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
func GetRemoteAddr(ctx context.Context) string {
|
||||
if ctx.Value(constant.RemoteAddr) != "" {
|
||||
s, ok := ctx.Value(constant.RemoteAddr).(string)
|
||||
if ok {
|
||||
return s
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetMustCtxInfo(ctx context.Context) (operationID, opUserID, platform, connID string, err error) {
|
||||
operationID, ok := ctx.Value(constant.OperationID).(string)
|
||||
|
||||
Reference in New Issue
Block a user