Explorar o código

路径添加书名

visuddhinanda %!s(int64=2) %!d(string=hai) anos
pai
achega
ec1fbde6bf
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      app/Console/Commands/UpgradePaliText.php

+ 9 - 0
app/Console/Commands/UpgradePaliText.php

@@ -7,6 +7,7 @@ namespace App\Console\Commands;
 
 use Illuminate\Console\Command;
 use App\Models\PaliText;
+use App\Models\BookTitle;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
 
@@ -198,6 +199,14 @@ class UpgradePaliText extends Command
                         $currParent = $title_data[$currParent-1]["parent"];
                         $iLoop++;
                     }
+                    if(count($path)>0){
+                        //插入书名
+                        $bookTitle = BookTitle::where('book',$book)
+                                            ->where('paragraph',end($path)['paragraph'])
+                                            ->value('title');
+                        $path[] = ["book"=>0,"paragraph"=>0,"title"=>$bookTitle,"level"=>0];
+                    }
+
                     # 将路径反向
                     $path1 = [];
                     for ($i=count($path)-1; $i >=0 ; $i--) {