diff --git a/db/dbs_user.go b/db/dbs_user.go index 440f088..9a69c9e 100644 --- a/db/dbs_user.go +++ b/db/dbs_user.go @@ -17,6 +17,15 @@ func DbsUserFindByIds(eg *xorm.Engine, uid []int) (*[]model.User, error) { 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) { var userRelate []model.UserRelate sess := eg.Where("uid = ?", uid) diff --git a/rule/green_coin_double_chain_settlement.go b/rule/green_coin_double_chain_settlement.go index 028d41e..f8fdba1 100644 --- a/rule/green_coin_double_chain_settlement.go +++ b/rule/green_coin_double_chain_settlement.go @@ -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) { + user, err := db.DbsUserFindByUid(Db, uid) + if err != nil { + return + } + if user.Level >= 2 { + //TODO::暂时写死(至少是银卡会员等级才能兑换) + return + } + amountValue, _ := decimal.NewFromString(amount) session := Db.NewSession() defer func() {