@@ -17,6 +17,15 @@ func DbsUserFindByIds(eg *xorm.Engine, uid []int) (*[]model.User, error) { | |||||
return &users, nil | return &users, nil | ||||
} | } | ||||
func DbsUserFindByUid(eg *xorm.Engine, uid int) (*model.User, error) { | |||||
var data model.User | |||||
get, err := eg.Where("uid =?", uid).Get(&data) | |||||
if get == false || err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return &data, nil | |||||
} | |||||
func DbsUserRelate(eg *xorm.Engine, uid, level int) (*[]model.UserRelate, error) { | func DbsUserRelate(eg *xorm.Engine, uid, level int) (*[]model.UserRelate, error) { | ||||
var userRelate []model.UserRelate | var userRelate []model.UserRelate | ||||
sess := eg.Where("uid = ?", uid) | sess := eg.Where("uid = ?", uid) | ||||
@@ -24,6 +24,15 @@ func InitForGreenCoinDoubleChainIntegral(redisAddr string) (err error) { | |||||
} | } | ||||
func DealUserGreenCoinDoubleChainIntegral(Db *xorm.Engine, uid int, amount, ordId, masterId string) (isExchange bool, err error) { | func DealUserGreenCoinDoubleChainIntegral(Db *xorm.Engine, uid int, amount, ordId, masterId string) (isExchange bool, err error) { | ||||
user, err := db.DbsUserFindByUid(Db, uid) | |||||
if err != nil { | |||||
return | |||||
} | |||||
if user.Level >= 2 { | |||||
//TODO::暂时写死(至少是银卡会员等级才能兑换) | |||||
return | |||||
} | |||||
amountValue, _ := decimal.NewFromString(amount) | amountValue, _ := decimal.NewFromString(amount) | ||||
session := Db.NewSession() | session := Db.NewSession() | ||||
defer func() { | defer func() { | ||||