浏览代码

20220831 fix insert data functon

LuluFJ.Ho 2 年前
父节点
当前提交
25d2df754c

+ 4
- 4
app/Http/Controllers/Api/SeminarSignUpController.php 查看文件

25
         $name = $this->safeEncrypt($request->input('name', 'name'), 'arm');
25
         $name = $this->safeEncrypt($request->input('name', 'name'), 'arm');
26
         $email = $this->safeEncrypt($request->input('email', 'email'), 'arm');
26
         $email = $this->safeEncrypt($request->input('email', 'email'), 'arm');
27
         $mobile = $this->safeEncrypt($request->input('mobile', 'mobile'), 'arm');
27
         $mobile = $this->safeEncrypt($request->input('mobile', 'mobile'), 'arm');
28
-        $trackId = $request->input('trackId', 'T0052');
28
+        $trackNo = $request->input('trackNo', '');
29
         
29
         
30
-        $overOrNot = $this->seminarSignUpSv->overLimitOrNot($trackId);
30
+        $overOrNot = $this->seminarSignUpSv->overLimitOrNot($trackNo);
31
         if ($overOrNot) {
31
         if ($overOrNot) {
32
 
32
 
33
-            $this->seminarSignUpSv->insertData($name, $email, $mobile, $trackId);
33
+            $this->seminarSignUpSv->insertData($name, $email, $mobile, $trackNo);
34
             $res = '報名成功';
34
             $res = '報名成功';
35
         } else {
35
         } else {
36
 
36
 
39
         $data = [
39
         $data = [
40
             'res' => $res,
40
             'res' => $res,
41
         ];
41
         ];
42
-
42
+        dd(123);
43
         return $this->apiResponse($data);
43
         return $this->apiResponse($data);
44
     }
44
     }
45
 
45
 

+ 5
- 5
app/Http/Services/Web/SeminarSignUpService.php 查看文件

20
         
20
         
21
     }
21
     }
22
     
22
     
23
-    public function insertData($name, $email, $mobile, $trackId)
23
+    public function insertData($name, $email, $mobile, $trackNo)
24
     {
24
     {
25
         
25
         
26
         $this->signupDb
26
         $this->signupDb
28
                 'name' => $name,
28
                 'name' => $name,
29
                 'email' => $email,
29
                 'email' => $email,
30
                 'mobile' => $mobile,
30
                 'mobile' => $mobile,
31
-                'trackId' => $trackId,
31
+                'trackNo' => $trackNo,
32
                 'createDate' => date("Y-m-d H:i:s"),
32
                 'createDate' => date("Y-m-d H:i:s"),
33
             ]);
33
             ]);
34
         
34
         
35
     }
35
     }
36
     
36
     
37
-    public function overLimitOrNot($trackId)
37
+    public function overLimitOrNot($trackNo)
38
     {
38
     {
39
         $nowCount = $this->signupDb
39
         $nowCount = $this->signupDb
40
-            ->where('trackId', '=', $trackId)
40
+            ->where('trackNo', '=', $trackNo)
41
             ->count();
41
             ->count();
42
         
42
         
43
         $limit = $this->trackDataDb
43
         $limit = $this->trackDataDb
44
             ->select('trackLimit')
44
             ->select('trackLimit')
45
-            ->where('trackNo', '=', $trackId)
45
+            ->where('trackNo', '=', $trackNo)
46
             ->first();
46
             ->first();
47
         
47
         
48
         if ($limit->trackLimit>$nowCount) {
48
         if ($limit->trackLimit>$nowCount) {