12 changed files with 162 additions and 28 deletions
-
6app/Constants/v3/ErrorCode.php
-
2app/Controller/v3/HomeController.php
-
10app/Controller/v3/ShopCartController.php
-
7app/Controller/v3/ShopCartUpdateController.php
-
44app/Request/v3/ShopCartUpdateRequest.php
-
5app/Service/v3/Implementations/GoodsService.php
-
75app/Service/v3/Implementations/ShopCartService.php
-
9app/Service/v3/Implementations/ShopCartUpdateService.php
-
24app/Service/v3/Implementations/StoreService.php
-
4app/Service/v3/Interfaces/ShopCartServiceInterface.php
-
2app/Service/v3/Interfaces/ShopCartUpdateServiceInterface.php
-
2app/Service/v3/Interfaces/StoreServiceInterface.php
@ -0,0 +1,44 @@ |
|||||
|
<?php |
||||
|
|
||||
|
declare(strict_types=1); |
||||
|
|
||||
|
namespace App\Request\v3; |
||||
|
|
||||
|
use App\Request\BaseFormRequest; |
||||
|
|
||||
|
class ShopCartUpdateRequest extends BaseFormRequest |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* Get the validation rules that apply to the request. |
||||
|
*/ |
||||
|
public function rules(): array |
||||
|
{ |
||||
|
return [ |
||||
|
'goods_id' => 'required|nonempty|integer', |
||||
|
'num' => 'required|nonempty|integer', |
||||
|
'user_id' => 'required|nonempty|integer|exists:lanzu_user,id', |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function messages(): array |
||||
|
{ |
||||
|
return [ |
||||
|
'user_id.*' => ':attribute无效', |
||||
|
'goods_id.*' => ':attribute无效', |
||||
|
'num.*' => ':attribute无效', |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
public function attributes(): array |
||||
|
{ |
||||
|
return [ |
||||
|
'user_id' => '用户id', |
||||
|
'goods_id' => '商品ID', |
||||
|
'num' => '数量', |
||||
|
]; |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue