|
|
|
@ -239,18 +239,23 @@ class Zone |
|
|
|
|
|
|
|
# 消费金额 |
|
|
|
$consumptionBalance = 0; // 余额消费剩余金额 |
|
|
|
$balancePrice = 0; // 余额消费剩余金额 |
|
|
|
$consumptionWithdrawalBalance = 0;// 可提消费剩余金额 |
|
|
|
$withdrawalBalancePrice = 0;// 可提消费剩余金额 |
|
|
|
# 余额小于金额 且可提余额能补足 |
|
|
|
if ($userData['balance'] < $price) { |
|
|
|
|
|
|
|
if ($userData['balance'] > 0) { |
|
|
|
$balancePrice = $userData['balance']; |
|
|
|
$consumptionBalance = User::decrBalance(self::$user_id, $userData['balance']); |
|
|
|
} |
|
|
|
# 剩余余额 |
|
|
|
$residue_price = bcsub($price,$userData['balance']); |
|
|
|
$withdrawalBalancePrice = $residue_price; |
|
|
|
$consumptionWithdrawalBalance = User::decrWithdrawalBalance(self::$user_id,$residue_price); |
|
|
|
} else { |
|
|
|
$consumptionBalance = User::decrBalance(self::$user_id, $price); |
|
|
|
$balancePrice = $price; |
|
|
|
} |
|
|
|
|
|
|
|
# 判断是否中奖 |
|
|
|
@ -274,12 +279,12 @@ class Zone |
|
|
|
# 余额消费记录 - 余额大于0 |
|
|
|
if ($userData['balance'] > 0) { |
|
|
|
$otherData['actual_type'] = 1; |
|
|
|
$c_r_id = ConsumptionRecords::saveRecords(self::$user_id, self::$zone_goods_id, $price, $price, $consumptionBalance, $text_data, $otherData); |
|
|
|
$c_r_id = ConsumptionRecords::saveRecords(self::$user_id, self::$zone_goods_id, $price, $balancePrice, $consumptionBalance, $text_data, $otherData); |
|
|
|
} |
|
|
|
# 可提余额消费记录 - 余额小于金额 |
|
|
|
if ($userData['balance'] < $price) { |
|
|
|
$otherData['actual_type'] = 2; |
|
|
|
$c_r_id = ConsumptionRecords::saveRecords(self::$user_id, self::$zone_goods_id, $price, $price, $consumptionWithdrawalBalance, $text_data, $otherData); |
|
|
|
$c_r_id = ConsumptionRecords::saveRecords(self::$user_id, self::$zone_goods_id, $price, $withdrawalBalancePrice, $consumptionWithdrawalBalance, $text_data, $otherData); |
|
|
|
} |
|
|
|
|
|
|
|
# 消费返点 |
|
|
|
|