|
|
@@ -1,12 +1,14 @@
|
|
|
<?php
|
|
|
+
|
|
|
declare(strict_types=1);
|
|
|
-namespace SixShop\LimitPurchase\Controller\Admin;
|
|
|
|
|
|
+namespace SixShop\LimitPurchase\Controller\Admin;
|
|
|
|
|
|
use SixShop\Core\Request;
|
|
|
use SixShop\LimitPurchase\Entity\GoodsLimitPurchaseRuleEntity;
|
|
|
use SixShop\LimitPurchase\Entity\LimitPurchaseRuleEntity;
|
|
|
use think\Response;
|
|
|
+
|
|
|
use function SixShop\Core\page_response;
|
|
|
use function SixShop\Core\success_response;
|
|
|
use function SixShop\Core\throw_logic_exception;
|
|
|
@@ -16,7 +18,7 @@ class RuleController
|
|
|
/**
|
|
|
* 规则列表
|
|
|
*/
|
|
|
- public function index(Request $request, LimitPurchaseRuleEntity $limitPurchaseRuleEntity):Response
|
|
|
+ public function index(Request $request, LimitPurchaseRuleEntity $limitPurchaseRuleEntity): Response
|
|
|
{
|
|
|
$params = $request->get([
|
|
|
'status/b'
|
|
|
@@ -48,9 +50,9 @@ class RuleController
|
|
|
|
|
|
public function delete(int $id, LimitPurchaseRuleEntity $limitPurchaseRuleEntity, GoodsLimitPurchaseRuleEntity $goodsLimitPurchaseRuleEntity)
|
|
|
{
|
|
|
- if(0 < $goodsLimitPurchaseRuleEntity->where('rule_id', $id)->count()) {
|
|
|
+ if (0 < $goodsLimitPurchaseRuleEntity->where('rule_id', $id)->count()) {
|
|
|
throw_logic_exception('此规则下有商品正在使用,请先解除关联');
|
|
|
}
|
|
|
return success_response($limitPurchaseRuleEntity::destroy($id));
|
|
|
}
|
|
|
-}
|
|
|
+}
|