chengwl 4 years ago
parent
commit
8acaaea48a
1 changed files with 8 additions and 6 deletions
  1. 8 6
      controllers/IndexController.php

+ 8 - 6
controllers/IndexController.php

@@ -78,14 +78,16 @@ class IndexController extends Controller
             'productDetailViews'=>"ga:productDetailViews",
           ];
           $i=1;
-          $datas=array_chunk($metrics,6,true);
-          foreach($datas as $data){
-                $response = $this->getReport($analytics,$data);
+          $res=[];
+          $metrics=array_chunk($metrics,6,true);
+          foreach($metrics as $metric){
+                $response = $this->getReport($analytics,$metric);
                 // $this->printResults($response);
-                $res=$this->getResults($response);
-                echo "<pre>";
-                print_r($res);
+                $data=$this->getResults($response);
+                $res=array_merge_recursive($res,$data);
           }
+          echo "<pre>";
+          print_r($res);
         exit;
         return $this->render('index');
     }