|
|
@@ -1049,7 +1049,6 @@ class ProductClass extends BaseClass
|
|
|
//addSold boolean 是否增加销量,报损和拆散不要增加销量
|
|
|
public static function decreaseStock($productId, $itemNumBundle, $itemNumPiece, $checkStock = false, $addSold = true, $params = [])
|
|
|
{
|
|
|
-
|
|
|
//小单位库存不再考虑 ssh 20230303
|
|
|
//$itemNumPiece = 0;
|
|
|
|
|
|
@@ -1128,6 +1127,7 @@ class ProductClass extends BaseClass
|
|
|
//库存=0 下架商品,特价去掉,限购去掉 lqh 2021.7.9 ssh 20251106 花材满减去掉 20260318
|
|
|
if ($newStock <= 0) {
|
|
|
self::changeStatus($productId, 2);
|
|
|
+
|
|
|
//限购数量重置为 0,但会把限购不为 0 的数据记录到缓存
|
|
|
self::createRecoverLimitBuyCache($productId, $productData->limitBuy);
|
|
|
}
|
|
|
@@ -1650,6 +1650,14 @@ class ProductClass extends BaseClass
|
|
|
util::fail("该花材不存在");
|
|
|
}
|
|
|
|
|
|
+ if (isset($data['limitBuy']) && intval($data['limitBuy']) > 0) {
|
|
|
+ if ($product->limitBuy == 0) {
|
|
|
+ $type == 'ghs' ? self::clearLimitBuyCache($id) : \bizHd\product\classes\ProductClass::clearLimitBuyCache($id);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $type == 'ghs' ? self::clearLimitBuyCache($id) : \bizHd\product\classes\ProductClass::clearLimitBuyCache($id);
|
|
|
+ }
|
|
|
+
|
|
|
//扫码收款、直接收款,不包括特价商品,不可修改,多处要同步修改 system_item
|
|
|
if (getenv('YII_ENV') == 'production') {
|
|
|
$systemItem = [78076, 80960];
|
|
|
@@ -1772,9 +1780,9 @@ class ProductClass extends BaseClass
|
|
|
//取消限购
|
|
|
if ($data['limitBuy'] == 0) {
|
|
|
if ($type == 'ghs') {
|
|
|
- self::cancelLimitBuy($id);
|
|
|
+ self::clearLimitBuyCache($id);
|
|
|
} else {
|
|
|
- \bizHd\product\classes\ProductClass::cancelLimitBuy($id);
|
|
|
+ \bizHd\product\classes\ProductClass::clearLimitBuyCache($id);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2631,13 +2639,14 @@ class ProductClass extends BaseClass
|
|
|
$data['discountPrice'] = 0;
|
|
|
$data['hjDiscountPrice'] = 0;
|
|
|
$data['skDiscountPrice'] = 0;
|
|
|
- //限购记录也取消
|
|
|
- self::cancelLimitBuy($productId);
|
|
|
+
|
|
|
//花材满减去掉 ssh 20260318
|
|
|
$data['reachNum'] = 0;
|
|
|
$data['reachNumDiscount'] = 0;
|
|
|
+
|
|
|
//花材去除限购
|
|
|
$data['limitBuy'] = 0;
|
|
|
+ // self::clearLimitBuyCache($productId); // 此处不清空限购记录缓存,留在更新库存的地方来做清空缓存
|
|
|
}
|
|
|
return self::updateById($productId, $data);
|
|
|
}
|
|
|
@@ -3140,8 +3149,12 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //取消限购的缓存 ssh 20240605
|
|
|
- public static function cancelLimitBuy($productId)
|
|
|
+ /**
|
|
|
+ * 清空限购的缓存
|
|
|
+ * @param int $productId
|
|
|
+ * @param bool $cleanAll
|
|
|
+ */
|
|
|
+ public static function clearLimitBuyCache($productId)
|
|
|
{
|
|
|
$limitKey = self::LIMIT_BUY_KEY . $productId;
|
|
|
$arr = Yii::$app->redis->executeCommand('HKEYS', [$limitKey]);
|
|
|
@@ -3150,6 +3163,7 @@ class ProductClass extends BaseClass
|
|
|
self::baseClearLimitBuy($productId, $field);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
self::clearLimitBuyClearMark($productId);
|
|
|
self::clearLimitBuyClearLoopConfig($productId);
|
|
|
}
|
|
|
@@ -3280,7 +3294,7 @@ class ProductClass extends BaseClass
|
|
|
|
|
|
$limitKey = self::RECOVER_LIMIT_BUY_KEY . $productId;
|
|
|
Yii::$app->redis->executeCommand('SET', [$limitKey, $oldLimitBuy]);
|
|
|
- Yii::$app->redis->executeCommand('EXPIRE', [$limitKey, 1200]);
|
|
|
+ //Yii::$app->redis->executeCommand('EXPIRE', [$limitKey, 1200]);// 要考虑售后退款,所以不能主动清空,而是只能被动清空
|
|
|
return true;
|
|
|
}
|
|
|
|