|
@@ -104,16 +104,18 @@ class PaySuccess extends BaseService
|
|
|
|
|
|
//积分不足
|
|
|
if ($payType == OrderPayTypeEnum::EXCHANGE) {
|
|
|
- if ($this->user['accumulate_points'] < $this->model['total_price']) {
|
|
|
+ $rate = SettingModel::getItem('points_rate')['points_2_money'];
|
|
|
+
|
|
|
+ $points = bcmul($this->model['total_price'],$rate,0);
|
|
|
+
|
|
|
+ if ($this->user['accumulate_points'] < $points) {
|
|
|
$this->error = '用户积分不足,无法兑换成功';
|
|
|
return false;
|
|
|
}
|
|
|
- $this->model->transaction(function () use ($payType, $payData) {
|
|
|
+ $this->model->transaction(function () use ($payType, $payData, $points) {
|
|
|
// 更新订单状态
|
|
|
$this->updateOrderInfo($payType, $payData);
|
|
|
//扣除用户积分
|
|
|
- $rate = SettingModel::getItem('points_rate')['points_2_money'];
|
|
|
- $points = bcmul($this->model['total_price'],$rate,0);
|
|
|
UserModel::setDecAccumulatePoints($this->user['user_id'], $points,AccumulatePointsScene::CONSUME,'兑换商品');
|
|
|
// 记录订单支付信息
|
|
|
$this->updatePayInfo($payType);
|