Parcourir la source

update

master
shenjiachi il y a 1 semaine
Parent
révision
3abab34746
2 fichiers modifiés avec 30 ajouts et 0 suppressions
  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 Voir le fichier

@@ -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 Voir le fichier

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

Chargement…
Annuler
Enregistrer