正在显示
3 个修改的文件
包含
11 行增加
和
3 行删除
@@ -400,6 +400,14 @@ class Cart extends Api | @@ -400,6 +400,14 @@ class Cart extends Api | ||
400 | (new Goods)->allowField(true)->isUpdate()->saveAll($goodsSave); | 400 | (new Goods)->allowField(true)->isUpdate()->saveAll($goodsSave); |
401 | // 更新商品规格库存 | 401 | // 更新商品规格库存 |
402 | (new GoodsSpec)->allowField(true)->isUpdate()->saveAll($goodsSpecSave); | 402 | (new GoodsSpec)->allowField(true)->isUpdate()->saveAll($goodsSpecSave); |
403 | + // 订单支付-赠送积分 | ||
404 | + if($order['order_price'] > 0){ | ||
405 | + $sendscore = config('site.sendscore'); // 消费多少元赠送1积分 | ||
406 | + $score = bcdiv($order['order_price'],$sendscore); // 赠送积分 | ||
407 | + if($score >= 1){ | ||
408 | + \app\common\model\User::score($score,$order['user_id'],'订单支付-赠送积分'); | ||
409 | + } | ||
410 | + } | ||
403 | return true; | 411 | return true; |
404 | } | 412 | } |
405 | } | 413 | } |
@@ -274,7 +274,7 @@ class Cart extends Model | @@ -274,7 +274,7 @@ class Cart extends Model | ||
274 | $score['use_score'] = $user['score']; | 274 | $score['use_score'] = $user['score']; |
275 | }else{ | 275 | }else{ |
276 | $score['score_price'] = $sub_price; | 276 | $score['score_price'] = $sub_price; |
277 | - $score['use_score'] = bcmul($sub_price,$scoreprice,0); | 277 | + $score['use_score'] = bcmul($sub_price,$scoreprice); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | // 优惠金额 | 280 | // 优惠金额 |
@@ -157,8 +157,8 @@ class Order extends Model | @@ -157,8 +157,8 @@ class Order extends Model | ||
157 | UserCoupon::where('id',$order['coupon']['user_coupon_id'])->setField('status','2'); | 157 | UserCoupon::where('id',$order['coupon']['user_coupon_id'])->setField('status','2'); |
158 | } | 158 | } |
159 | // 用掉积分 | 159 | // 用掉积分 |
160 | - if($order['score']['score'] > 0){ | ||
161 | - User::score(-$order['score']['score'],$user_id,'订单支付'); | 160 | + if($order['score']['use_score'] > 0){ |
161 | + User::score(-$order['score']['use_score'],$user_id,'订单支付-使用积分'); | ||
162 | } | 162 | } |
163 | Db::commit(); | 163 | Db::commit(); |
164 | return true; | 164 | return true; |
-
请 注册 或 登录 后发表评论