|
|
@@ -3,6 +3,7 @@ |
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -33,3 +34,27 @@ func (u UserVirtualAmountDb) GetUserVirtualWalletBySession(uid int64, coinId int |
|
|
|
return &UserVirtualWallet, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserVirtualAmountDb) UserVirtualAmountFindAndCountByCoinKind(coinID int, page, pageSize int) ([]model.UserVirtualAmount, int64, error) { |
|
|
|
var userVirtualWallets []model.UserVirtualAmount |
|
|
|
session := u.Db.Where("coin_id = ?", coinID) |
|
|
|
total, err1 := session.Count(&userVirtualWallets) |
|
|
|
if err1 != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err1.Error()) |
|
|
|
} |
|
|
|
|
|
|
|
err := session.Limit(pageSize, (page-1)*pageSize).Desc("amount").Find(&userVirtualWallets) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return userVirtualWallets, total, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserVirtualAmountDb) UserVirtualAmountGetSumByCoinKind(coinId int) (float64, error) { |
|
|
|
var m model.UserVirtualAmount |
|
|
|
sum, err := u.Db.Where("coin_id = ?", coinId).Sum(m, "amount") |
|
|
|
if err != nil { |
|
|
|
return 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return sum, nil |
|
|
|
} |