@@ -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('删除成功');