Bladeren bron

update

master
shenjiachi 3 dagen geleden
bovenliggende
commit
3abab34746
2 gewijzigde bestanden met toevoegingen van 30 en 0 verwijderingen
  1. +1
    -0
      src/dao/user_wallet_flow_dao.go
  2. +29
    -0
      src/implement/user_wallet_flow_implement.go

+ 1
- 0
src/dao/user_wallet_flow_dao.go Bestand weergeven

@@ -8,4 +8,5 @@ import (
type UserWalletFlowDao interface {
UserWalletFlowInsertBySession(session *xorm.Session, userWalletFlow *model.UserWalletFlow) (int64, error)
UserWalletFlowFindByParams(params map[string]interface{}, page, limit int) (*[]model.UserWalletFlow, int64, error)
UserWalletFlowFindByCoinAndUser(page, pageSize int, uid int64, startAt string, endAt string, direction int, isAsc bool, kind int, state int) ([]model.UserWalletFlow, int64, error)
}

+ 29
- 0
src/implement/user_wallet_flow_implement.go Bestand weergeven

@@ -48,3 +48,32 @@ func (u UserWalletFlowDb) UserWalletFlowFindByParams(params map[string]interface
}
return &m, total, nil
}

func (u UserWalletFlowDb) UserWalletFlowFindByCoinAndUser(page, pageSize int, uid int64, startAt string, endAt string, direction int, isAsc bool, kind int, state int) ([]model.UserWalletFlow, int64, error) {
var m []model.UserWalletFlow
session := u.Db.Where("uid = ?", uid)
if startAt != "" && endAt != "" {
session = session.And("create_at >= ?", startAt).And("create_at <= ?", endAt)
}
if direction != 0 {
session = session.And("direction = ?", direction)
}
if kind != 0 {
session = session.And("kind = ?", kind)
}
if state != 0 {
session = session.And("state = ?", state)
}
session = session.Limit(pageSize, (page-1)*pageSize)
if isAsc {
session = session.Asc("create_at")
} else {
session = session.Desc("create_at")
}
total, err := session.FindAndCount(&m)
if err != nil {
return nil, 0, err
}

return m, total, nil
}

Laden…
Annuleren
Opslaan