From ff21e69382669b3b1707e744268367897724ca31 Mon Sep 17 00:00:00 2001 From: EasyChen Date: Mon, 24 Jan 2022 19:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BE=93=E5=85=A5=E5=80=BC?= =?UTF-8?q?=E7=9A=84=E5=BF=85=E5=A1=AB=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/PushDeerDeviceController.php | 12 ++++++------ api/app/Http/Controllers/PushDeerKeyController.php | 8 ++++---- .../Http/Controllers/PushDeerMessageController.php | 2 +- api/app/Http/Controllers/PushDeerUserController.php | 9 +++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/api/app/Http/Controllers/PushDeerDeviceController.php b/api/app/Http/Controllers/PushDeerDeviceController.php index b935803..0925609 100644 --- a/api/app/Http/Controllers/PushDeerDeviceController.php +++ b/api/app/Http/Controllers/PushDeerDeviceController.php @@ -22,9 +22,9 @@ class PushDeerDeviceController extends Controller { $validated = $request->validate( [ - 'name' => 'string', - 'device_id' => 'string', - 'is_clip' => 'integer', + 'name' => 'string|required', + 'device_id' => 'string|required', + 'is_clip' => 'integer|nullable', 'type' => 'string|nullable', ] ); @@ -55,8 +55,8 @@ class PushDeerDeviceController extends Controller { $validated = $request->validate( [ - 'id' => 'integer', - 'name' =>'string' + 'id' => 'integer|required', + 'name' =>'string|required' ] ); @@ -75,7 +75,7 @@ class PushDeerDeviceController extends Controller { $validated = $request->validate( [ - 'id' => 'integer', + 'id' => 'integer|required', ] ); diff --git a/api/app/Http/Controllers/PushDeerKeyController.php b/api/app/Http/Controllers/PushDeerKeyController.php index f143448..99792f2 100644 --- a/api/app/Http/Controllers/PushDeerKeyController.php +++ b/api/app/Http/Controllers/PushDeerKeyController.php @@ -40,8 +40,8 @@ class PushDeerKeyController extends Controller { $validated = $request->validate( [ - 'id' => 'integer', - 'name' =>'string' + 'id' => 'integer|required', + 'name' =>'string|required' ] ); @@ -60,7 +60,7 @@ class PushDeerKeyController extends Controller { $validated = $request->validate( [ - 'id' => 'integer', + 'id' => 'integer|required', ] ); @@ -79,7 +79,7 @@ class PushDeerKeyController extends Controller { $validated = $request->validate( [ - 'id' => 'integer', + 'id' => 'integer|required', ] ); diff --git a/api/app/Http/Controllers/PushDeerMessageController.php b/api/app/Http/Controllers/PushDeerMessageController.php index 2d702ef..7f073e1 100644 --- a/api/app/Http/Controllers/PushDeerMessageController.php +++ b/api/app/Http/Controllers/PushDeerMessageController.php @@ -96,7 +96,7 @@ class PushDeerMessageController extends Controller { $validated = $request->validate( [ - 'id' => 'integer', + 'id' => 'integer|required', ] ); diff --git a/api/app/Http/Controllers/PushDeerUserController.php b/api/app/Http/Controllers/PushDeerUserController.php index cdac01e..174e757 100644 --- a/api/app/Http/Controllers/PushDeerUserController.php +++ b/api/app/Http/Controllers/PushDeerUserController.php @@ -60,7 +60,7 @@ class PushDeerUserController extends Controller { $validated = $request->validate( [ - 'code' => 'string', + 'code' => 'string|required', ] ); @@ -115,7 +115,7 @@ class PushDeerUserController extends Controller { $validated = $request->validate( [ - 'idToken' => 'string', + 'idToken' => 'string|required', ] ); @@ -157,11 +157,12 @@ class PushDeerUserController extends Controller { $validated = $request->validate( [ - 'tokenorcode' => 'string', - 'type' => 'string', // apple or wechat + 'tokenorcode' => 'string|required', + 'type' => 'string|required', // apple or wechat ] ); + $type_field = strtolower($validated['type']) == 'apple' ? 'apple_id' : 'wechat_id'; $identiy_string = false;