Pārlūkot izejas kodu

20220901 fix insertData function

LuluFJ.Ho 2 gadus atpakaļ
vecāks
revīzija
27f75d7573

+ 4
- 4
app/Http/Controllers/Api/SeminarSignUpController.php Parādīt failu

@@ -3,7 +3,7 @@
3 3
 namespace App\Http\Controllers\Api;
4 4
 
5 5
 use App\Http\Controllers\Api\ApiController;
6
-use App\Http\Services\Web\SeminarSignUpService;
6
+use App\Http\Services\Api\SeminarSignUpService;
7 7
 use App\Http\Requests\Api\SeminarSignUp\StoreRequest;
8 8
 
9 9
 use Log;
@@ -22,13 +22,13 @@ class SeminarSignUpController extends ApiController
22 22
     // save data to db
23 23
     public function insertData(StoreRequest $request)
24 24
     {
25
-        // \Log::info(print_r($request,true));
25
+        \Log::info(print_r($request->all(),true));
26 26
         $trackNo = $request->input('trackNo', '');
27
-        
28 27
         $firstName = $this->safeEncrypt($request->input('firstName', ''), 'arm');
29 28
         $lastName = $this->safeEncrypt($request->input('lastName', ''), 'arm');
30 29
         $companyName = $this->safeEncrypt($request->input('companyName', ''), 'arm');
31
-        $companyEmail = $this->safeEncrypt($request->input('companyEmail', ''), 'arm');
30
+        // $companyEmail = $this->safeEncrypt($request->input('companyEmail', ''), 'arm');
31
+        $companyEmail = $request->input('companyEmail', '');
32 32
         
33 33
         $backupEmail = $request->input('backupEmail', '');
34 34
         if (!is_null($backupEmail)) {

+ 1
- 1
app/Http/Requests/Api/SeminarSignUp/StoreRequest.php Parādīt failu

@@ -13,7 +13,7 @@ class StoreRequest extends FormRequest
13 13
             'lastName'      => 'required',
14 14
             'companyName'   => 'required',
15 15
             'companyEmail'  => 'required|email',
16
-            'backupEmail'   => 'nullable|email',
16
+            'backupEmail'   => 'sometimes|nullable|email',
17 17
             'phoneNumber'    => 'required',
18 18
             'country'   => 'required',
19 19
             // 'registeredSession'   => 'required',    // 如果選擇台灣track則必填

app/Http/Services/Web/SeminarSignUpService.php → app/Http/Services/Api/SeminarSignUpService.php Parādīt failu

@@ -1,6 +1,6 @@
1 1
 <?php
2 2
 
3
-namespace App\Http\Services\Web;
3
+namespace App\Http\Services\Api;
4 4
 
5 5
 use App\Models\SignupData;
6 6
 use App\Models\TrackData;
@@ -21,7 +21,7 @@ class SeminarSignUpService
21 21
     }
22 22
     
23 23
     public function insertData(
24
-        $trackNo, $firstName, $lastName, $companyName, $companyEmail, $backupEmail, $phoneNumber, $country, 
24
+        $firstName, $lastName, $companyName, $companyEmail, $backupEmail, $phoneNumber, $country, $trackNo, 
25 25
         $registeredSession, $lunchOptions, $typeOfIndustry, $typeOfJob, $jobTitle, $trackOfInterest, $areaOfInterest, $howToKnowAboutTheEvent, 
26 26
         $consentAcceptEmail, $consentPrivacyPolicy)
27 27
     {
@@ -53,6 +53,8 @@ class SeminarSignUpService
53 53
     
54 54
     public function overLimitOrNot($trackNo)
55 55
     {
56
+        \Log::info($trackNo);
57
+
56 58
         $nowCount = $this->signupDb
57 59
             ->where('trackNo', '=', $trackNo)
58 60
             ->count();
@@ -62,7 +64,7 @@ class SeminarSignUpService
62 64
             ->where('trackNo', '=', $trackNo)
63 65
             ->first();
64 66
         
65
-        if ($limit['trackLimit']>$nowCount) {
67
+        if ($limit->trackLimit>$nowCount) {
66 68
             return true;
67 69
         } else {
68 70
             return false;