Browse Source

update 绿色双链积分

master
DengBiao 9 months ago
parent
commit
6a1fd91277
1 changed files with 6 additions and 11 deletions
  1. +6
    -11
      rule/green_coin_double_chain_settlement.go

+ 6
- 11
rule/green_coin_double_chain_settlement.go View File

@@ -62,6 +62,7 @@ func DealUserGreenCoinDoubleChainIntegral(Db *xorm.Engine, uid int, ordId, maste
} }


func HandleUserGreenCoinDoubleChainIntegralByParent(Db *xorm.Engine, uid int, ordId, masterId string, greenCoinDoubleChain *model.GreenCoinDoubleChain) (err error) { func HandleUserGreenCoinDoubleChainIntegralByParent(Db *xorm.Engine, uid int, ordId, masterId string, greenCoinDoubleChain *model.GreenCoinDoubleChain) (err error) {
time.Sleep(time.Millisecond * 200) //TODO::等待100毫秒
//1、查找对应直推上级用户 //1、查找对应直推上级用户
parentUserRelate, err := db.GetUserParentUserRelate(Db, uid) parentUserRelate, err := db.GetUserParentUserRelate(Db, uid)
if err != nil { if err != nil {
@@ -130,9 +131,6 @@ func HandleUserGreenCoinDoubleChainIntegralByParent(Db *xorm.Engine, uid int, or
} }
}() }()
for _, v := range sonUserVirtualWallet { for _, v := range sonUserVirtualWallet {
if lastUid == -1 {
break
}


userAmount, _ := decimal.NewFromString(v.Amount) userAmount, _ := decimal.NewFromString(v.Amount)
if amount == "" { if amount == "" {
@@ -264,13 +262,13 @@ func HandleUserGreenCoinDoubleChainIntegralByParent(Db *xorm.Engine, uid int, or
} }


if zhios_order_relate_utils.StrToFloat64(afterUserCoinAmount) == 0 { if zhios_order_relate_utils.StrToFloat64(afterUserCoinAmount) == 0 {
lastUid = -1
break
} else { } else {
amount = afterCoinAmountContributeUser1 amount = afterCoinAmountContributeUser1
lastUid = v.Uid lastUid = v.Uid
} }
if zhios_order_relate_utils.StrToFloat64(amount) == 0 { if zhios_order_relate_utils.StrToFloat64(amount) == 0 {
break
amount = ""
} }
} }
session.Commit() session.Commit()
@@ -278,6 +276,7 @@ func HandleUserGreenCoinDoubleChainIntegralByParent(Db *xorm.Engine, uid int, or
} }


func HandleUserGreenCoinDoubleChainIntegralBySon(Db *xorm.Engine, uid int, ordId, masterId string, greenCoinDoubleChain *model.GreenCoinDoubleChain) (err error) { func HandleUserGreenCoinDoubleChainIntegralBySon(Db *xorm.Engine, uid int, ordId, masterId string, greenCoinDoubleChain *model.GreenCoinDoubleChain) (err error) {
time.Sleep(time.Millisecond * 200) //TODO::等待100毫秒
//1、查询对应上级的虚拟币余额 //1、查询对应上级的虚拟币余额
parentAmount, err := svc.GetUserCoinAmount(Db.NewSession(), masterId, greenCoinDoubleChain.Coin1, uid) parentAmount, err := svc.GetUserCoinAmount(Db.NewSession(), masterId, greenCoinDoubleChain.Coin1, uid)
if err != nil { if err != nil {
@@ -337,10 +336,6 @@ func HandleUserGreenCoinDoubleChainIntegralBySon(Db *xorm.Engine, uid int, ordId
}() }()
for _, v := range sonUserVirtualWallet { for _, v := range sonUserVirtualWallet {


if lastUid == -1 {
break
}

userAmount, _ := decimal.NewFromString(v.Amount) userAmount, _ := decimal.NewFromString(v.Amount)
if amount == "" { if amount == "" {
amount = userAmount.String() amount = userAmount.String()
@@ -469,13 +464,13 @@ func HandleUserGreenCoinDoubleChainIntegralBySon(Db *xorm.Engine, uid int, ordId
} }


if zhios_order_relate_utils.StrToFloat64(afterUserCoinAmount) == 0 { if zhios_order_relate_utils.StrToFloat64(afterUserCoinAmount) == 0 {
lastUid = -1
break
} else { } else {
amount = afterCoinAmountContributeUser1 amount = afterCoinAmountContributeUser1
lastUid = v.Uid lastUid = v.Uid
} }
if zhios_order_relate_utils.StrToFloat64(amount) == 0 { if zhios_order_relate_utils.StrToFloat64(amount) == 0 {
break
amount = ""
} }
} }
session.Commit() session.Commit()


Loading…
Cancel
Save