sunhao 5 years ago
parent
commit
9835450697
1 changed files with 8 additions and 1 deletions
  1. 8 1
      app/Http/Controllers/Admin/TemplateController.php

+ 8 - 1
app/Http/Controllers/Admin/TemplateController.php

646
             if($mstime) $query->where('create_time', '>=', $mstime);
646
             if($mstime) $query->where('create_time', '>=', $mstime);
647
             if($metime) $query->where('create_time', '<', $metime);
647
             if($metime) $query->where('create_time', '<', $metime);
648
             if($sale_ids !== null) $query->whereIn('admin_id', $sale_ids);
648
             if($sale_ids !== null) $query->whereIn('admin_id', $sale_ids);
649
-        })->groupBy('month')->groupBy('admin_id')->orderBy('month', 'desc')->offset($offset)->limit($pageSize)->get();
649
+        })->groupBy('month')->groupBy('admin_id')->orderBy('month', 'desc')->get();
650
         $result = json_decode(json_encode($result), true);
650
         $result = json_decode(json_encode($result), true);
651
         foreach($result as $k=>&$v){
651
         foreach($result as $k=>&$v){
652
             //起止时间
652
             //起止时间
691
 
691
 
692
         }
692
         }
693
 
693
 
694
+        $sort_c = array_column($result, 'avg_amount');
695
+        array_multisort($sort_c,SORT_DESC,$result);
696
+        $result = array_slice($result, $offset, $pageSize);
697
+
694
         $teamList = DB::table('teams')->select('id', 'name')->get();
698
         $teamList = DB::table('teams')->select('id', 'name')->get();
695
         $teamList = json_decode(json_encode($teamList), true);
699
         $teamList = json_decode(json_encode($teamList), true);
696
         $adminList = DB::table('admin')->select('id', 'realname', 'username')->where('id','>', 1)->get();
700
         $adminList = DB::table('admin')->select('id', 'realname', 'username')->where('id','>', 1)->get();
780
 
784
 
781
         }
785
         }
782
 
786
 
787
+        $sort_c = array_column($result, 'avg_amount');
788
+        array_multisort($sort_c,SORT_DESC,$result);
789
+
783
         $indexKey = ['month','admin_name','pv_count','long_count','fan_add','cust_count','order_count','fugou_order_count','order_amount','change_rate','new_order_rate','cust_fugou_rate','order_fugou_rate','avg_amount'];
790
         $indexKey = ['month','admin_name','pv_count','long_count','fan_add','cust_count','order_count','fugou_order_count','order_amount','change_rate','new_order_rate','cust_fugou_rate','order_fugou_rate','avg_amount'];
784
         $title = ['月份', '销售名', '当月PV量', '当月长按次数', '当月上报加粉数', '当月新粉下单人数', '新粉下单单数', '当月粉丝复购单数', '当月粉丝总销售额', '粉丝转化率', '新粉下单率', '新粉复购率', '新粉订单复购率', '当月粉丝人均销售额'];
791
         $title = ['月份', '销售名', '当月PV量', '当月长按次数', '当月上报加粉数', '当月新粉下单人数', '新粉下单单数', '当月粉丝复购单数', '当月粉丝总销售额', '粉丝转化率', '新粉下单率', '新粉复购率', '新粉订单复购率', '当月粉丝人均销售额'];
785
         $filename = 'daofenyuebao_'.date('Y-m-d_H').'.xlsx';
792
         $filename = 'daofenyuebao_'.date('Y-m-d_H').'.xlsx';