cody 2 years ago
parent 0ce8a30899
commit 7664ebc0d5

@ -64,15 +64,18 @@ class HomeController extends CommonController
})->count();
// 各产品占比
$lies = [];
$product = Product::where('project_id', $project_id)->first();
$productItem = ProductItems::where('product_id', $product->id)->get();
$factor = FactorItems::where('factor_id', $product->statistic_factor_id)->get();
$order_total = OrderItems::whereIn('product_item_id', $productItem->pluck('id'))->sum('total');
$lies = Cache::remember('cache_lies', 24 * 60 * 60, function () use ($productItem, $factor, $order_total) {
return $this->getLies($productItem, $factor, $order_total);
});
if($product){
$productItem = ProductItems::where('product_id', $product->id)->get();
$factor = FactorItems::where('factor_id', $product->statistic_factor_id)->get();
$order_total = OrderItems::whereIn('product_item_id', $productItem->pluck('id'))->sum('total');
$lies = Cache::remember('cache_lies', 24 * 60 * 60, function () use ($productItem, $factor, $order_total) {
return $this->getLies($productItem, $factor, $order_total);
});
}
$allMontn = [
date("Y") . '-01',
date("Y") . '-02',

Loading…
Cancel
Save