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