Bladeren bron

[智价云] 数据隔离临时提交

tangyuanwang 1 maand geleden
bovenliggende
commit
a89e1726d9

+ 102 - 5
app/Http/Controllers/Manager/Process/LowPriceGoods.php

@@ -67,6 +67,14 @@ class LowPriceGoods extends Controller
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
         if ($company_name) $map[] = ['company_name', 'like', "%$company_name%"];
 
+        $low_price_goods_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $low_price_goods_where['company_id'] = $company_id;
+        } else {
+           $low_price_goods_where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoodsModel = $LowPriceGoodsModel->where($low_price_goods_where);
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -197,6 +205,14 @@ class LowPriceGoods extends Controller
         if ($store_name) $map[]   = ['store_name', 'like', "%$store_name%"];
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
 
+        $low_price_goods_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $low_price_goods_where['company_id'] = $company_id;
+        } else {
+           $low_price_goods_where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoodsModel = $LowPriceGoodsModel->where($low_price_goods_where);
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -449,6 +465,12 @@ class LowPriceGoods extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map['company_id'] = $company_id;
+        } else {
+           $map['company_id']  = $admin_company_id;
+        }
         $data = $LowPriceGoodsModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         //查询第一责任人名称
@@ -486,9 +508,18 @@ class LowPriceGoods extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map['company_id'] = $company_id;
+            $all_data['company_id'] = $company_id;
+        } else {
+            $map['company_id']  = $admin_company_id;
+            $all_data['company_id'] = $admin_company_id;
+        }
         $data = $LowPriceGoodsModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
+
         $result     =  $LowPriceGoodsModel->addLowPriceGoods($all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '新增失败']);
@@ -517,6 +548,14 @@ class LowPriceGoods extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map['company_id'] = $company_id;
+            $all_data['company_id'] = $company_id;
+        } else {
+            $map['company_id']  = $admin_company_id;
+            $all_data['company_id'] = $admin_company_id;
+        }
         $data = $LowPriceGoodsModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
@@ -547,8 +586,18 @@ class LowPriceGoods extends Controller
         $status            = request('status', 0);
         // 查询用户
         $where = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $where['company_id'] = $company_id;
+        } else {
+            $where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoods = $LowPriceGoodsModel->where($where)->first();
+        if (!$LowPriceGoods) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $LowPriceGoods->status = $status;
+        $LowPriceGoods->update_time = time();
         // 执行修改
-        $result            =  $LowPriceGoodsModel->changeStatus($where, $status);
+        $result            =  $LowPriceGoods->save();
         // 提示新增失败
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 告知结果
@@ -574,8 +623,18 @@ class LowPriceGoods extends Controller
         $processing_status = request('processing_status', 0);
         // 查询用户
         $where = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $where['company_id'] = $company_id;
+        } else {
+            $where['company_id']  = $admin_company_id;
+        }
+         $LowPriceGoods = $LowPriceGoodsModel->where($where)->first();
+        if (!$LowPriceGoods) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $LowPriceGoods->processing_status = $processing_status;
+        $LowPriceGoods->update_time = time();
         // 执行修改
-        $result            =  $LowPriceGoodsModel->changeProcessingStatus($where, $processing_status);
+        $result            =  $LowPriceGoods->save();
         // 提示新增失败
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 告知结果
@@ -601,8 +660,16 @@ class LowPriceGoods extends Controller
         $id = request('id', 0);
         // 查询用户
         $where = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $where['company_id'] = $company_id;
+        } else {
+            $where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoods = $LowPriceGoodsModel->where($where)->first();
+        if (!$LowPriceGoods) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         // 执行删除
-        $result =  $LowPriceGoodsModel->deleteLowPriceGoods($where);
+        $result =  $LowPriceGoods->delete();
         // 提示删除失败
         if (!$result)    return json_send(['code' => 'error', 'msg' => '删除失败']);
         // 告知结果
@@ -624,8 +691,14 @@ class LowPriceGoods extends Controller
         $company_id = request('access_token.company_id', '0');
         $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $admin_id   = request('access_token.uid', 0); //用户ID
-        $is_admin   = request('access_token.is_admin'); //是否管理员操作 0=是1=否
-        $message_data = ['page' => '1', 'limit' => 50, 'admin_id' => $admin_id,'is_admin' => $is_admin];
+        $select_company_id = 0;
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $select_company_id = $company_id;
+        } else {
+            $select_company_id  = $admin_company_id;
+        }
+        $message_data = ['page' => '1', 'limit' => 50, 'admin_id' => $admin_id,'is_admin' => $is_admin,'select_company_id' => $select_company_id];
         LowPriceGoodsJobs::dispatch($message_data);
         // LowPriceGoodsJobs::dispatchSync($message_data);
         // 告知结果
@@ -653,6 +726,12 @@ class LowPriceGoods extends Controller
         $all_data = request()->all();
         $id = request('id', 0);
         $where = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $where['company_id'] = $company_id;
+        } else {
+            $where['company_id']  = $admin_company_id;
+        }
         $LowPriceGoods = $LowPriceGoodsModel->where($where)->first();
         if (!$LowPriceGoods) return json_send(['code' => 'error', 'msg' => '违规记录不存在']);
         if ($LowPriceGoods->processing_status != '1') return json_send(['code' => 'error', 'msg' => '当前状态不是待处理,流程调用错误']);
@@ -712,6 +791,12 @@ class LowPriceGoods extends Controller
         $all_data = request()->all();
         $id = request('id', 0);
         $where = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $where['company_id'] = $company_id;
+        } else {
+            $where['company_id']  = $admin_company_id;
+        }
         $LowPriceGoods = $LowPriceGoodsModel->where($where)->first();
         if (!$LowPriceGoods) return json_send(['code' => 'error', 'msg' => '违规记录不存在']);
         if ($LowPriceGoods->processing_status != '1') return json_send(['code' => 'error', 'msg' => '当前状态不是待处理,流程调用错误']);
@@ -768,6 +853,12 @@ class LowPriceGoods extends Controller
         $all_data = request()->all();
         $id = request('id', 0);
         $where = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $where['company_id'] = $company_id;
+        } else {
+            $where['company_id']  = $admin_company_id;
+        }
         $LowPriceGoods = $LowPriceGoodsModel->where($where)->first();
         if (!$LowPriceGoods) return json_send(['code' => 'error', 'msg' => '违规记录不存在']);
         if ($LowPriceGoods->processing_status != '2') return json_send(['code' => 'error', 'msg' => '当前状态不是购买中,流程调用错误']);
@@ -926,6 +1017,12 @@ class LowPriceGoods extends Controller
             if($city_name && !strpos($city_name,'市')){
                 $city_name = $city_name.'市';
             }
+            // 权限判断
+            if ($is_admin != 1 && $company_id != 0) {
+                $insert_product_data['company_id'] = $company_id;
+            } else {
+                $insert_product_data['company_id']  = $admin_company_id;
+            }
             $insert_product_data['first_responsible_person'] = !empty($first_responsible_person_id) ? implode(',', $first_responsible_person_id) : ''; //第一责任人ID集合
             $insert_product_data['responsible_person'] = !empty($responsible_person_id) ? implode(',', $responsible_person_id) : ''; //责任人ID集合
             $insert_product_data['platform'] = isset($platform_data[$item[2]]) ? $platform_data[$item[2]] : '0'; // 平台

+ 51 - 1
app/Http/Controllers/Manager/Process/ViolationProduct.php

@@ -65,6 +65,15 @@ class ViolationProduct extends Controller
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
         if ($company_name) $map[] = ['company_name', 'like', "%$company_name%"];
 
+        $violation_product_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $violation_product_where['company_id'] = $company_id;
+        } else {
+           $violation_product_where['company_id']  = $admin_company_id;
+        }
+        $ViolationProductModel = $ViolationProductModel->where($violation_product_where);
+
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -194,6 +203,15 @@ class ViolationProduct extends Controller
         if ($store_name) $map[]   = ['store_name', 'like', "%$store_name%"];
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
 
+        $violation_product_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $violation_product_where['company_id'] = $company_id;
+        } else {
+           $violation_product_where['company_id']  = $admin_company_id;
+        }
+        $ViolationProductModel = $ViolationProductModel->where($violation_product_where);
+
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -445,6 +463,12 @@ class ViolationProduct extends Controller
         // 接收参数
         $id = request('id', 0);
         $map = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map['company_id'] = $company_id;
+        } else {
+           $map['company_id']  = $admin_company_id;
+        }
         $data = $ViolationProductModel->where($map)->first();
         if (!$data)     return json_send(['code' => 'error', 'msg' => '记录不存在']);
         //查询第一责任人名称
@@ -482,6 +506,14 @@ class ViolationProduct extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map['company_id'] = $company_id;
+            $all_data['company_id'] = $company_id;
+        } else {
+           $map['company_id']  = $admin_company_id;
+           $all_data['company_id'] = $admin_company_id;
+        }
         $data = $ViolationProductModel->where($map)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 写入数据表
@@ -513,6 +545,14 @@ class ViolationProduct extends Controller
         $all_data['store_scope'] = $store_scope;
         //查询是否存在
         $map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs']];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map['company_id'] = $company_id;
+            $all_data['company_id'] = $company_id;
+        } else {
+           $map['company_id']  = $admin_company_id;
+           $all_data['company_id'] = $admin_company_id;
+        }
         $data = $ViolationProductModel->where($map)->where('id', '!=', $id)->first();
         if ($data)     return json_send(['code' => 'error', 'msg' => '记录已存在']);
         // 更新数据表
@@ -543,8 +583,18 @@ class ViolationProduct extends Controller
         $status            = request('status', 0);
         // 查询用户
         $where = ['id' => $id];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $where['company_id'] = $company_id;
+        } else {
+            $where['company_id'] = $admin_company_id;
+        }
+        $ViolationProduct = $ViolationProductModel->where($where)->first();
+        if (!$ViolationProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $ViolationProduct->status = $status;
+        $ViolationProduct->update_time = time();
         // 执行修改
-        $result            =  $ViolationProductModel->changeStatus($where, $status);
+        $result            =  $ViolationProduct->save();
         // 提示新增失败
         if (!$result)    return json_send(['code' => 'error', 'msg' => '设置失败']);
         // 告知结果

+ 163 - 67
app/Http/Controllers/Manager/Statistics/OverviewPanel.php

@@ -37,22 +37,28 @@ class OverviewPanel extends Controller
         $request->scene('getViolationLinkCount')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $limit = request('limit', config('page_num', 10));
         $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一天
-        if(date('Y-m-d', $start_time)!= date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
+        if (date('Y-m-d', $start_time) != date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $violationProductModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(link_url) as count')])->distinct('link_url')->orderby('count', 'desc')
             ->groupby('company_name')->paginate($limit);
@@ -70,21 +76,27 @@ class OverviewPanel extends Controller
     {
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一天
-        if(date('Y-m-d', $start_time)!= date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
+        if (date('Y-m-d', $start_time) != date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $violationProductModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(link_url) as count')])->distinct('link_url')->orderby('count', 'desc')
             ->groupby('company_name')->get()->toarray();
@@ -130,7 +142,7 @@ class OverviewPanel extends Controller
         // 创建Excel文件
         $filename = '禁止挂网链接数统计数据' . $file_id . '.xlsx';
         $path = public_path('uploads/exports/');
-        $fullPath = $path. $filename;
+        $fullPath = $path . $filename;
         if (!is_dir($path))         mkdir($path, 0777, true);
 
         // 生成 Excel 文件
@@ -158,22 +170,28 @@ class OverviewPanel extends Controller
         $request->scene('get_violation_company_count')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $limit = request('limit', config('page_num', 10));
         $yesterdayStart = Carbon::now()->startOfMonth()->getTimestamp(); // 本月第一天 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一个月
-        if(date('Y-m', $start_time)!= date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
+        if (date('Y-m', $start_time) != date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $violationProductModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(company_name) as count')])->distinct('company_name')->orderby('count', 'desc')
             ->groupby('company_name')->paginate($limit);
@@ -191,21 +209,27 @@ class OverviewPanel extends Controller
     {
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $yesterdayStart = Carbon::now()->startOfMonth()->getTimestamp(); // 本月第一天 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一个月
-        if(date('Y-m', $start_time)!= date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
+        if (date('Y-m', $start_time) != date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $violationProductModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(company_name) as count')])->distinct('company_name')->orderby('count', 'desc')
             ->groupby('company_name')->get()->toarray();
@@ -251,7 +275,7 @@ class OverviewPanel extends Controller
         // 创建Excel文件
         $filename = '禁止挂网公司月度统计数据' . $file_id . '.xlsx';
         $path = public_path('uploads/exports/');
-        $fullPath = $path. $filename;
+        $fullPath = $path . $filename;
         if (!is_dir($path))         mkdir($path, 0777, true);
 
         // 生成 Excel 文件
@@ -280,22 +304,28 @@ class OverviewPanel extends Controller
         $request->scene('getLowPriceLinkCount')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $limit = request('limit', config('page_num', 10));
         $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一天
-        if(date('Y-m-d', $start_time)!= date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
+        if (date('Y-m-d', $start_time) != date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $LowPriceGoodsModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(link_url) as count')])->distinct('link_url')->orderby('count', 'desc')
             ->groupby('company_name')->paginate($limit);
@@ -313,21 +343,27 @@ class OverviewPanel extends Controller
     {
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $yesterdayStart = Carbon::yesterday()->startOfDay()->getTimestamp(); // 昨天开始时间 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一天
-        if(date('Y-m-d', $start_time)!= date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
+        if (date('Y-m-d', $start_time) != date('Y-m-d', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一天', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $LowPriceGoodsModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(link_url) as count')])->distinct('link_url')->orderby('count', 'desc')
             ->groupby('company_name')->get()->toarray();
@@ -373,7 +409,7 @@ class OverviewPanel extends Controller
         // 创建Excel文件
         $filename = '低价违规挂网链接数统计数据' . $file_id . '.xlsx';
         $path = public_path('uploads/exports/');
-        $fullPath = $path. $filename;
+        $fullPath = $path . $filename;
         if (!is_dir($path))         mkdir($path, 0777, true);
 
         // 生成 Excel 文件
@@ -401,22 +437,28 @@ class OverviewPanel extends Controller
         $request->scene('getLowPriceCompanyCount')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $limit = request('limit', config('page_num', 10));
         $yesterdayStart = Carbon::now()->startOfMonth()->getTimestamp(); // 本月第一天 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一个月
-        if(date('Y-m', $start_time)!= date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
+        if (date('Y-m', $start_time) != date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $LowPriceGoodsModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(company_name) as count')])->distinct('company_name')->orderby('count', 'desc')
             ->groupby('company_name')->paginate($limit);
@@ -434,21 +476,27 @@ class OverviewPanel extends Controller
     {
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         $yesterdayStart = Carbon::now()->startOfMonth()->getTimestamp(); // 本月第一天 00:00:00
         $yesterdayEnd = Carbon::yesterday()->endOfDay()->getTimestamp(); // 昨天结束时间 23:59:59
-        $start_time_string = request('start_time','');
-        $end_time_string = request('end_time','');
-        $start_time = $start_time_string? strtotime($start_time_string.' 00:00:00') : $yesterdayStart;
-        $end_time = $end_time_string? strtotime($end_time_string.' 23:59:59') : $yesterdayEnd;
+        $start_time_string = request('start_time', '');
+        $end_time_string = request('end_time', '');
+        $start_time = $start_time_string ? strtotime($start_time_string . ' 00:00:00') : $yesterdayStart;
+        $end_time = $end_time_string ? strtotime($end_time_string . ' 23:59:59') : $yesterdayEnd;
         $todayStart = Carbon::today()->startOfDay()->getTimestamp(); // 今天开始时间 00:00:00
-        if($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
+        if ($start_time > $todayStart || $end_time > $todayStart) return  json_send(['code' => 'error', 'msg' => '不支持查询今天或以后时间', 'data' => '']);
         //校验开始时间结束时间是否在同一个月
-        if(date('Y-m', $start_time)!= date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
+        if (date('Y-m', $start_time) != date('Y-m', $end_time)) return  json_send(['code' => 'error', 'msg' => '开始时间和结束时间必须在同一个月', 'data' => '']);
         // 时间条件
         $map  = [];
         if ($start_time) $map[] = ['insert_time', '>=', $start_time];
         if ($end_time) $map[]   = ['insert_time', '<=', $end_time];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $map[] = ['company_id', '=', $company_id];
+        } else {
+            $map[] = ['company_id', '=', $admin_company_id];
+        }
         $result = $LowPriceGoodsModel->where($map)->where('status', 0)
             ->select(['company_name', DB::raw('count(company_name) as count')])->distinct('company_name')->orderby('count', 'desc')
             ->groupby('company_name')->get()->toarray();
@@ -493,7 +541,7 @@ class OverviewPanel extends Controller
         // 创建Excel文件
         $filename = '低价违规挂网公司月度统计数据' . $file_id . '.xlsx';
         $path = public_path('uploads/exports/');
-        $fullPath = $path. $filename;
+        $fullPath = $path . $filename;
         if (!is_dir($path))         mkdir($path, 0777, true);
 
         // 生成 Excel 文件
@@ -521,7 +569,7 @@ class OverviewPanel extends Controller
         $request->scene('get_product_trend')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         // 查询条件
         $map  = [];
         $status    = request('status', '');
@@ -545,6 +593,18 @@ class OverviewPanel extends Controller
         if ($store_name) $map[]   = ['store_name', 'like', "%$store_name%"];
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
 
+        $low_price_goods_where = [];
+        $violation_product_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $low_price_goods_where['company_id'] = $company_id;
+            $violation_product_where['company_id'] = $company_id;
+        } else {
+           $low_price_goods_where['company_id']  = $admin_company_id;
+           $violation_product_where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoodsModel = $LowPriceGoodsModel->where($low_price_goods_where);
+        $violationProductModel = $violationProductModel->where($violation_product_where);
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -686,7 +746,7 @@ class OverviewPanel extends Controller
         $request->scene('product_trend_export')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         // 查询条件
         $map  = [];
         $status    = request('status', '');
@@ -710,6 +770,18 @@ class OverviewPanel extends Controller
         if ($store_name) $map[]   = ['store_name', 'like', "%$store_name%"];
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
 
+        $low_price_goods_where = [];
+        $violation_product_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $low_price_goods_where['company_id'] = $company_id;
+            $violation_product_where['company_id'] = $company_id;
+        } else {
+           $low_price_goods_where['company_id']  = $admin_company_id;
+           $violation_product_where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoodsModel = $LowPriceGoodsModel->where($low_price_goods_where);
+        $violationProductModel = $violationProductModel->where($violation_product_where);
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -883,7 +955,7 @@ class OverviewPanel extends Controller
         // 创建Excel文件
         $filename = '商品数量趋势统计数据' . $file_id . '.xlsx';
         $path = public_path('uploads/exports/');
-        $fullPath = $path. $filename;
+        $fullPath = $path . $filename;
         if (!is_dir($path))         mkdir($path, 0777, true);
 
         // 生成 Excel 文件
@@ -911,7 +983,7 @@ class OverviewPanel extends Controller
         $request->scene('get_store_trend')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         // 查询条件
         $map  = [];
         $status    = request('status', '');
@@ -935,6 +1007,18 @@ class OverviewPanel extends Controller
         if ($store_name) $map[]   = ['store_name', 'like', "%$store_name%"];
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
 
+        $low_price_goods_where = [];
+        $violation_product_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $low_price_goods_where['company_id'] = $company_id;
+            $violation_product_where['company_id'] = $company_id;
+        } else {
+           $low_price_goods_where['company_id']  = $admin_company_id;
+           $violation_product_where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoodsModel = $LowPriceGoodsModel->where($low_price_goods_where);
+        $violationProductModel = $violationProductModel->where($violation_product_where);
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -1076,7 +1160,7 @@ class OverviewPanel extends Controller
         $request->scene('store_trend_export')->validate();
         $admin_company_id = request('admin_company_id', '0');
         $company_id = request('access_token.company_id', '0');
-        $is_admin = request('access_token.is_admin', '0');//是否管理员操作 0=是1=否
+        $is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
         // 查询条件
         $map  = [];
         $status    = request('status', '');
@@ -1099,7 +1183,19 @@ class OverviewPanel extends Controller
         if ($product_name) $map[] = ['product_name', 'like', "%$product_name%"];
         if ($store_name) $map[]   = ['store_name', 'like', "%$store_name%"];
         if ($category_name) $map[] = ['category_name', 'like', "%$category_name%"];
-
+        
+        $low_price_goods_where = [];
+        $violation_product_where = [];
+        // 权限判断
+        if ($is_admin != 1 && $company_id != 0) {
+            $low_price_goods_where['company_id'] = $company_id;
+            $violation_product_where['company_id'] = $company_id;
+        } else {
+           $low_price_goods_where['company_id']  = $admin_company_id;
+           $violation_product_where['company_id']  = $admin_company_id;
+        }
+        $LowPriceGoodsModel = $LowPriceGoodsModel->where($low_price_goods_where);
+        $violationProductModel = $violationProductModel->where($violation_product_where);
         //多选平台查询
         if ($platform && is_string($platform)) {
             $platform = explode(',', $platform);
@@ -1272,7 +1368,7 @@ class OverviewPanel extends Controller
         // 创建Excel文件
         $filename = '商家数量趋势统计数据_' . $file_id . '.xlsx';
         $path = public_path('uploads/exports/');
-        $fullPath = $path. $filename;
+        $fullPath = $path . $filename;
         if (!is_dir($path))         mkdir($path, 0777, true);
         // 生成 Excel 文件
         $writer = new Xlsx($spreadsheet);