cqpCow 1 year ago
parent
commit
bb26cf535c
1 changed files with 12 additions and 1 deletions
  1. 12 1
      app/Http/Controllers/Api/ScreenController.php

+ 12 - 1
app/Http/Controllers/Api/ScreenController.php

@@ -48,6 +48,8 @@ class ScreenController extends BaseController
         $result = SaleOrdersProduct::where('del_time',0)
         $result = SaleOrdersProduct::where('del_time',0)
             ->select(DB::raw('sum(order_quantity) as total'), DB::raw('sum(finished_num) as finished_num'),'out_order_no as Code','customer_name as CustomerName')
             ->select(DB::raw('sum(order_quantity) as total'), DB::raw('sum(finished_num) as finished_num'),'out_order_no as Code','customer_name as CustomerName')
             ->groupBy('out_order_no')
             ->groupBy('out_order_no')
+            ->orderBy('id', 'desc') // 添加这一行以按创建时间降序排序
+            ->take(200)                    // 添加这一行以限制结果集大小为100
             ->get()->toArray();
             ->get()->toArray();
 
 
         if(! empty($result)){
         if(! empty($result)){
@@ -249,7 +251,16 @@ class ScreenController extends BaseController
 
 
     function getDay(){
     function getDay(){
         // 获取当前季度的开始日期
         // 获取当前季度的开始日期
-        $quarter = date('Q'); // 获取当前季度的数字表示(1、2、3或4)
+        $month = date('m');
+        if ($month >= 1 && $month <= 3) {
+            $quarter = 1;
+        } elseif ($month >= 4 && $month <= 6) {
+            $quarter = 2;
+        } elseif ($month >= 7 && $month <= 9) {
+            $quarter = 3;
+        } else {
+            $quarter = 4;
+        }
         $year = date('Y'); // 获取当前年份
         $year = date('Y'); // 获取当前年份
 
 
         if ($quarter == 1) {
         if ($quarter == 1) {