sunhao 5 years ago
parent
commit
af38f944f8
1 changed files with 10 additions and 2 deletions
  1. 10 2
      app/Http/Controllers/Admin/StatisticsController.php

+ 10 - 2
app/Http/Controllers/Admin/StatisticsController.php

@@ -4358,8 +4358,7 @@ class StatisticsController extends Controller
4358 4358
 
4359 4359
         $offset = ($page-1) * $pageSize;
4360 4360
         $count = count($saler_ids);
4361
-        $saler_ids = array_slice($saler_ids, $offset, $pageSize);
4362
-
4361
+    
4363 4362
         //销售名字
4364 4363
         $name_arr = DB::table('admin')->whereIn('id', $saler_ids)->lists('realname', 'id');
4365 4364
         $result = array();
@@ -4397,6 +4396,11 @@ class StatisticsController extends Controller
4397 4396
 
4398 4397
         }
4399 4398
 
4399
+        //按复购率排序
4400
+        $fugou_rate_arr = array_column($result, 'fugou_rate');
4401
+        array_multisort($fugou_rate_arr, SORT_DESC, $result);
4402
+        $result = array_slice($result, $offset, $pageSize);
4403
+
4400 4404
         if ($count > 1) {
4401 4405
             // 总页数
4402 4406
             $pages = ceil($count/$pageSize);
@@ -4476,6 +4480,10 @@ class StatisticsController extends Controller
4476 4480
             $result[$k]['fugou_rate'] = $fugou_rate;
4477 4481
         }
4478 4482
 
4483
+        //按复购率排序
4484
+        $fugou_rate_arr = array_column($result, 'fugou_rate');
4485
+        array_multisort($fugou_rate_arr, SORT_DESC, $result);
4486
+
4479 4487
         $indexKey = ['admin_name','pv_count','long_count','fan_add','change_rate','customer_count','order_count','order_amount','fugou_rate'];
4480 4488
         $title = ['销售', 'PV量', '累计预估加粉数', '累计加粉数', '加粉转化率', '下单用户数', '累计下单数', '累计销售额', '复购率'];
4481 4489
         $filename = 'xiaoshoufugou_'.date('Y-m-d_H').'.xlsx';