mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-11 04:25:59 +08:00
Merge remote-tracking branch 'origin/superGroup' into superGroup
# Conflicts: # internal/rpc/user/user.go
This commit is contained in:
@@ -203,6 +203,10 @@ type config struct {
|
||||
Addr []string `yaml:"addr"`
|
||||
Topic string `yaml:"topic"`
|
||||
}
|
||||
MsgToMongo struct {
|
||||
Addr []string `yaml:"addr"`
|
||||
Topic string `yaml:"topic"`
|
||||
}
|
||||
Ms2pschat struct {
|
||||
Addr []string `yaml:"addr"`
|
||||
Topic string `yaml:"topic"`
|
||||
|
||||
@@ -120,8 +120,8 @@ func init() {
|
||||
})
|
||||
//DB.rdb = go_redis.NewClusterClient(&go_redis.ClusterOptions{
|
||||
// Addrs: []string{config.Config.Redis.DBAddress},
|
||||
// PoolSize: 100,
|
||||
// Password: config.Config.Redis.DBPassWord,
|
||||
// PoolSize: 50,
|
||||
//Password: config.Config.Redis.DBPassWord,
|
||||
//})
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
@@ -96,16 +96,24 @@ func GetUserNameByUserID(userID string) (string, error) {
|
||||
return user.Nickname, nil
|
||||
}
|
||||
|
||||
func UpdateUserInfo(user db.User, m ...map[string]interface{}) error {
|
||||
func UpdateUserInfo(user db.User) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dbConn.LogMode(false)
|
||||
err = dbConn.Table("users").Where("user_id=?", user.UserID).Update(&user).Error
|
||||
if len(m) > 0 {
|
||||
err = dbConn.Table("users").Where("user_id=?", user.UserID).Updates(m[0]).Error
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateUserInfoByMap(user db.User, m map[string]interface{}) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dbConn.LogMode(false)
|
||||
err = dbConn.Table("users").Where("user_id=?", user.UserID).Updates(m).Error
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user