mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-07-12 16:13:29 +08:00
update area_code
This commit is contained in:
parent
ae00605f22
commit
e37cea2d64
@ -69,36 +69,33 @@ func (u *UserMgo) UpdateByMap(ctx context.Context, userID string, args map[strin
|
|||||||
if err := mongoutil.UpdateOne(ctx, u.coll, filter, update, true); err != nil {
|
if err := mongoutil.UpdateOne(ctx, u.coll, filter, update, true); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
// Keep user attributes in sync for consumers that read from the "attribute" collection.
|
// Keep user attributes in sync for consumers that read from the "attribute" collection.
|
||||||
// Only sync the allowed attribute fields.
|
// Only sync the allowed attribute fields.
|
||||||
//attributeSet := make(map[string]any)
|
attributeSet := make(map[string]any)
|
||||||
//for _, key := range []string{
|
for _, key := range []string{
|
||||||
// "nickname",
|
"nickname",
|
||||||
// "first_name",
|
"first_name",
|
||||||
// "last_name",
|
"last_name",
|
||||||
// "full_name",
|
"full_name",
|
||||||
// "remark",
|
"remark",
|
||||||
// "face_url",
|
"face_url",
|
||||||
// "phone_number",
|
"phone_number",
|
||||||
// "area_code",
|
"area_code",
|
||||||
//} {
|
} {
|
||||||
// if v, ok := args[key]; ok {
|
if v, ok := args[key]; ok {
|
||||||
// attributeSet[key] = v
|
attributeSet[key] = v
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//// user collection uses "phone"; attribute collection uses "phone_number".
|
//// user collection uses "phone"; attribute collection uses "phone_number".
|
||||||
//if v, ok := args["phone"]; ok {
|
if v, ok := args["phone"]; ok {
|
||||||
// attributeSet["phone_number"] = v
|
attributeSet["phone_number"] = v
|
||||||
//}
|
}
|
||||||
//if len(attributeSet) == 0 {
|
if len(attributeSet) == 0 {
|
||||||
// return nil
|
return nil
|
||||||
//}
|
}
|
||||||
|
|
||||||
//attributeColl := u.coll.Database().Collection("attribute")
|
attributeColl := u.coll.Database().Collection("attribute")
|
||||||
//return mongoutil.UpdateOne(ctx, attributeColl, filter, bson.M{"$set": attributeSet}, true)
|
return mongoutil.UpdateOne(ctx, attributeColl, filter, bson.M{"$set": attributeSet}, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserMgo) Find(ctx context.Context, userIDs []string) (users []*model.User, err error) {
|
func (u *UserMgo) Find(ctx context.Context, userIDs []string) (users []*model.User, err error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user