Browse Source

特价商品库存不足条件判断 加上redis压的库存

master
Lemon 5 years ago
parent
commit
030aa91c0a
  1. 5
      app/Model/v3/GoodsActivity.php

5
app/Model/v3/GoodsActivity.php

@ -87,9 +87,12 @@ class GoodsActivity extends Model
{ {
$msg = ''; $msg = '';
// 获取冻结的库存
$inventoryFrozen = $this->goodsInventoryService->getSold(2, $this->attributes['id']);
if ($this->attributes['expire_time'] < time()) { if ($this->attributes['expire_time'] < time()) {
$msg = '已结束'; $msg = '已结束';
} elseif ($this->attributes['inventory'] <= 0 && $this->attributes['is_infinite'] != 1) {
} elseif ($this->attributes['inventory'] <= $inventoryFrozen && $this->attributes['is_infinite'] != 1) {
$msg = '已抢光'; $msg = '已抢光';
} }
return $msg; return $msg;

Loading…
Cancel
Save