|
|
@@ -1499,6 +1499,10 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
|
if (isset($data['limitBuy']) && is_numeric($data['limitBuy'])) {
|
|
|
$upData['limitBuy'] = $data['limitBuy'];
|
|
|
+ //取消限购
|
|
|
+ if ($data['limitBuy'] == 0) {
|
|
|
+ self::cancelLimitBuy($id);
|
|
|
+ }
|
|
|
}
|
|
|
if (isset($data['stockWarning'])) {
|
|
|
$upData['stockWarning'] = $data['stockWarning'];
|
|
|
@@ -1862,6 +1866,10 @@ class ProductClass extends BaseClass
|
|
|
];
|
|
|
CostChangeClass::addData($changeData);
|
|
|
}
|
|
|
+ //取消限购
|
|
|
+ if (isset($params['limitBuy']) && $params['limitBuy'] == 0) {
|
|
|
+ self::cancelLimitBuy($chainProduct->id);
|
|
|
+ }
|
|
|
|
|
|
//直营店同步价格等重要因素
|
|
|
self::updateById($chainProduct->id, $params);
|
|
|
@@ -2506,4 +2514,16 @@ class ProductClass extends BaseClass
|
|
|
return $product['mainId'] ?? 0;
|
|
|
}
|
|
|
|
|
|
+ //取消限购的缓存 ssh 20240605
|
|
|
+ public static function cancelLimitBuy($productId)
|
|
|
+ {
|
|
|
+ $limitKey = 'limit_buy_' . $productId;
|
|
|
+ $arr = Yii::$app->redis->executeCommand('HKEYS', [$limitKey]);
|
|
|
+ if (!empty($arr)) {
|
|
|
+ foreach ($arr as $field) {
|
|
|
+ Yii::$app->redis->executeCommand('HDEL', [$limitKey, $field]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|