shish %!s(int64=2) %!d(string=hai) anos
pai
achega
77541be557
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      app-ghs/controllers/CpItemController.php

+ 5 - 0
app-ghs/controllers/CpItemController.php

@@ -39,6 +39,11 @@ class CpItemController extends BaseController
         if ($item->mainId != $this->mainId) {
             util::fail('不是你的产品');
         }
+        $productId = $item->productId ?? 0;
+        $count = CpItemClass::getCount(['productId' => $productId]);
+        if ($count <= 1) {
+            util::fail('最少要保留一个');
+        }
         $item->delete();
         util::complete('删除成功');
     }