fix(charge):基本完成用户充值功能部分的测试。

This commit is contained in:
徐涛
2023-06-08 21:59:01 +08:00
parent 0c725e99a4
commit 7f43965f1c
3 changed files with 12 additions and 12 deletions

View File

@@ -401,7 +401,7 @@ func (ur _UserRepository) ChangeState(uid string, state bool) (bool, error) {
}
// 检索条目数量有限的用户详细信息
func (ur _UserRepository) SearchUsersWithLimit(userType *int16, keyword *string, limit uint) ([]*model.UserDetail, error) {
func (ur _UserRepository) SearchUsersWithLimit(userType *int16, keyword *string, limit uint) ([]*model.UserWithDetail, error) {
ur.log.Info("检索条目数量有限的用户详细信息。", zap.Int16p("user type", userType), zap.Uint("limit", limit), zap.Stringp("keyword", keyword))
actualUserType := tools.DefaultTo(userType, model.USER_TYPE_ENT)
cacheConditions := []string{
@@ -409,13 +409,13 @@ func (ur _UserRepository) SearchUsersWithLimit(userType *int16, keyword *string,
tools.DefaultTo(keyword, ""),
fmt.Sprintf("%d", limit),
}
if users, err := cache.RetrieveSearch[[]*model.UserDetail]("user_with_detail_limited", cacheConditions...); err == nil && users != nil {
if users, err := cache.RetrieveSearch[[]*model.UserWithDetail]("user_with_detail_limited", cacheConditions...); err == nil && users != nil {
return *users, nil
}
ctx, cancel := global.TimeoutContext()
defer cancel()
var users []*model.UserDetail
var users = make([]*model.UserWithDetail, 0)
userQuery := ur.ds.
From(goqu.T("user").As("u")).
Join(goqu.T("user_detail").As("ud"), goqu.On(goqu.Ex{"ud.id": goqu.I("u.id")})).
@@ -442,7 +442,7 @@ func (ur _UserRepository) SearchUsersWithLimit(userType *int16, keyword *string,
userQuery.Order(goqu.I("u.created_at").Desc()).Limit(limit)
userSql, userParams, _ := userQuery.Prepared(true).ToSQL()
if err := pgxscan.Select(ctx, global.DB, users, userSql, userParams...); err != nil {
if err := pgxscan.Select(ctx, global.DB, &users, userSql, userParams...); err != nil {
ur.log.Error("从数据库查询用户列表失败。", zap.Error(err))
return nil, err
}