Parcourir la source

20221013 補寄信(1005~1011)

LuluFJ.Ho il y a 2 ans
Parent
révision
f5f19eb05e

+ 105
- 0
app/Http/Controllers/Api/SeminarSignUpController.php Voir le fichier

@@ -117,6 +117,111 @@ class SeminarSignUpController extends ApiController
117 117
         return $this->apiResponse($data);
118 118
     }
119 119
 
120
+    // list
121
+    public function getReMailData()
122
+    {
123
+        
124
+        $list = $this->seminarSignUpSv->getReMailData();
125
+        return '123';
126
+        
127
+        \Log::info(print_r($list,true));
128
+        return;
129
+
130
+        $trackNo = $request->input('trackNo', '');
131
+        $lang = substr($trackNo, 0, 2);
132
+
133
+        $firstName_orig = $request->input('firstName', '');
134
+        $firstName = $this->safeEncrypt($firstName_orig, 'arm');
135
+
136
+        $lastName_orig = $request->input('lastName', '');
137
+        $lastName = $this->safeEncrypt($lastName_orig, 'arm');
138
+        
139
+        $companyName_orig = $request->input('companyName', '');
140
+        $companyName = $this->safeEncrypt($companyName_orig, 'arm');
141
+        
142
+        $companyEmail_orig = $request->input('companyEmail', '');
143
+        $companyEmail = $this->safeEncrypt($companyEmail_orig, 'arm');
144
+        
145
+        $backupEmail = $request->input('backupEmail', '');
146
+        if (!is_null($backupEmail)) {
147
+        
148
+            $backupEmail_orig = $request->input('backupEmail', '');
149
+            $backupEmail = $this->safeEncrypt($backupEmail_orig, 'arm');
150
+        } else {
151
+            $backupEmail_orig = '';
152
+        }
153
+        
154
+        $phoneNumber_orig = $request->input('phoneNumber', '');
155
+        $phoneNumber = $this->safeEncrypt($phoneNumber_orig, 'arm');
156
+        
157
+        $country = $request->input('country', '');
158
+        $registeredSession = $request->input('registeredSession', '');
159
+        $lunchOptions = $request->input('lunchOptions', '');
160
+        $typeOfIndustry = $request->input('typeOfIndustry', '');
161
+        $typeOfJob = $request->input('typeOfJob', '');
162
+        $jobTitle = $request->input('jobTitle', '');
163
+        $trackOfInterest = $request->input('trackOfInterest', '');
164
+        $areaOfInterest = $request->input('areaOfInterest', '');
165
+        $howToKnowAboutTheEvent = $request->input('howToKnowAboutTheEvent', '');
166
+        $consentAcceptEmail = $request->input('consentAcceptEmail', '');
167
+        $consentPrivacyPolicy = $request->input('consentPrivacyPolicy', '');
168
+        $media = $request->input('media', '');
169
+        
170
+        $overOrNot = $this->seminarSignUpSv->overLimitOrNot($trackNo);          // true: 可報名 / false: 已額滿
171
+        $duplicatedOrNot = $this->seminarSignUpSv->duplicatedOrNot($trackNo, $companyEmail, $phoneNumber);   // true: 可報名 / false: 已重複
172
+
173
+        if ($overOrNot&&$duplicatedOrNot) {
174
+
175
+            $this->seminarSignUpSv->insertData(
176
+                $firstName, 
177
+                $lastName, 
178
+                $companyName, 
179
+                $companyEmail, 
180
+                $backupEmail, 
181
+                $phoneNumber, 
182
+                $country, 
183
+                $trackNo, 
184
+                $registeredSession,
185
+                $lunchOptions,
186
+                $typeOfIndustry,
187
+                $typeOfJob,
188
+                $jobTitle,
189
+                $trackOfInterest,
190
+                $areaOfInterest,
191
+                $howToKnowAboutTheEvent,
192
+                $consentAcceptEmail,
193
+                $consentPrivacyPolicy,
194
+                $media,
195
+            );
196
+            $res = '報名成功';
197
+
198
+            if ($lang=='TP'||$lang=='HS') {
199
+                $this->mailToUser_TW($firstName_orig, $lastName_orig, $companyName_orig, $companyEmail_orig, $backupEmail_orig, 
200
+                    $phoneNumber_orig, $country, $registeredSession, $lunchOptions, $typeOfIndustry, $typeOfJob, $jobTitle, $trackOfInterest);
201
+            } elseif ($lang=='JP') {
202
+                $this->mailToUser_JP($firstName_orig, $lastName_orig, $companyName_orig, $companyEmail_orig, $backupEmail_orig, 
203
+                $phoneNumber_orig, $country, /*$registeredSession, $lunchOptions, */$typeOfIndustry, $typeOfJob, $jobTitle, $trackOfInterest);
204
+            } elseif ($lang=='KR') {
205
+                $this->mailToUser_KR($firstName_orig, $lastName_orig, $companyName_orig, $companyEmail_orig, $backupEmail_orig, 
206
+                $phoneNumber_orig, $country, /*$registeredSession, $lunchOptions, */$typeOfIndustry, $typeOfJob, $jobTitle, $trackOfInterest);
207
+            } else {
208
+                $this->mailToUser_EN($firstName_orig, $companyEmail_orig, $backupEmail_orig);
209
+            }
210
+            
211
+        } elseif (!$overOrNot) {
212
+
213
+            $res = '已達報名上限';
214
+        } elseif (!$duplicatedOrNot) {
215
+
216
+            $res = '已重複報名';
217
+        }
218
+        $data = [
219
+            'res' => $res,
220
+        ];
221
+        
222
+        return $this->apiResponse($data);
223
+    }
224
+
120 225
     public function getData()
121 226
     {
122 227
         $list = $this->seminarSignUpSv->getData();

+ 18
- 0
app/Http/Services/Api/SeminarSignUpService.php Voir le fichier

@@ -109,4 +109,22 @@ class SeminarSignUpService
109 109
 
110 110
     }
111 111
 
112
+    public function getReMailData()
113
+    {
114
+        \DB::enableQueryLog(); 
115
+        
116
+        $res = $this->signupDb
117
+            ->select(['*'])
118
+            ->where('createDate', '>', '2022-10-05 08:39:30')
119
+            ->where('createDate', '<', '2022-10-11 18:42:00')
120
+
121
+            ->get();
122
+        
123
+        \Log::debug(print_r(DB::getQueryLog(), true));
124
+        
125
+        // 整理返回值並返回
126
+        return $res;
127
+
128
+    }
129
+
112 130
 }

+ 1
- 0
routes/api.php Voir le fichier

@@ -8,6 +8,7 @@ Route::prefix('signup')->group(function () {
8 8
     Route::post('/insertData', [SeminarSignUpController::class, 'insertData']);
9 9
     Route::get('/getData', [SeminarSignUpController::class, 'getData']);
10 10
     Route::get('/mail', [SeminarSignUpController::class, 'mailToUser']);
11
+    Route::get('/getReMailData', [SeminarSignUpController::class, 'getReMailData']);
11 12
 });
12 13
 
13 14