|
|
@@ -2862,6 +2862,47 @@ class ProductClass extends BaseClass
|
|
|
return is_array($config) ? $config : [];
|
|
|
}
|
|
|
|
|
|
+ // 获取限购清空配置,用于商品详情回显
|
|
|
+ public static function getLimitBuyClearInfo($productId)
|
|
|
+ {
|
|
|
+ $productId = intval($productId);
|
|
|
+ $info = [
|
|
|
+ 'limitBuyClearType' => 0, // 0不清空 1定时清空 2循环清空
|
|
|
+ 'limitBuyClearTypeName' => '不清空',
|
|
|
+ 'limitBuyClearAt' => 0,
|
|
|
+ 'limitBuyClearTime' => '',
|
|
|
+ 'limitBuyNextClearAt' => 0,
|
|
|
+ 'limitBuyNextClearTime' => '',
|
|
|
+ 'limitBuyClearIntervalDays' => 0,
|
|
|
+ 'cleartAt' => '',
|
|
|
+ ];
|
|
|
+ if ($productId <= 0) {
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
+ $clearMarkKey = self::CLEAR_MARK_KEY . $productId;
|
|
|
+ $clearAt = intval(Yii::$app->redis->executeCommand('GET', [$clearMarkKey]));
|
|
|
+ if ($clearAt <= 0) {
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
+ $info['limitBuyClearType'] = 1;
|
|
|
+ $info['limitBuyClearTypeName'] = '定时清空';
|
|
|
+ $info['limitBuyClearAt'] = $clearAt;
|
|
|
+ $info['limitBuyClearTime'] = date('Y-m-d H:i:s', $clearAt);
|
|
|
+ $info['limitBuyNextClearAt'] = $clearAt;
|
|
|
+ $info['limitBuyNextClearTime'] = $info['limitBuyClearTime'];
|
|
|
+
|
|
|
+ $loopConfig = self::getLimitBuyClearLoopConfigByProductId($productId);
|
|
|
+ if (!empty($loopConfig)) {
|
|
|
+ $info['limitBuyClearType'] = 2;
|
|
|
+ $info['limitBuyClearTypeName'] = '循环清空';
|
|
|
+ $info['limitBuyClearIntervalDays'] = intval($loopConfig['intervalDays'] ?? 0);
|
|
|
+ $info['cleartAt'] = intval($loopConfig['clearHour'] ?? 0);
|
|
|
+ }
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
// 清理循环清空限购配置
|
|
|
public static function clearLimitBuyClearLoopConfig($productId)
|
|
|
{
|