mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 02:26:00 +08:00
feat: merge v3dev into main
This commit is contained in:
@@ -41,7 +41,7 @@ func (u *UserGorm) Create(ctx context.Context, users []*relation.UserModel) (err
|
||||
|
||||
// 更新用户信息 零值
|
||||
func (u *UserGorm) UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) {
|
||||
return utils.Wrap(u.db(ctx).Where("user_id = ?", userID).Updates(args).Error, "")
|
||||
return utils.Wrap(u.db(ctx).Model(&relation.UserModel{}).Where("user_id = ?", userID).Updates(args).Error, "")
|
||||
}
|
||||
|
||||
// 更新多个用户信息 非零值
|
||||
@@ -94,9 +94,15 @@ func (u *UserGorm) GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (
|
||||
return opt, err
|
||||
}
|
||||
|
||||
func (u *UserGorm) CountTotal(ctx context.Context) (count int64, err error) {
|
||||
err = u.db(ctx).Model(&relation.UserModel{}).Count(&count).Error
|
||||
return count, errs.Wrap(err)
|
||||
func (u *UserGorm) CountTotal(ctx context.Context, before *time.Time) (count int64, err error) {
|
||||
db := u.db(ctx).Model(&relation.UserModel{})
|
||||
if before != nil {
|
||||
db = db.Where("create_time < ?", before)
|
||||
}
|
||||
if err := db.Count(&count).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (u *UserGorm) CountRangeEverydayTotal(
|
||||
|
||||
Reference in New Issue
Block a user