mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 19:02:31 +08:00
update user command
This commit is contained in:
parent
e0d17df248
commit
5eec833c74
@ -375,13 +375,17 @@ func (s *userServer) ProcessUserCommandGet(ctx context.Context, req *pbuser.Proc
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new map with the required type
|
// Create a slice to store CommandInfoResp
|
||||||
commandPointers := make(map[string]*pbuser.CommandInfo)
|
var commandInfoSlice []*pbuser.CommandInfoResp
|
||||||
for k, v := range commands {
|
|
||||||
vCopy := v // Create a copy of v
|
for _, v := range commands {
|
||||||
commandPointers[k] = &vCopy
|
commandInfoSlice = append(commandInfoSlice, &pbuser.CommandInfoResp{
|
||||||
|
Uuid: v.Uuid,
|
||||||
|
Value: v.Value,
|
||||||
|
CreateTime: v.CreateTime,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the new map
|
// Return the new slice
|
||||||
return &pbuser.ProcessUserCommandGetResp{UuidValue: commandPointers}, nil
|
return &pbuser.ProcessUserCommandGetResp{KVArray: commandInfoSlice}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,7 @@ func (u *UserMgo) GetUserCommands(ctx context.Context, userID string, Type int32
|
|||||||
var document struct {
|
var document struct {
|
||||||
UUID string `bson:"uuid"`
|
UUID string `bson:"uuid"`
|
||||||
Value string `bson:"value"`
|
Value string `bson:"value"`
|
||||||
CreateTime int64 `bson:"createTime"`
|
CreateTime int64 `bson:"time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cursor.Decode(&document); err != nil {
|
if err := cursor.Decode(&document); err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user