Browse Source

排序复购率

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

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

4393
 
4393
 
4394
             $result[$k]['customer_count'] = $customer_count;
4394
             $result[$k]['customer_count'] = $customer_count;
4395
             $result[$k]['fugou_rate'] = $fugou_rate;
4395
             $result[$k]['fugou_rate'] = $fugou_rate;
4396
+            $result[$k]['fugou_rate_sort'] = $customer_count>0 ? round( $customer_fugou_count / $customer_count, 4 ) * 10000 : 0;
4396
 
4397
 
4397
         }
4398
         }
4398
 
4399
 
4399
         //按复购率排序
4400
         //按复购率排序
4400
-        $fugou_rate_arr = array_column($result, 'fugou_rate');
4401
+        $fugou_rate_arr = array_column($result, 'fugou_rate_sort');
4401
         array_multisort($fugou_rate_arr, SORT_DESC, $result);
4402
         array_multisort($fugou_rate_arr, SORT_DESC, $result);
4402
         $result = array_slice($result, $offset, $pageSize);
4403
         $result = array_slice($result, $offset, $pageSize);
4403
 
4404
 
4478
 
4479
 
4479
             $result[$k]['customer_count'] = $customer_count;
4480
             $result[$k]['customer_count'] = $customer_count;
4480
             $result[$k]['fugou_rate'] = $fugou_rate;
4481
             $result[$k]['fugou_rate'] = $fugou_rate;
4482
+            $result[$k]['fugou_rate_sort'] = $customer_count>0 ? round( $customer_fugou_count / $customer_count, 4 ) * 10000 : 0;
4481
         }
4483
         }
4482
 
4484
 
4483
         //按复购率排序
4485
         //按复购率排序
4484
-        $fugou_rate_arr = array_column($result, 'fugou_rate');
4486
+        $fugou_rate_arr = array_column($result, 'fugou_rate_sort');
4485
         array_multisort($fugou_rate_arr, SORT_DESC, $result);
4487
         array_multisort($fugou_rate_arr, SORT_DESC, $result);
4486
 
4488
 
4487
         $indexKey = ['admin_name','pv_count','long_count','fan_add','change_rate','customer_count','order_count','order_amount','fugou_rate'];
4489
         $indexKey = ['admin_name','pv_count','long_count','fan_add','change_rate','customer_count','order_count','order_amount','fugou_rate'];