|
@@ -315,9 +315,27 @@ class IndexController extends \app\controllers\HomeController
|
|
|
if(!$productName||!$store){
|
|
|
$this->json(0,[],'参数错误');
|
|
|
}
|
|
|
- $start_day=$request->get('start', date('Y-m-d',time()-3600*24*8));
|
|
|
- $end_day = $request->get('end', date('Y-m-d',time()-3600*24));
|
|
|
- $productInfo=$ga->productInfo($productName,$store,$start_day,$end_day);
|
|
|
+ $storeConfig=[
|
|
|
+ 'dp'=>$store,
|
|
|
+ 'dimensionArr'=>[
|
|
|
+ 'productSku'=>"ga:productSku",
|
|
|
+ ],
|
|
|
+ 'metricArr'=>[
|
|
|
+ 'itemRevenue'=>"ga:itemRevenue",
|
|
|
+ 'uniquePurchases'=>"ga:uniquePurchases",
|
|
|
+ 'itemQuantity'=>"ga:itemQuantity",
|
|
|
+ 'ga:revenuePerTransaction'=>"ga:ga:revenuePerTransaction",
|
|
|
+ ],
|
|
|
+ 'SegmentDimensionFilters'=>[
|
|
|
+ [
|
|
|
+ 'name'=>'ga:productName',
|
|
|
+ 'operator'=>'EXACT',
|
|
|
+ 'expression'=>[$productName]
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ 'date'=>['start_at'=>$start_day,'end_at'=>$end_day]
|
|
|
+ ];
|
|
|
+ $productInfo=$ga->productInfo($storeConfig);
|
|
|
$this->json(1,$productInfo);
|
|
|
}
|
|
|
|