cqp 6 日 前
コミット
5133acfbed
1 ファイル変更7 行追加14 行削除
  1. 7 14
      app/Service/StatisticsService.php

+ 7 - 14
app/Service/StatisticsService.php

@@ -234,8 +234,7 @@ class StatisticsService extends Service
         //总社id
         $head = $user['head']['id'] ?? 0;
         //当前门店
-        $current_top_depart_id = $user['depart_top'][0] ?? [];
-        $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+        $current_top_depart_id = $this->getMyTopDepart($user);
 
         //需要所有数据的门店
         $setting = Setting::where('setting_name','bt_top_depart_id')->first();
@@ -306,8 +305,7 @@ class StatisticsService extends Service
         //总社id
         $head = $user['head']['id'] ?? 0;
         //当前门店
-        $current_top_depart_id = $user['depart_top'][0] ?? [];
-        $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+        $current_top_depart_id = $this->getMyTopDepart($user);
 
         //销售订单类型
         $model_type = 0;
@@ -436,8 +434,7 @@ class StatisticsService extends Service
         //总社id
         $head = $user['head']['id'] ?? 0;
         //当前门店
-        $current_top_depart_id = $user['depart_top'][0] ?? [];
-        $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+        $current_top_depart_id = $this->getMyTopDepart($user);
 
         //销售订单类型
         $model_type = 0;
@@ -561,8 +558,7 @@ class StatisticsService extends Service
         //总社id
         $head = $user['head']['id'] ?? 0;
         //当前门店
-        $current_top_depart_id = $user['depart_top'][0] ?? [];
-        $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+        $current_top_depart_id = $this->getMyTopDepart($user);
 
         //销售订单类型
         $model_type = 0;
@@ -662,8 +658,7 @@ class StatisticsService extends Service
         //总社id
         $head = $user['head']['id'] ?? 0;
         //当前门店
-        $current_top_depart_id = $user['depart_top'][0] ?? [];
-        $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+        $current_top_depart_id = $this->getMyTopDepart($user);
 
         //特殊的门店
         $setting = Setting::where('setting_name','bt_top_depart_id')->first();
@@ -872,8 +867,7 @@ class StatisticsService extends Service
         //总社id
         $head = $user['head']['id'] ?? 0;
         //当前门店
-        $current_top_depart_id = $user['depart_top'][0] ?? [];
-        $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+        $current_top_depart_id = $this->getMyTopDepart($user);
 
         //线下 销售订单类型
         $model_type = SalesOrder::Model_type_one;
@@ -1007,8 +1001,7 @@ class StatisticsService extends Service
         //总社id
         $head = $user['head']['id'] ?? 0;
         //当前门店
-        $current_top_depart_id = $user['depart_top'][0] ?? [];
-        $current_top_depart_id = $current_top_depart_id['depart_id'] ?? 0;
+        $current_top_depart_id = $this->getMyTopDepart($user);
 
         //线下 销售订单类型
         $model_type = SalesOrder::Model_type_four;