浏览代码

积分

master
huangjiajun 1 天前
父节点
当前提交
ef2dbe4397
共有 2 个文件被更改,包括 13 次插入3 次删除
  1. +1
    -1
      src/dao/user_virtual_amount_dao.go
  2. +12
    -2
      src/implement/user_virtual_amount_implement.go

+ 1
- 1
src/dao/user_virtual_amount_dao.go 查看文件

@@ -6,7 +6,7 @@ import (

type UserVirtualAmountDao interface {
GetUserVirtualWalletBySession(uid int64, coinId int) (*model.UserVirtualAmount, error)
UserVirtualAmountFindAndCountByCoinKind(coinID int, page, pageSize int) ([]model.UserVirtualAmount, int64, error)
UserVirtualAmountFindAndCountByCoinKind(coinID int, page, pageSize int, startCoin, endCoin string, uid int) ([]model.UserVirtualAmount, int64, error)
UserVirtualAmountGetSumByCoinKind(coinId int) (float64, error)
GetUserVirtualAllWallets(uid int64) (*[]model.UserVirtualAmount, error)
UserVirtualAllWalletFindByParams(params map[string]interface{}) (*[]model.UserVirtualAmount, error)


+ 12
- 2
src/implement/user_virtual_amount_implement.go 查看文件

@@ -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())
}


正在加载...
取消
保存