|
|
@@ -2812,7 +2812,12 @@ class ProductClass extends BaseClass
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- // 限购处理
|
|
|
+ /**
|
|
|
+ * 限购处理
|
|
|
+ * @param $product
|
|
|
+ * @param $customId
|
|
|
+ * @param $num
|
|
|
+ */
|
|
|
public static function handleLimitBuy($product, $customId, $num)
|
|
|
{
|
|
|
$limitBuy = $product['limitBuy'];
|
|
|
@@ -2913,7 +2918,7 @@ class ProductClass extends BaseClass
|
|
|
public static function getHasLimitBuyList($product)
|
|
|
{
|
|
|
$productId = $product->id;
|
|
|
- $limitBuy = $product->limitBuy ?? 0;
|
|
|
+ $limitBuy = $product->limitBuy;
|
|
|
$limitKey = self::LIMIT_BUY_KEY . $productId;
|
|
|
$arr = Yii::$app->redis->executeCommand('HKEYS', [$limitKey]);
|
|
|
$customList = [];
|
|
|
@@ -2925,15 +2930,18 @@ class ProductClass extends BaseClass
|
|
|
$numMap[$customId] = $num;
|
|
|
$ids[] = $customId;
|
|
|
}
|
|
|
+
|
|
|
+ $specialPrice = ($product['hjDiscountPrice'] > 0 && $product['discountPrice'] > 0 && $product['skDiscountPrice'] > 0); // 销售花材是否开启特价
|
|
|
$customList = CustomClass::getAllByCondition(['id' => ['in', $ids]], null, '*');
|
|
|
foreach ($customList as $key => $val) {
|
|
|
$customId = $val['id'];
|
|
|
$num = $numMap[$customId] ?? 0;
|
|
|
$customList[$key]['hasLimitBuyNum'] = $num;
|
|
|
- $customList[$key]['hasReachLimitBuyNum'] = $num >= $limitBuy ? 1 : 0;
|
|
|
+ $customList[$key]['reachLimitBuyNum'] = $num >= $limitBuy ? 1 : 0;
|
|
|
$avatar = $val['avatar'] ?? '';
|
|
|
$smallAvatar = imgUtil::groupImg($avatar);
|
|
|
$customList[$key]['smallAvatar'] = $smallAvatar . "?x-oss-process=image/resize,m_fill,h_80,w_80";
|
|
|
+ $customList[$key]['specialPrice'] = $specialPrice;
|
|
|
}
|
|
|
}
|
|
|
return $customList;
|