|
@@ -783,12 +783,12 @@ class StoreOrder extends BaseModel
|
|
|
UserBill::expend('购买商品', $order['uid'], 'now_money', 'pay_money', $order['pay_price'], $order['id'], $now_money, '支付' . floatval($order['pay_price']) . '元购买商品');
|
|
|
//支付成功后
|
|
|
event('OrderPaySuccess', [$order, $formId]);
|
|
|
- $order_price = self::where('uid', $order['uid'])->sum('pay_price');
|
|
|
+ $order_price = self::where('uid', $order['uid'])->where('paid', 1)->sum('pay_price');
|
|
|
|
|
|
$x = 10000 * floor($order_price/10000);
|
|
|
if ($x > 0){
|
|
|
- if (!UserBonus::where('uid', $order['uid'])->where('integral', $x)->find()){
|
|
|
- $py = UserBonus::where('uid', $order['uid'])->sum('integral');
|
|
|
+ $py = UserBonus::where('uid', $order['uid'])->sum('integral');
|
|
|
+ if (!UserBonus::where('uid', $order['uid'])->where('integral', $x)->find() and $x - $py > 0){
|
|
|
UserBonus::create([
|
|
|
'uid' => $order['uid'],
|
|
|
'integral' => $x - $py,
|