Browse Source

update 绿色双链积分

master
DengBiao 9 months ago
parent
commit
46cde736ec
2 changed files with 18 additions and 0 deletions
  1. +9
    -0
      db/dbs_user.go
  2. +9
    -0
      rule/green_coin_double_chain_settlement.go

+ 9
- 0
db/dbs_user.go View File

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


+ 9
- 0
rule/green_coin_double_chain_settlement.go View File

@@ -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() {


Loading…
Cancel
Save