Browse Source

Merge branch 'purchase_limit' into develop

# Conflicts:
#	config/routes.php
master
Lemon 5 years ago
parent
commit
e79325832b
  1. 4
      app/Controller/PurchaseLimitController.php
  2. 43
      app/Request/ShopCarRequest.php
  3. 8
      app/Request/UpdateShopCarRequest.php

4
app/Controller/PurchaseLimitController.php

@ -20,8 +20,8 @@ class PurchaseLimitController extends BaseController
public function addShopCar() public function addShopCar()
{ {
$res = $this->purchaseLimitService->addShopCar($this->request->all()); $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); return $this->success($res);
} }

43
app/Request/ShopCarRequest.php

@ -1,43 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Request;
use Hyperf\Validation\Request\FormRequest;
class UpdateShopCarRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'id' => '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' => '购物车记录',
];
}
}

8
app/Request/UpdateShopCarRequest.php

@ -6,7 +6,7 @@ namespace App\Request;
use Hyperf\Validation\Request\FormRequest; use Hyperf\Validation\Request\FormRequest;
class PersonnelRequest extends FormRequest
class UpdateShopCarRequest extends FormRequest
{ {
/** /**
* Determine if the user is authorized to make this request. * Determine if the user is authorized to make this request.
@ -22,14 +22,14 @@ class PersonnelRequest extends FormRequest
public function rules(): array public function rules(): array
{ {
return [ 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 public function messages(): array
{ {
return [ return [
'service_personnel_id.exists_enable' => ':attribute不存在或被禁用',
'id.exists_enable' => ':attribute不存在或被禁用',
'service_personnel_id.*' => ':attribute信息不正确' 'service_personnel_id.*' => ':attribute信息不正确'
]; ];
} }
@ -37,7 +37,7 @@ class PersonnelRequest extends FormRequest
public function attributes(): array public function attributes(): array
{ {
return [ return [
'service_personnel_id' => '服务专员',
'id' => '购物车记录',
]; ];
} }
} }
Loading…
Cancel
Save