Browse Source

清空限购

shish 1 year ago
parent
commit
8524d7143c
1 changed files with 16 additions and 0 deletions
  1. 16 0
      app-ghs/controllers/ItemController.php

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

@@ -22,6 +22,22 @@ use Yii;
 class ItemController extends BaseController
 {
 
+    //取消花材的限购,重新开始计算
+    public function actionClearLimitBuy()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? '';
+        $item = ItemClass::getById($id, true);
+        if (empty($item)) {
+            util::fail('没有找到花材');
+        }
+        if ($item->mainId != $this->mainId) {
+            util::fail('不是你的花材');
+        }
+        ProductClass::cancelLimitBuy($id);
+        util::complete('清除成功');
+    }
+
     public function actionModifyWeight()
     {
         $shop = $this->shop;