|
|
@@ -2821,7 +2821,14 @@ class ProductClass extends BaseClass
|
|
|
return ['intervalDays' => $intervalDays, 'clearHour' => $clearHour];
|
|
|
}
|
|
|
|
|
|
- // 创建循环清空限购缓存
|
|
|
+ /**
|
|
|
+ * 创建循环清空限购缓存
|
|
|
+ * @param $productId 花材ID
|
|
|
+ * @param int $intervalDays 循环清空限购的间隔天数
|
|
|
+ * @param int $clearHour 循环清空限购的执行时间点
|
|
|
+ * @param int $clearAt 循环清空限购的下次清空时间
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
public static function createRecurringLimitBuyCache($productId, $intervalDays, $clearHour, $clearAt = 0)
|
|
|
{
|
|
|
$productId = intval($productId);
|
|
|
@@ -2889,6 +2896,15 @@ class ProductClass extends BaseClass
|
|
|
return $info;
|
|
|
}
|
|
|
|
|
|
+ $loopConfig = self::getLimitBuyClearLoopConfigByProductId($productId);
|
|
|
+ if (!empty($loopConfig)) {
|
|
|
+ $info['limitBuyClearType'] = 1;
|
|
|
+ $info['limitBuyClearTypeName'] = '循环清空';
|
|
|
+ $info['limitBuyClearIntervalDays'] = intval($loopConfig['intervalDays'] ?? 0);
|
|
|
+ $info['cleartAt'] = intval($loopConfig['clearHour'] ?? 0);
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
$clearMarkKey = self::CLEAR_MARK_KEY . $productId;
|
|
|
$clearAt = intval(Yii::$app->redis->executeCommand('GET', [$clearMarkKey]));
|
|
|
if ($clearAt <= 0) {
|
|
|
@@ -2902,13 +2918,6 @@ class ProductClass extends BaseClass
|
|
|
$info['limitBuyNextClearAt'] = $clearAt;
|
|
|
$info['limitBuyNextClearTime'] = $info['limitBuyClearTime'];
|
|
|
|
|
|
- $loopConfig = self::getLimitBuyClearLoopConfigByProductId($productId);
|
|
|
- if (!empty($loopConfig)) {
|
|
|
- $info['limitBuyClearType'] = 1;
|
|
|
- $info['limitBuyClearTypeName'] = '循环清空';
|
|
|
- $info['limitBuyClearIntervalDays'] = intval($loopConfig['intervalDays'] ?? 0);
|
|
|
- $info['cleartAt'] = intval($loopConfig['clearHour'] ?? 0);
|
|
|
- }
|
|
|
return $info;
|
|
|
}
|
|
|
|