ith5 5 mesi fa
parent
commit
126a1fc2fc
1 ha cambiato i file con 18 aggiunte e 3 eliminazioni
  1. 18 3
      app/v1/logic/dataReport/UserLogLogic.php

+ 18 - 3
app/v1/logic/dataReport/UserLogLogic.php

@@ -28,14 +28,29 @@ class UserLogLogic extends BaseLogic
         $currentQuery = Db::connect('db_game_log');
         foreach($tableNames as $index => $tableName){
             if($index === 0){
-                $currentQuery = $currentQuery->table($tableName)->field('*')->where($where)->whereRaw($whereRaw);
+                $currentQuery = $currentQuery->table($tableName);
+                if($where){
+                    $currentQuery = $currentQuery->where($where);
+                }
+                if($whereRaw){
+                    $currentQuery = $currentQuery->whereRaw($whereRaw);
+                }
             }else{
-                $currentQuery->unionAll($currentQuery->table($tableName)->field('*')->where($where)->whereRaw($whereRaw));
+                $currentQuery = $currentQuery->unionAll(function($query) use ($tableName, $where, $whereRaw){
+                    $query = $query->table($tableName);
+                    if($where){
+                        $query = $query->where($where);
+                    }
+                    if($whereRaw){
+                        $query = $query->whereRaw($whereRaw);
+                    }
+                });
             }
         }
 
 
-        // echo $currentQuery->buildSql();
+
+        echo $currentQuery->buildSql();
         // exit;