|
|
@@ -22,7 +22,7 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowInsertBySession(session *xorm. |
|
|
|
return UserVirtualCoinFlow.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int) ([]model.UserVirtualCoinFlow, int64, error) { |
|
|
|
func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool) ([]model.UserVirtualCoinFlow, int64, error) { |
|
|
|
var m []model.UserVirtualCoinFlow |
|
|
|
session := u.Db.Where("uid = ?", uid).And("coin_id = ?", coinID) |
|
|
|
if startAt != "" && endAt != "" { |
|
|
@@ -31,8 +31,13 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSi |
|
|
|
if direction != 0 { |
|
|
|
session = session.And("direction = ?", direction) |
|
|
|
} |
|
|
|
|
|
|
|
total, err := session.Limit(pageSize, (page-1)*pageSize).Desc("create_at").FindAndCount(&m) |
|
|
|
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 |
|
|
|
} |
|
|
|