|
|
|
@ -691,18 +691,18 @@ class OrderOnlineService implements OrderOnlineServiceInterface |
|
|
|
$orderIds = Order::query()->where(['order_main_id' => $orderMain->global_order_id])->pluck('id'); |
|
|
|
$orderGoods = OrderGoods::query()->whereIn('order_id', $orderIds)->get()->toArray(); |
|
|
|
|
|
|
|
// 释redis库存
|
|
|
|
$redis = ApplicationContext::getContainer()->get(Redis::class); |
|
|
|
foreach ($orderGoods as $k => &$goodsItem) { |
|
|
|
// 拼接activity_type和goods_id
|
|
|
|
$inventoryKey = 'goods_inventory_sold_'.$goodsItem['activity_type'].'_'.$goodsItem['goods_id']; |
|
|
|
// redis记录当前商品的购买数量,压库存,下单失败、下单成功扣库存成功、订单取消的时候释放
|
|
|
|
if (!$redis->exists($inventoryKey)) { |
|
|
|
$redis->set($inventoryKey, 0); |
|
|
|
} else { |
|
|
|
$redis->decrBy($inventoryKey, intval($goodsItem['number'])); |
|
|
|
} |
|
|
|
} |
|
|
|
// // 释redis库存
|
|
|
|
// $redis = ApplicationContext::getContainer()->get(Redis::class);
|
|
|
|
// foreach ($orderGoods as $k => &$goodsItem) {
|
|
|
|
// // 拼接activity_type和goods_id
|
|
|
|
// $inventoryKey = 'goods_inventory_sold_'.$goodsItem['activity_type'].'_'.$goodsItem['goods_id'];
|
|
|
|
// // redis记录当前商品的购买数量,压库存,下单失败、下单成功扣库存成功、订单取消的时候释放
|
|
|
|
// if (!$redis->exists($inventoryKey)) {
|
|
|
|
// $redis->set($inventoryKey, 0);
|
|
|
|
// } else {
|
|
|
|
// $redis->decrBy($inventoryKey, intval($goodsItem['number']));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 微信退款
|
|
|
|
if ($orderMain->pay_type == Payment::WECHAT) { |
|
|
|
|