Browse Source

字典正文显示全名

visuddhinanda 3 years ago
parent
commit
aff2b4c6f3
1 changed files with 5 additions and 4 deletions
  1. 5 4
      app/Http/Controllers/DictController.php

+ 5 - 4
app/Http/Controllers/DictController.php

@@ -42,17 +42,18 @@ class DictController extends Controller
         ];
         foreach ($result as $key => $value) {
             # code...
-            $dictName= DictInfo::find($value->dict_id)->shortname;
-            $anchor = "{$word}-$dictName";
+            $dictInfo= DictInfo::find($value->dict_id);
+
+            $anchor = "{$word}-{$dictInfo->shortname}";
             $wordData['dict'][] = [
-                'dictname'=> $dictName,
+                'dictname'=> $dictInfo->name,
                 'word'=> $word,
                 'note'=> $this->GrmAbbr($value->note,0),
                 'anchor'=> $anchor,
             ];
             $dictList['children'][] = [
                 'href'=> '#'.$anchor,
-                'title'=> "{$dictName}",
+                'title'=> "{$dictInfo->shortname}",
             ];
         }
         $wordDataOutput[]=$wordData;