소스 검색

研发辅助帐相关接口

gogs 2 달 전
부모
커밋
e9d4b9e829
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      app/Service/StatisticService.php

+ 4 - 3
app/Service/StatisticService.php

@@ -637,8 +637,8 @@ class StatisticService extends Service
             }
 
         }
-//        dd($type_list);
-        $type_list = collect($type_list)->sortBy('sort')->all();
+        // 使用 values() 丢弃原始键名,重新从 0 开始建立索引
+        $type_list = collect($type_list)->sortBy('sort')->values()->all();
         // 4. 重置数组索引并返回
         return [$item_key_list,$type_list];
     }
@@ -769,7 +769,8 @@ class StatisticService extends Service
                 ];
             }
         }
-        $type_list = collect($type_list)->sortBy('sort')->all();
+        // 使用 values() 丢弃原始键名,重新从 0 开始建立索引
+        $type_list = collect($type_list)->sortBy('sort')->values()->all();
         // 4. 重置数组索引并返回
         return [$list,$type_list];
     }