|
|
@@ -83,12 +83,26 @@ func DealUserGreenCoinDoubleChainIntegral(Db *xorm.Engine, uid int, amount, ordI |
|
|
|
} |
|
|
|
var sonUserIds []int |
|
|
|
for _, v := range *sonUserRelates { |
|
|
|
sonUserIds = append(sonUserIds, v.Uid) |
|
|
|
if v.Uid != uid { |
|
|
|
sonUserIds = append(sonUserIds, v.Uid) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
users, err := db.DbsUserFindByIds(Db, sonUserIds) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
var userIds []int |
|
|
|
for _, v := range *users { |
|
|
|
if v.Level >= 2 { |
|
|
|
//TODO::暂时写死(至少是银卡会员等级才能兑换) |
|
|
|
userIds = append(userIds, v.Uid) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//5、查询上级直推的所有下级用户的虚拟币金额是否有大于当前用户的 |
|
|
|
var sonUserVirtualWallet model.UserVirtualAmount |
|
|
|
isHas, err := session.Where(" coin_id = ? and amount >=?", greenCoinDoubleChain.Coin2, amount).And("uid != ?", uid).In("uid", sonUserIds).Get(&sonUserVirtualWallet) |
|
|
|
isHas, err := session.Where(" coin_id = ? and amount >=?", greenCoinDoubleChain.Coin2, amount).In("uid", userIds).Get(&sonUserVirtualWallet) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|