|
|
@@ -38,9 +38,19 @@ func (u UserVirtualAmountDb) GetUserVirtualWalletBySession(uid int64, coinId int |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserVirtualAmountDb) UserVirtualAmountFindAndCountByCoinKind(coinID int, page, pageSize int) ([]model.UserVirtualAmount, int64, error) { |
|
|
|
func (u UserVirtualAmountDb) UserVirtualAmountFindAndCountByCoinKind(coinID int, page, pageSize int, startCoin, endCoin string, uid int) ([]model.UserVirtualAmount, int64, error) { |
|
|
|
var userVirtualWallets []model.UserVirtualAmount |
|
|
|
total, err := u.Db.Where("coin_id = ?", coinID).Limit(pageSize, (page-1)*pageSize).Desc("amount").FindAndCount(&userVirtualWallets) |
|
|
|
sess := u.Db.Where("coin_id = ?", coinID) |
|
|
|
if startCoin != "" { |
|
|
|
sess.And("amount>=?", startCoin) |
|
|
|
} |
|
|
|
if endCoin != "" { |
|
|
|
sess.And("amount<=?", endCoin) |
|
|
|
} |
|
|
|
if uid == -1 || uid > 0 { |
|
|
|
sess.And("uid=?", uid) |
|
|
|
} |
|
|
|
total, err := sess.Limit(pageSize, (page-1)*pageSize).Desc("amount").FindAndCount(&userVirtualWallets) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|