Browse Source

20220920 fix 後台匯出功能

LuluFJ.Ho 2 years ago
parent
commit
a21a2dcb50
1 changed files with 15 additions and 8 deletions
  1. 15
    8
      app/Http/Services/Backend/DataManagement/SignupManagementService.php

+ 15
- 8
app/Http/Services/Backend/DataManagement/SignupManagementService.php View File

@@ -25,7 +25,7 @@ class SignupManagementService
25 25
         $res = $this->signupDb
26 26
             ->select('*');
27 27
             
28
-        if ($keyword){
28
+        if ($keyword) {
29 29
 
30 30
             $res = $res->where('firstName', $keyword)
31 31
                 ->orWhere('lastName', $keyword)
@@ -40,9 +40,16 @@ class SignupManagementService
40 40
                 // ->orWhere('jobTitle', $keyword);
41 41
         }
42 42
 
43
-        $res = $res->where('trackNo','LIKE', $trackNo.'%')
44
-            ->where('createDate', '>', $createDateStart)
45
-            ->where('createDate', '<', $createDateFinal);
43
+        if ($trackNo) {
44
+            
45
+            $res = $res->where('trackNo','LIKE', $trackNo.'%');
46
+        }
47
+        if ($createDateStart && $createDateFinal) {
48
+            
49
+            $res = $res->where('createDate', '>', $createDateStart)
50
+                ->where('createDate', '<', $createDateFinal);
51
+        }
52
+        
46 53
                         
47 54
         // 取總筆數
48 55
         $cnt = $res->count();
@@ -92,11 +99,11 @@ class SignupManagementService
92 99
                 // ->orWhere('jobTitle', $keyword);
93 100
         }
94 101
         
95
-        if ($createDateStart!="" && $createDateFinal!="") {
96
-            \Log::info('date123');
102
+        // if ($createDateStart!="" && $createDateFinal!="") {
103
+            // \Log::info('date123');
97 104
             $res = $res->where('createDate', '>', $createDateStart)
98
-                ->where('createDate', '<', $createDateFinal);
99
-        }
105
+                        ->where('createDate', '<', $createDateFinal);
106
+        // }
100 107
         
101 108
         $res = $this->signupDb
102 109
             ->get()