Browse Source

:bug: view=paragraphs 只显示一行

visuddhinanda 5 days ago
parent
commit
c392d33c3c
1 changed files with 4 additions and 6 deletions
  1. 4 6
      api-v13/app/Http/Controllers/ChannelController.php

+ 4 - 6
api-v13/app/Http/Controllers/ChannelController.php

@@ -177,16 +177,14 @@ class ChannelController extends Controller
                     ->where('owner_uid', config("mint.admin.root_uuid"));
                     ->where('owner_uid', config("mint.admin.root_uuid"));
                 break;
                 break;
             case 'paragraphs':
             case 'paragraphs':
-                $channels = Sentence::where('ver', '>', 1)
-                    ->where('book_id', $request->input('book_id'))
+                $channels = Sentence::where('book_id', $request->input('book_id'))
                     ->whereIn('paragraph', explode(',', $request->input('para')))
                     ->whereIn('paragraph', explode(',', $request->input('para')))
                     ->groupBy('channel_uid')->select('channel_uid')->get();
                     ->groupBy('channel_uid')->select('channel_uid')->get();
+                Log::debug('channel paragraphs', ['channels' => $channels]);
                 if (count($channels) > 0) {
                 if (count($channels) > 0) {
+                    $channelIds = array_map(fn($item) => $item['channel_uid'], $channels->toArray());
                     $table = Channel::select($indexCol)
                     $table = Channel::select($indexCol)
-                        ->where(
-                            'uid',
-                            array_map(fn($item) => $item['channel_uid'], $channels->toArray())
-                        );
+                        ->whereIn('uid', $channelIds);
                 } else {
                 } else {
                     $table = Channel::select($indexCol)->whereIsNull('uid');
                     $table = Channel::select($indexCol)->whereIsNull('uid');
                 }
                 }