update user command

pull/1532/head
AndrewZuo01 2 years ago
parent dcee679f48
commit 5351e4d554

@ -118,19 +118,21 @@ func (u *UserMgo) GetUserCommands(ctx context.Context, userID string, Type int32
return nil, err return nil, err
} }
defer cursor.Close(ctx) defer cursor.Close(ctx)
results := make(map[string]user.CommandInfo)
commands := make(map[string]user.CommandInfo)
for cursor.Next(ctx) { for cursor.Next(ctx) {
var result struct { var result UserCommand // Assuming UserCommand includes a map or similar structure
Key string `bson:"key"`
Value user.CommandInfo `bson:"value"`
}
err = cursor.Decode(&result) err = cursor.Decode(&result)
if err != nil { if err != nil {
return nil, err return nil, err
} }
results[result.Key] = result.Value
for key, command := range result.Commands {
commands[key] = command
} }
return results, nil }
return commands, nil
} }
func (u *UserMgo) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) { func (u *UserMgo) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) {

Loading…
Cancel
Save