Ver Fonte

清空操作

shish há 1 ano atrás
pai
commit
a5bcde81a0

+ 25 - 0
app-ghs/controllers/ItemController.php

@@ -38,6 +38,31 @@ class ItemController extends BaseController
         util::success(['customList' => $customList]);
     }
 
+    //清空单个客户的已购 ssh 20250710
+    public function actionClearOneLimitBuy()
+    {
+        $get = Yii::$app->request->get();
+        $productId = $get['productId'] ?? '';
+        $customId = $get['customId'] ?? 0;
+        $item = ItemClass::getById($productId, true);
+        if (empty($item)) {
+            util::fail('没有找到花材');
+        }
+        if ($item->mainId != $this->mainId) {
+            util::fail('不是你的花材');
+        }
+        $custom = CustomClass::getById($customId, true);
+        if (empty($custom)) {
+            util::fail('没有客户');
+        }
+        if ($custom->ownMainId != $this->mainId) {
+            util::fail('不是你的客户');
+        }
+        ProductClass::cancelOneLimitBuy($productId, $customId);
+        util::complete('清除成功');
+    }
+
+
     //取消花材的限购,重新开始计算
     public function actionClearLimitBuy()
     {

+ 6 - 0
biz-ghs/product/classes/ProductClass.php

@@ -2591,6 +2591,12 @@ class ProductClass extends BaseClass
         return $product['mainId'] ?? 0;
     }
 
+    public static function cancelOneLimitBuy($productId, $customId)
+    {
+        $limitKey = 'limit_buy_' . $productId;
+        Yii::$app->redis->executeCommand('HDEL', [$limitKey, $customId]);
+    }
+
     //取消限购的缓存 ssh 20240605
     public static function cancelLimitBuy($productId)
     {