From e79325832b3ab242d3f6cc7f7da4adcf4098509b Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 24 Aug 2020 11:33:02 +0800 Subject: [PATCH] Merge branch 'purchase_limit' into develop # Conflicts: # config/routes.php --- app/Controller/PurchaseLimitController.php | 4 +- app/Request/ShopCarRequest.php | 43 ---------------------- app/Request/UpdateShopCarRequest.php | 8 ++-- 3 files changed, 6 insertions(+), 49 deletions(-) delete mode 100644 app/Request/ShopCarRequest.php diff --git a/app/Controller/PurchaseLimitController.php b/app/Controller/PurchaseLimitController.php index 581e871..f1b96c7 100644 --- a/app/Controller/PurchaseLimitController.php +++ b/app/Controller/PurchaseLimitController.php @@ -20,8 +20,8 @@ class PurchaseLimitController extends BaseController public function addShopCar() { $res = $this->purchaseLimitService->addShopCar($this->request->all()); - if (!$res) { - return $this->result(ErrorCode::GOODS_FAILURE, '', '商品已超过购买数量'); + if (isset($res['error'])) { + return $this->result(ErrorCode::GOODS_FAILURE, '', $res['error']); } return $this->success($res); } diff --git a/app/Request/ShopCarRequest.php b/app/Request/ShopCarRequest.php deleted file mode 100644 index 64a7748..0000000 --- a/app/Request/ShopCarRequest.php +++ /dev/null @@ -1,43 +0,0 @@ - 'required|nonempty|integer|exists_enable:ims_cjdc_shopcar,id', - ]; - } - - public function messages(): array - { - return [ - 'id.exists_enable' => ':attribute不存在或被禁用', - 'service_personnel_id.*' => ':attribute信息不正确' - ]; - } - - public function attributes(): array - { - return [ - 'id' => '购物车记录', - ]; - } -} diff --git a/app/Request/UpdateShopCarRequest.php b/app/Request/UpdateShopCarRequest.php index 70bb274..64a7748 100644 --- a/app/Request/UpdateShopCarRequest.php +++ b/app/Request/UpdateShopCarRequest.php @@ -6,7 +6,7 @@ namespace App\Request; use Hyperf\Validation\Request\FormRequest; -class PersonnelRequest extends FormRequest +class UpdateShopCarRequest extends FormRequest { /** * Determine if the user is authorized to make this request. @@ -22,14 +22,14 @@ class PersonnelRequest extends FormRequest public function rules(): array { return [ - 'service_personnel_id' => 'required|nonempty|integer|exists_enable:lanzu_service_personnel,id,status=1', + 'id' => 'required|nonempty|integer|exists_enable:ims_cjdc_shopcar,id', ]; } public function messages(): array { return [ - 'service_personnel_id.exists_enable' => ':attribute不存在或被禁用', + 'id.exists_enable' => ':attribute不存在或被禁用', 'service_personnel_id.*' => ':attribute信息不正确' ]; } @@ -37,7 +37,7 @@ class PersonnelRequest extends FormRequest public function attributes(): array { return [ - 'service_personnel_id' => '服务专员', + 'id' => '购物车记录', ]; } }