Ver Fonte

update:调整列表结构

aiden há 3 meses atrás
pai
commit
67f5738c18
1 ficheiros alterados com 9 adições e 7 exclusões
  1. 9 7
      app/controller/GameRecord.php

+ 9 - 7
app/controller/GameRecord.php

@@ -67,7 +67,7 @@ class GameRecord extends BaseController
             $thirdGids = array_unique(array_column($result['list'], 'third_gid'));
 
             $childOrderList = [];
-            if(count($thirdGids) > 0) {
+            if (count($thirdGids) > 0) {
                 $tempCheckList = GameBetGameModel::where([ ['third_gid', 'in', $thirdGids], ['action_type','=',2] ])->withoutField('result')->select()->toArray();
                 foreach ($tempCheckList as $item) {
                     if(!isset($childOrderList[$item['third_gid']])) {
@@ -92,20 +92,22 @@ class GameRecord extends BaseController
                 $item['game_image_url'] = $gameImages['image_url'] ?? '';
                 $item['game_title'] = $gameInfo['title'] ?? '';
                 $item['game_type_text'] = CommonUtils::getGameTypeConfig($item['game_type']);
-                
-                if(isset($childOrderList[$thirdGid])) {
-                    $item['children'] = [];
+                $item['c_count'] = count($childOrderList[$thirdGid] ?? []);
+                $item['view_layout_url'] = "/history/{$game_id}.html?sid={$thirdGid}&pf=1&lang=zh&api=".Request::host()."%2Fweb-api%2Fgame-proxy%2Fv2%2FBetDetails%2FGet";
+
+                $children = [];
+                if (isset($childOrderList[$thirdGid])) {
                     $childList = $childOrderList[$thirdGid];
                     foreach ($childList as $citem) {
                         $citem['game_type_text'] = $item['game_type_text'];
                         $citem['game_image_url'] = $item['game_image_url'];
                         $citem['game_title'] = $item['game_title'];
-                        $item['children'][] = $citem;
+                        $children[] = $citem;
                     }
                 }
-                $item['c_count'] = count($childOrderList[$thirdGid] ?? []);
-                $item['view_layout_url'] = "/history/{$game_id}.html?sid={$thirdGid}&pf=1&lang=zh&api=".Request::host()."%2Fweb-api%2Fgame-proxy%2Fv2%2FBetDetails%2FGet";
+
                 $newDataList[] = $item;
+                $newDataList = array_merge($newDataList, $children);
             }
             
             $result['list'] = $newDataList;