feat: merge v3dev into main

This commit is contained in:
Gordon
2023-07-12 15:12:23 +08:00
123 changed files with 7377 additions and 10288 deletions
+10 -4
View File
@@ -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(