@@ -7,5 +7,5 @@ import ( | |||||
type UserVirtualCoinFlowDao interface { | type UserVirtualCoinFlowDao interface { | ||||
UserVirtualCoinFlowInsertBySession(session *xorm.Session, UserVirtualCoinFlow *model.UserVirtualCoinFlow) (int64, error) | UserVirtualCoinFlowInsertBySession(session *xorm.Session, UserVirtualCoinFlow *model.UserVirtualCoinFlow) (int64, error) | ||||
UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool) ([]model.UserVirtualCoinFlow, int64, error) | |||||
UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool, transferType int) ([]model.UserVirtualCoinFlow, int64, error) | |||||
} | } |
@@ -5,4 +5,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type VirtualCoinDao interface { | type VirtualCoinDao interface { | ||||
//TODO:: You can add specific method definitions here | //TODO:: You can add specific method definitions here | ||||
VirtualCoinFindAll() ([]model.VirtualCoin, error) | VirtualCoinFindAll() ([]model.VirtualCoin, error) | ||||
VirtualCoinGetOneByParams(params map[string]interface{}) (*model.VirtualCoin, error) | |||||
} | } |
@@ -22,7 +22,7 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowInsertBySession(session *xorm. | |||||
return UserVirtualCoinFlow.Id, nil | return UserVirtualCoinFlow.Id, nil | ||||
} | } | ||||
func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool) ([]model.UserVirtualCoinFlow, int64, error) { | |||||
func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool, transferType int) ([]model.UserVirtualCoinFlow, int64, error) { | |||||
var m []model.UserVirtualCoinFlow | var m []model.UserVirtualCoinFlow | ||||
session := u.Db.Where("uid = ?", uid).And("coin_id = ?", coinID) | session := u.Db.Where("uid = ?", uid).And("coin_id = ?", coinID) | ||||
if startAt != "" && endAt != "" { | if startAt != "" && endAt != "" { | ||||
@@ -31,6 +31,9 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSi | |||||
if direction != 0 { | if direction != 0 { | ||||
session = session.And("direction = ?", direction) | session = session.And("direction = ?", direction) | ||||
} | } | ||||
if transferType != 0{ | |||||
session = session.And("type = ?", type) | |||||
} | |||||
session = session.Limit(pageSize, (page-1)*pageSize) | session = session.Limit(pageSize, (page-1)*pageSize) | ||||
if isAsc { | if isAsc { | ||||
session = session.Asc("create_at") | session = session.Asc("create_at") | ||||
@@ -4,6 +4,7 @@ import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | ||||
"fmt" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -23,3 +24,12 @@ func (v VirtualCoinDb) VirtualCoinFindAll() ([]model.VirtualCoin, error) { | |||||
} | } | ||||
return m, nil | return m, nil | ||||
} | } | ||||
func (v VirtualCoinDb) VirtualCoinGetOneByParams(params map[string]interface{}) (*model.VirtualCoin, error) { | |||||
var m model.VirtualCoin | |||||
var query = fmt.Sprintf("%s = ?", params["key"]) | |||||
if has, err := v.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return &m, nil | |||||
} |