|
|
@@ -38,7 +38,7 @@ class ProductClass extends BaseClass
|
|
|
use OrderTrait;
|
|
|
|
|
|
public static $baseFile = '\bizGhs\product\models\Product';
|
|
|
-
|
|
|
+
|
|
|
const PRICE_LABEL_AUTO = 1; //自动调价
|
|
|
const PRICE_LABEL_CHANGE = 2; //改价
|
|
|
const LOCK_STOCK = 'lock_stock';//修改库存锁
|
|
|
@@ -1119,9 +1119,9 @@ class ProductClass extends BaseClass
|
|
|
self::updateActualSoldById($productId, $newActualSold);
|
|
|
}
|
|
|
|
|
|
- //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到66820,多处要同步修改,关键词 auto_add_stock
|
|
|
+ //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到98520,多处要同步修改,关键词 auto_add_stock
|
|
|
if ($productData->virtualStock == 1 && $newStock < 900) {
|
|
|
- self::updateStockById($productId, 66820);
|
|
|
+ self::updateStockById($productId, 98520);
|
|
|
}
|
|
|
|
|
|
//库存=0 下架商品,特价去掉,限购去掉 lqh 2021.7.9 ssh 20251106 花材满减去掉 20260318
|
|
|
@@ -1345,6 +1345,10 @@ class ProductClass extends BaseClass
|
|
|
public static function updateStockById($id, $stock, $adminId = 0)
|
|
|
{
|
|
|
$data['stock'] = $stock;
|
|
|
+ //如果有库存需要保持上架状态
|
|
|
+ if ($stock > 0) {
|
|
|
+ $data['status'] = 1;
|
|
|
+ }
|
|
|
if ($adminId) {
|
|
|
$data['adminId'] = $adminId;
|
|
|
}
|
|
|
@@ -1554,7 +1558,7 @@ class ProductClass extends BaseClass
|
|
|
$tmp['limitBuy'] = $currentGhsProduct['limitBuy'];
|
|
|
$tmp['smallUnitPrice'] = $itemPrice;
|
|
|
$tmp['classId'] = $classId;
|
|
|
- $tmp['kind'] = $currentGhsProduct['kind'] ?? 0;
|
|
|
+ $tmp['kind'] = $currentGhsProduct['kind'] ?? 0;
|
|
|
$tmp['belongCost'] = $currentGhsProduct['belongCost'] ?? 0;
|
|
|
$tmp['hjDiscountPrice'] = $currentGhsProduct['hjDiscountPrice'];
|
|
|
$tmp['discountPrice'] = $currentGhsProduct['discountPrice'];
|
|
|
@@ -1990,7 +1994,7 @@ class ProductClass extends BaseClass
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//不影响其它直营店花材的上下架
|
|
|
unset($upData['status']);
|
|
|
|
|
|
@@ -2779,13 +2783,13 @@ class ProductClass extends BaseClass
|
|
|
]),
|
|
|
]);
|
|
|
Yii::info('限购延迟消息已发送: ' . json_encode([
|
|
|
- 'type' => 'limit_buy_clear',
|
|
|
- 'ptType' => 'ghs',
|
|
|
- 'productId' => intval($productId),
|
|
|
- 'clearAt' => intval($clearAt),
|
|
|
- 'delayMs' => intval($seconds * 1000),
|
|
|
- 'recurring' => $recurring ? 1 : 0,
|
|
|
- ], JSON_UNESCAPED_UNICODE), __METHOD__);
|
|
|
+ 'type' => 'limit_buy_clear',
|
|
|
+ 'ptType' => 'ghs',
|
|
|
+ 'productId' => intval($productId),
|
|
|
+ 'clearAt' => intval($clearAt),
|
|
|
+ 'delayMs' => intval($seconds * 1000),
|
|
|
+ 'recurring' => $recurring ? 1 : 0,
|
|
|
+ ], JSON_UNESCAPED_UNICODE), __METHOD__);
|
|
|
} else {
|
|
|
Yii::$app->redis->executeCommand('DEL', [$clearMarkKey]);
|
|
|
Yii::$app->redis->executeCommand('DEL', [$clearLoopKey]);
|
|
|
@@ -3113,7 +3117,7 @@ class ProductClass extends BaseClass
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- util::error(-1, '累计已超出限购数', ['productId'=>$productId, 'limitBuy'=>$limitBuy, 'exceed'=>$lastNum - $limitBuy]);
|
|
|
+ util::error(-1, '累计已超出限购数', ['productId' => $productId, 'limitBuy' => $limitBuy, 'exceed' => $lastNum - $limitBuy]);
|
|
|
}
|
|
|
Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $lastNum]);
|
|
|
} else {
|
|
|
@@ -3125,7 +3129,7 @@ class ProductClass extends BaseClass
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- util::error(-1, '超出限购数', ['productId'=>$productId, 'limitBuy'=>$limitBuy, 'exceed'=>$num - $limitBuy]);
|
|
|
+ util::error(-1, '超出限购数', ['productId' => $productId, 'limitBuy' => $limitBuy, 'exceed' => $num - $limitBuy]);
|
|
|
}
|
|
|
Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $num]);
|
|
|
}
|