|
|
|
|
@ -69,7 +69,7 @@ class HomeController extends CommonController
|
|
|
|
|
$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('lies', 24 * 60 * 60, function () use ($productItem,$factor,$order_total) {
|
|
|
|
|
$lies = Cache::remember('lies', 24 * 60 * 60, function () use ($productItem, $factor, $order_total) {
|
|
|
|
|
return $this->getLies($productItem, $factor, $order_total);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -105,7 +105,13 @@ class HomeController extends CommonController
|
|
|
|
|
'total' => (new Orders())->ofProject($project_id)->where('created_at', 'like', $month . '%')->count()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
if (is_mobile()) {
|
|
|
|
|
// 判断是否有权限
|
|
|
|
|
$userId = auth()->id();
|
|
|
|
|
$roleId = Role::where('name', 'like', '%首页统计%')->where('guard_name', 'admin')->value('id');
|
|
|
|
|
$tongji = DB::table('model_has_roles')->where('role_id', $roleId)
|
|
|
|
|
->where('model_type', 'App\Admin')->where('model_id', $userId)->count();
|
|
|
|
|
|
|
|
|
|
if (is_mobile() || empty($tongji)) {
|
|
|
|
|
return view($this->bladePath . ".mobile_home");
|
|
|
|
|
} else {
|
|
|
|
|
return view($this->bladePath . ".home", compact('counts', 'lies', 'saleList', 'orderList'));
|
|
|
|
|
|