fix: issues
This commit is contained in:
@@ -413,3 +413,28 @@ func (svc *Service) SetTenantBindUserID(ctx context.Context, tenantID, adminUser
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBalanceHistory
|
||||
func (svc *Service) GetBalanceHistory(ctx context.Context, tenantID, userID int64) ([]model.UserBalanceHistories, error) {
|
||||
log := svc.log.WithField("method", "GetBalanceHistory")
|
||||
|
||||
tbl := table.UserBalanceHistories
|
||||
stmt := tbl.
|
||||
SELECT(
|
||||
tbl.AllColumns,
|
||||
).
|
||||
WHERE(
|
||||
tbl.TenantID.EQ(Int64(tenantID)).AND(tbl.UserID.EQ(Int64(userID))),
|
||||
).
|
||||
ORDER_BY(
|
||||
tbl.CreatedAt.DESC(),
|
||||
).
|
||||
LIMIT(20)
|
||||
log.Debug(stmt.DebugSql())
|
||||
|
||||
var items []model.UserBalanceHistories
|
||||
if err := stmt.QueryContext(ctx, db.FromContext(ctx, svc.db), &items); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to query balance history")
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user