Browse Source

Merge pull request #2246 from visuddhinanda/development

添加复制字典引用功能
visuddhinanda 1 year ago
parent
commit
da9dcbd6d8
54 changed files with 347 additions and 162 deletions
  1. 91 90
      api-v8/app/Http/Controllers/DictController.php
  2. 71 0
      api-v8/app/Http/Controllers/SearchWordSliceController.php
  3. 4 1
      api-v8/app/Tools/CaseMan.php
  4. 1 1
      api-v8/public/dicttext/cm/pm-grammar-paper/pm-grammar1.ini
  5. 1 1
      api-v8/public/dicttext/cm/pm-grammar/pm.ini
  6. 1 1
      api-v8/public/dicttext/cm/sys_irregular/sys_irregular.ini
  7. 1 1
      api-v8/public/dicttext/cm/union/union.ini
  8. 1 1
      api-v8/public/dicttext/en/buddhist-paper/index.ini
  9. 4 3
      api-v8/public/dicttext/en/concise-paper/concise.ini
  10. 1 1
      api-v8/public/dicttext/en/concise/concise.ini
  11. 3 2
      api-v8/public/dicttext/en/critical-1/index.ini
  12. 1 1
      api-v8/public/dicttext/en/critical-2/index.ini
  13. 1 1
      api-v8/public/dicttext/en/critical-3/index.ini
  14. 1 1
      api-v8/public/dicttext/en/my-en/index.ini
  15. 1 1
      api-v8/public/dicttext/en/pali-root-paper/index.ini
  16. 1 1
      api-v8/public/dicttext/en/proper-names-paper/index.ini
  17. 1 1
      api-v8/public/dicttext/en/pts-papter/index.ini
  18. 1 1
      api-v8/public/dicttext/en/speed-up-paper/index.ini
  19. 1 1
      api-v8/public/dicttext/en/u-hau-sein-pali-roma-paper/index.ini
  20. 1 1
      api-v8/public/dicttext/en/unity/uhau_en.ini
  21. 1 1
      api-v8/public/dicttext/en/vir-paper copy/index.ini
  22. 2 2
      api-v8/public/dicttext/jp/syhy-paper/index.ini
  23. 7 7
      api-v8/public/dicttext/jp/syzb-paper/syzb.ini
  24. 1 1
      api-v8/public/dicttext/my/pali-roots-paper/index.ini
  25. 1 1
      api-v8/public/dicttext/my/pmt-paper/index.ini
  26. 1 1
      api-v8/public/dicttext/my/u-hau-sein-my-papter/index.ini
  27. 1 1
      api-v8/public/dicttext/my/u_hau_sein/u_hau_sein.ini
  28. 1 1
      api-v8/public/dicttext/si/palisinhala/pali_sinhala.ini
  29. 1 1
      api-v8/public/dicttext/vi/abhi-terms-paper/index.ini
  30. 1 1
      api-v8/public/dicttext/vi/pali-vi-paper/index.ini
  31. 1 1
      api-v8/public/dicttext/vi/vinaya-terms-paper/index.ini
  32. 1 1
      api-v8/public/dicttext/zh/bh-paper/bh-paper.ini
  33. 1 1
      api-v8/public/dicttext/zh/bhfxch-paper/index.ini
  34. 1 1
      api-v8/public/dicttext/zh/bhmf-paper/index.ini
  35. 1 1
      api-v8/public/dicttext/zh/bhmf/bhmf.ini
  36. 1 1
      api-v8/public/dicttext/zh/blyrm-paper/index.ini
  37. 1 1
      api-v8/public/dicttext/zh/blyzh-paper/index.ini
  38. 1 1
      api-v8/public/dicttext/zh/bysy-paper/index.ini
  39. 1 1
      api-v8/public/dicttext/zh/formula/index.ini
  40. 1 1
      api-v8/public/dicttext/zh/mahinda-paper/index.ini
  41. 1 1
      api-v8/public/dicttext/zh/my-han/index.ini
  42. 1 1
      api-v8/public/dicttext/zh/my-han2/index.ini
  43. 1 1
      api-v8/public/dicttext/zh/pali-root-paper/index.ini
  44. 1 1
      api-v8/public/dicttext/zh/speed-up-paper/index.ini
  45. 1 1
      api-v8/public/dicttext/zh/syhy-huang-paper/index.ini
  46. 1 1
      api-v8/public/dicttext/zh/syhy-li-paper/index.ini
  47. 1 1
      api-v8/public/dicttext/zh/syhy-miji-paper/index.ini
  48. 1 1
      api-v8/public/dicttext/zh/syhy/shuihan.ini
  49. 1 1
      api-v8/public/dicttext/zh/yfhb-paper/index.ini
  50. 2 0
      api-v8/routes/api.php
  51. 3 3
      dashboard-v4/dashboard/src/components/dict/CaseList.tsx
  52. 61 0
      dashboard-v4/dashboard/src/components/dict/DictInfoCopyRef.tsx
  53. 2 1
      dashboard-v4/dashboard/src/components/dict/DictSearch.tsx
  54. 55 11
      dashboard-v4/dashboard/src/components/dict/WordCardByDict.tsx

+ 91 - 90
api-v8/app/Http/Controllers/DictController.php

@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
 use App\Http\Api\DictApi;
 use App\Http\Api\AuthApi;
 
-require_once __DIR__."/../../../public/app/dict/grm_abbr.php";
+require_once __DIR__ . "/../../../public/app/dict/grm_abbr.php";
 
 
 class DictController extends Controller
@@ -32,21 +32,21 @@ class DictController extends Controller
         $dictListOutput = [];
         $caseListOutput = [];
         $wordDataPass = [];
-		$indexCol = ['word','note','dict_id'];
+        $indexCol = ['word', 'note', 'dict_id'];
         $words = [];
         $word_base = [];
         $searched = [];
         $words[$request->get('word')] = [];
-        $userLang = $request->get('lang',"zh");
+        $userLang = $request->get('lang', "zh");
 
         /**
          * 临时代码判断是否在缅汉字典群里面。在群里的用户可以产看缅汉字典pdf
          */
         $user = AuthApi::current($request);
-        if($user){
-            $inMyHanGroup = GroupMember::where('group_id','905af467-1bde-4d2c-8dc7-49cfb74e0b09')
-                                       ->where('user_id',$user['user_uid'])->exists();
-        }else{
+        if ($user) {
+            $inMyHanGroup = GroupMember::where('group_id', '905af467-1bde-4d2c-8dc7-49cfb74e0b09')
+                ->where('user_id', $user['user_uid'])->exists();
+        } else {
             $inMyHanGroup = false;
         }
 
@@ -54,8 +54,8 @@ class DictController extends Controller
             // The environment is local
             $inMyHanGroup = true;
         }
-        $resultCount=0;
-        for ($i=0; $i < 2; $i++) {
+        $resultCount = 0;
+        for ($i = 0; $i < 2; $i++) {
             # code...
             $word_base = [];
             $wordDataOutput = [];
@@ -63,23 +63,23 @@ class DictController extends Controller
                 # code...
                 $searched[] = $word;
                 $table = UserDict::select($indexCol)
-                                ->where('word',$word)
-                                ->where('source','_PAPER_');
-                if(!$inMyHanGroup){
-                    $table = $table->where('dict_id','<>','8ae6e0f5-f04c-49fc-a355-4885cc08b4b3');
+                    ->where('word', $word)
+                    ->where('source', '_PAPER_');
+                if (!$inMyHanGroup) {
+                    $table = $table->where('dict_id', '<>', '8ae6e0f5-f04c-49fc-a355-4885cc08b4b3');
                     //测试代码
                     //$table = $table->where('dict_id','<>','ac9b7b73-b9c0-4d31-a5c9-7c6dc5a2c187');
                 }
                 $result = $table->get();
                 $resultCount += count($result);
                 $anchor = $word;
-                $wordData=[
-                    'word'=> $word,
-                    'factors'=> "",
-                    'parents'=> "",
-                    'case'=> [],
-                    'grammar'=>$case,
-                    'anchor'=> $anchor,
+                $wordData = [
+                    'word' => $word,
+                    'factors' => "",
+                    'parents' => "",
+                    'case' => [],
+                    'grammar' => $case,
+                    'anchor' => $anchor,
                     'dict' => [],
                 ];
                 /**
@@ -88,11 +88,11 @@ class DictController extends Controller
                  * 将查询的结果放置在对应的容器中。
                  * 最后将结果扁平化
                  * 准备字典容器
-                * $wordDict = [
-                *    "zh"=>[
-                *        "0d79e8e8-1430-4c99-a0f1-b74f2b4b26d8"=>[];
-                *    ]
-                * ]
+                 * $wordDict = [
+                 *    "zh"=>[
+                 *        "0d79e8e8-1430-4c99-a0f1-b74f2b4b26d8"=>[];
+                 *    ]
+                 * ]
                  */
 
                 foreach (DictApi::langOrder($userLang) as  $langId) {
@@ -103,34 +103,35 @@ class DictController extends Controller
                     }
                     $wordDict[$langId] = $dictContainer;
                 }
-                $dictList=[
-                    'href'=> '#'.$anchor,
-                    'title'=> "{$word}",
+                $dictList = [
+                    'href' => '#' . $anchor,
+                    'title' => "{$word}",
                     'children' => [],
                 ];
                 foreach ($result as $key => $value) {
                     # code...
-                    $dictInfo= DictInfo::find($value->dict_id);
-                    $dict_lang = explode('-',$dictInfo->dest_lang);
+                    $dictInfo = DictInfo::find($value->dict_id);
+                    $dict_lang = explode('-', $dictInfo->dest_lang);
                     $anchor = "{$word}-{$dictInfo->shortname}";
                     $currData = [
-                            'dictname'=> $dictInfo->name,
-                            'shortname'=> $dictInfo->shortname,
-                            'description'=>$dictInfo->description,
-                            'dict_id' => $value->dict_id,
-                            'lang' => $dict_lang[0],
-                            'word'=> $word,
-                            'note'=> $this->GrmAbbr($value->note,0),
-                            'anchor'=> $anchor,
+                        'dictname' => $dictInfo->name,
+                        'shortname' => $dictInfo->shortname,
+                        'description' => $dictInfo->description,
+                        'meta' => json_decode($dictInfo->meta),
+                        'dict_id' => $value->dict_id,
+                        'lang' => $dict_lang[0],
+                        'word' => $word,
+                        'note' => $this->GrmAbbr($value->note, 0),
+                        'anchor' => $anchor,
                     ];
-                    if(isset($wordDict[$dict_lang[0]])){
-                        if(isset($wordDict[$dict_lang[0]][$value->dict_id])){
-                            array_push($wordDict[$dict_lang[0]][$value->dict_id],$currData);
-                        }else{
-                            array_push($wordDict[$dict_lang[0]]["others"],$currData);
+                    if (isset($wordDict[$dict_lang[0]])) {
+                        if (isset($wordDict[$dict_lang[0]][$value->dict_id])) {
+                            array_push($wordDict[$dict_lang[0]][$value->dict_id], $currData);
+                        } else {
+                            array_push($wordDict[$dict_lang[0]]["others"], $currData);
                         }
-                    }else{
-                        array_push($wordDict['others']['others'],$currData);
+                    } else {
+                        array_push($wordDict['others']['others'], $currData);
                     }
                 }
                 /**
@@ -143,82 +144,81 @@ class DictController extends Controller
                         foreach ($dictId as $oneData) {
                             # code...
                             $wordData['dict'][] = $oneData;
-                            if(isset($dictList['children']) && count($dictList['children'])>0){
+                            if (isset($dictList['children']) && count($dictList['children']) > 0) {
                                 $lastHref = end($dictList['children'])['href'];
-                            }else{
+                            } else {
                                 $lastHref = '';
                             }
-                            $currHref = '#'.$oneData['anchor'];
-                            if($lastHref !== $currHref){
+                            $currHref = '#' . $oneData['anchor'];
+                            if ($lastHref !== $currHref) {
                                 $dictList['children'][] = [
-                                    'href'=> $currHref,
-                                    'title'=> $oneData['shortname'],
+                                    'href' => $currHref,
+                                    'title' => $oneData['shortname'],
                                 ];
                             }
                         }
                     }
                 }
 
-                $wordDataOutput[]=$wordData;
-                $dictListOutput[]=$dictList;
+                $wordDataOutput[] = $wordData;
+                $dictListOutput[] = $dictList;
 
                 //TODO 加变格查询
                 $case = new CaseMan();
                 $parent = $case->WordToBase($word);
                 foreach ($parent as $base => $case) {
                     # code...
-                    if(!in_array($base,$searched)){
+                    if (!in_array($base, $searched)) {
                         $word_base[$base] = $case;
                     }
                 }
             }
 
-            $wordDataPass[] = ['pass'=>$i+1,'words'=>$wordDataOutput];
+            $wordDataPass[] = ['pass' => $i + 1, 'words' => $wordDataOutput];
 
-            if(count($word_base)===0){
+            if (count($word_base) === 0) {
                 break;
-            }else{
+            } else {
                 $words = $word_base;
             }
-
         }
 
-        if($resultCount<2){
+        if ($resultCount < 2) {
             //查询内文
             $wordDataOutput = [];
             $table = UserDict::select($indexCol)
-                                ->where('note','like','%'.$word.'%')
-                                ->where('language','<>','my')
-                                ->take(5)
-                                ->get();
+                ->where('note', 'like', '%' . $word . '%')
+                ->where('language', '<>', 'my')
+                ->take(5)
+                ->get();
             $resultCount += count($table);
-            $wordData=[
-                'word'=> $word,
-                'factors'=> "",
-                'parents'=> "",
-                'case'=> [],
-                'grammar'=>[],
-                'anchor'=> $anchor,
+            $wordData = [
+                'word' => $word,
+                'factors' => "",
+                'parents' => "",
+                'case' => [],
+                'grammar' => [],
+                'anchor' => $anchor,
                 'dict' => [],
             ];
             foreach ($table as $key => $value) {
-                $dictInfo= DictInfo::find($value->dict_id);
-                    $dict_lang = explode('-',$dictInfo->dest_lang);
-                    $anchor = "{$word}-{$dictInfo->shortname}";
+                $dictInfo = DictInfo::find($value->dict_id);
+                $dict_lang = explode('-', $dictInfo->dest_lang);
+                $anchor = "{$word}-{$dictInfo->shortname}";
                 $currData = [
-                    'dictname'=> $dictInfo->name,
-                    'shortname'=> $dictInfo->shortname,
-                    'description'=>$dictInfo->description,
+                    'dictname' => $dictInfo->name,
+                    'shortname' => $dictInfo->shortname,
+                    'description' => $dictInfo->description,
                     'dict_id' => $value->dict_id,
                     'lang' => $dict_lang[0],
-                    'word'=> $word,
-                    'note'=> $this->GrmAbbr($value->note,0),
-                    'anchor'=> $anchor,
+                    'word' => $word,
+                    'note' => $this->GrmAbbr($value->note, 0),
+                    'anchor' => $anchor,
                 ];
                 $wordData['dict'][] = $currData;
             }
             $wordDataOutput[] = $wordData;
-            $wordDataPass[] = ['pass'=>0,'words'=>$wordDataOutput];
+            $wordDataPass[] = ['pass' => 0, 'words' => $wordDataOutput];
         }
 
 
@@ -277,24 +277,25 @@ class DictController extends Controller
         //
     }
 
-    private function GrmAbbr($input,$dictid){
+    private function GrmAbbr($input, $dictid)
+    {
         $mean = $input;
         $replaced = array();
         foreach (GRM_ABBR as $key => $value) {
-            if(in_array($value["abbr"],$replaced)){
+            if (in_array($value["abbr"], $replaced)) {
                 continue;
-            }else{
+            } else {
                 $replaced[] = $value["abbr"];
             }
-            if($dictid !== 0){
-                if($value["dictid"]=== $dictid && strpos($input,$value["abbr"]."|") == false){
-                    $mean = str_ireplace($value["abbr"],"|@{$value["abbr"]}-{$value["replace"]}",$mean);
+            if ($dictid !== 0) {
+                if ($value["dictid"] === $dictid && strpos($input, $value["abbr"] . "|") == false) {
+                    $mean = str_ireplace($value["abbr"], "|@{$value["abbr"]}-{$value["replace"]}", $mean);
                 }
-            }else{
-                if( strpos($mean,"|@".$value["abbr"]) == false){
-                    $props=base64_encode(\json_encode(['text'=>$value["abbr"],'gid'=>$value["replace"]]));
+            } else {
+                if (strpos($mean, "|@" . $value["abbr"]) == false) {
+                    $props = base64_encode(\json_encode(['text' => $value["abbr"], 'gid' => $value["replace"]]));
                     $tpl = "<MdTpl name='grammar-pop' tpl='grammar-pop' props='{$props}'></MdTpl>";
-                    $mean = str_ireplace($value["abbr"],$tpl,$mean);
+                    $mean = str_ireplace($value["abbr"], $tpl, $mean);
                 }
             }
         }

+ 71 - 0
api-v8/app/Http/Controllers/SearchWordSliceController.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use App\Models\WordIndex;
+use App\Tools\CaseMan;
+use Illuminate\Support\Facades\Log;
+
+class SearchWordSliceController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  string  $slice
+     * @return \Illuminate\Http\Response
+     */
+    public function show($slice)
+    {
+        //
+        $words = WordIndex::where('word', 'like', str_replace('-', '%', $slice))
+            ->orderBy('len')
+            ->select(['word', 'count', 'len'])->get();
+
+        return $this->ok(['rows' => $words, 'count' => count($words)]);
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, $id)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy($id)
+    {
+        //
+    }
+}

+ 4 - 1
api-v8/app/Tools/CaseMan.php

@@ -166,7 +166,7 @@ class CaseMan
     /**
      * 从词干到单词的变化
      *
-     * @return void
+     * @return array
      */
     public function BaseToWord($base, $confidence = 0.5)
     {
@@ -229,6 +229,9 @@ class CaseMan
     /**
      * 从单词到词干的变化
      * 小蝌蚪找妈妈
+     * @param  string  $word 输入
+     * @param  int  $deep 搜索深度
+     * @param  boolean  $verify 是否验证单词存在
      * @return array
      */
     public function WordToBase($word, $deep = 1, $verify = true)

+ 1 - 1
api-v8/public/dicttext/cm/pm-grammar-paper/pm-grammar1.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "f26b9e74-f1da-4c85-ad1e-8173b66095fd"

+ 1 - 1
api-v8/public/dicttext/cm/pm-grammar/pm.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "cm"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "61f23efb-b526-4a8e-999e-076965034e60"

+ 1 - 1
api-v8/public/dicttext/cm/sys_irregular/sys_irregular.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "cm"
 isbn = ""
 publisher = ""
-year = 2024
+published = 2024
 url = ""
 author = ""
 uuid = "4d3a0d92-0adc-4052-80f5-512a2603d0e8"

+ 1 - 1
api-v8/public/dicttext/cm/union/union.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "cm"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "8359757e-9575-455b-a772-cc6f036caea0"

+ 1 - 1
api-v8/public/dicttext/en/buddhist-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "NYANATILOKA MAHATHERA"
 uuid = "b089de57-f146-4095-b886-057863728c43"

+ 4 - 3
api-v8/public/dicttext/en/concise-paper/concise.ini

@@ -4,9 +4,10 @@ shortname = "Concise"
 description = "Concise Pali-English Dictionary by A.P. Buddhadatta Mahathera"
 src_lang = "pa"
 dest_lang = "en"
-isbn = ""
-publisher = ""
-year = 1980
+isbn = "8120806050"
+publisher = "I B D Ltd"
+published = "2007"
+Edition = "1st Indian Edition"
 url = ""
 author = "A.P. Buddhadatta Mahathera"
 uuid = "c6e70507-4a14-4687-8b70-2d0c7eb0cf21"

+ 1 - 1
api-v8/public/dicttext/en/concise/concise.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "A.P. Buddhadatta Mahathera"
 uuid = "eae9fd6f-7bac-4940-b80d-ad6cd6f433bf"

+ 3 - 2
api-v8/public/dicttext/en/critical-1/index.ini

@@ -1,12 +1,13 @@
 [meta]
 dictname = "A Critical Pāli Dictionary Vol I"
 shortname = "Critical Vol I"
-description = "Critical Pāli Dictionary"
+description = "A Critical Pāli Dictionary, a project of the Royal Danish Academy of Sciences and Letters, was planned as an exhaustive Pali-English dictionary but was never completed; the project was discontinued in 2011.
+Three volumes were published in a series of between 1925 and 2011 covering a–kāreti, about one third of the Pali lexicon."
 src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = "THE ROYAL DANISH ACADEMY OF SCIENCES AND LETTERS"
-published_at = 2011
+published = 2011
 url = "https://cpd.uni-koeln.de/"
 author = "V. TRENCKNER"
 uuid = "076a5256-3df0-42aa-bcf1-b8ccfd05b0eb"

+ 1 - 1
api-v8/public/dicttext/en/critical-2/index.ini

@@ -7,7 +7,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-published_at = 2011
+published = 2011
 url = "https://cpd.uni-koeln.de/"
 author = ""
 uuid = "7e1da02e-9d2d-4937-8a7e-3a34beeb9503"

+ 1 - 1
api-v8/public/dicttext/en/critical-3/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-published_at = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "5718cbcf-684c-44d4-bbf2-4fa12f2588a4"

+ 1 - 1
api-v8/public/dicttext/en/my-en/index.ini

@@ -6,7 +6,7 @@ src_lang = "my"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = " "
 uuid = "9ce6a53b-e28f-4fb7-b69d-b35fd5d76a24"

+ 1 - 1
api-v8/public/dicttext/en/pali-root-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = " "
 uuid = "1cdc29e0-6783-4241-8784-5430b465b79c"

+ 1 - 1
api-v8/public/dicttext/en/proper-names-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "G P Malalasekera"
 uuid = "0bfd87ec-f3ac-49a2-985e-28388779078d"

+ 1 - 1
api-v8/public/dicttext/en/pts-papter/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "A.P. Buddhadatta Mahathera"
 uuid = "6afb8c05-5cbe-422e-b691-0d4507450cb7"

+ 1 - 1
api-v8/public/dicttext/en/speed-up-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "Kosalla Bhikkhu"
 uuid = "dd6041a2-10c7-4d75-baa4-5fd907c08c28"

+ 1 - 1
api-v8/public/dicttext/en/u-hau-sein-pali-roma-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "U Hau Sein"
 uuid = "a1be6b88-7379-4d2f-911c-5f44d55e5f4a"

+ 1 - 1
api-v8/public/dicttext/en/unity/uhau_en.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "group"
 uuid = "2f93d0fe-3d68-46ee-a80b-11fa445a29c6"

+ 1 - 1
api-v8/public/dicttext/en/vir-paper copy/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "en"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "Vipassana Research Institute"
 uuid = "b9163baf-2bca-41a5-a936-5a0834af3945"

+ 2 - 2
api-v8/public/dicttext/jp/syhy-paper/index.ini

@@ -5,8 +5,8 @@ description = "パーリ语辞典 日本水野弘元教授 词数 13772."
 src_lang = "pa"
 dest_lang = "jp"
 isbn = ""
-publisher = ""
-year = 1980
+publisher = "春秋社"
+published = "1968"
 url = ""
 author = "水野弘元"
 uuid = "91d3ec93-3811-4973-8d84-ced99179a0aa"

+ 7 - 7
api-v8/public/dicttext/jp/syzb-paper/syzb.ini

@@ -1,13 +1,13 @@
 [meta]
-dictname = "パーリ语辞典-增补"
-shortname = "パーリ语辞典-增补"
-description = "パーリ语辞典 增补改订 日本水野弘元教授 词数 3293."
+dictname = "[増補改訂]パーリ語辞典"
+shortname = "[増補改訂]パーリ語辞典"
+description = "[増補改訂]パーリ語辞典 著者:水野 弘元 著, Cコード:3587,判型・ページ数:A5・440ページ 刊行以来もっともスタンダードな辞典として初学者から上級者まで幅広く愛用されている。簡明な訳語と豊富な語彙を持つとともに、日本人にとってなじみ深い漢訳語を併記した画期的な1冊。増補版は南方仏教独自の教理学説に関する語句を豊富に採用し、従来以上に多くのパーリ語聖典の解読に対応できるものとなっている。便利な略文法付き。"
 src_lang = "pa"
 dest_lang = "jp"
-isbn = ""
-publisher = ""
-year = 1980
-url = ""
+isbn = "9784393101568"
+publisher = "春秋社"
+published = "2005"
+url = "https://www.shunjusha.co.jp/book/9784393101568.html"
 author = "水野弘元"
 uuid = "6d6c6812-75e7-457d-874f-5b049ad4b6de"
 rows = 3293

+ 1 - 1
api-v8/public/dicttext/my/pali-roots-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "my"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "1e299ccb-4fc4-487d-8d72-08f63d84c809"

+ 1 - 1
api-v8/public/dicttext/my/pmt-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "my"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "e740ef40-26d7-416e-96c2-925d6650ac6b"

+ 1 - 1
api-v8/public/dicttext/my/u-hau-sein-my-papter/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "my"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "6f9caea1-17fa-41f1-92e5-bd8e6e70e1d7"

+ 1 - 1
api-v8/public/dicttext/my/u_hau_sein/u_hau_sein.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "my"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "U Hau Sein"
 uuid = "beb45062-7c20-4047-bcd4-1f636ba443d1"

+ 1 - 1
api-v8/public/dicttext/si/palisinhala/pali_sinhala.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "si"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "7838e8b6-838b-4320-b481-8cf40823726b"

+ 1 - 1
api-v8/public/dicttext/vi/abhi-terms-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "vi"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "4ac8a0d5-9c6f-4b9f-983d-84288d47f993"

+ 1 - 1
api-v8/public/dicttext/vi/pali-vi-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "vi"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "23f67523-fa03-48d9-9dda-ede80d578dd2"

+ 1 - 1
api-v8/public/dicttext/vi/vinaya-terms-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "vi"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "7c7ee287-35ba-4cf3-b87b-30f1fa6e57c9"

+ 1 - 1
api-v8/public/dicttext/zh/bh-paper/bh-paper.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "原著:中译:Mahāñāṇo Bhikkhu尊者"
 uuid = "f364d3dc-b611-471b-9a4f-531286b8c2c3"

+ 1 - 1
api-v8/public/dicttext/zh/bhfxch-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "张文明居士"
 uuid = "338bc1c6-d5d3-4a0c-963e-76d48d0e15bb"

+ 1 - 1
api-v8/public/dicttext/zh/bhmf-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "Mahāñāṇo Bhikkhu编著 明法比丘增订"
 uuid = "0d79e8e8-1430-4c99-a0f1-b74f2b4b26d8"

+ 1 - 1
api-v8/public/dicttext/zh/bhmf/bhmf.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "原著:中译:Mahāñāṇo Bhikkhu尊者;修订:明法尊者"
 uuid = "8833de18-0978-434c-b281-a2e7387f69be"

+ 1 - 1
api-v8/public/dicttext/zh/blyrm-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "释性恩(Dhammajīvī)"
 uuid = "54a95c74-b2f8-4f25-8c4d-d7d1dd7b3421"

+ 1 - 1
api-v8/public/dicttext/zh/blyzh-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "9f3f6dde-6613-4404-8b4e-dda4de965d51"

+ 1 - 1
api-v8/public/dicttext/zh/bysy-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "温宗堃"
 uuid = "86467ff4-d052-487b-897a-55ff79006432"

+ 1 - 1
api-v8/public/dicttext/zh/formula/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 2023
+published = 2023
 url = ""
 author = "bhikkhu kosalla"
 uuid = "2142c229-8860-4ca5-a82e-1afc7e4f1e5d"

+ 1 - 1
api-v8/public/dicttext/zh/mahinda-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "860eb983-b693-4769-8aa1-9290a7c3dd1b"

+ 1 - 1
api-v8/public/dicttext/zh/my-han/index.ini

@@ -6,7 +6,7 @@ src_lang = "my"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "8e768332-7a5b-46c2-9ec3-1178167a18b5"

+ 1 - 1
api-v8/public/dicttext/zh/my-han2/index.ini

@@ -6,7 +6,7 @@ src_lang = "my"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "8ae6e0f5-f04c-49fc-a355-4885cc08b4b3"

+ 1 - 1
api-v8/public/dicttext/zh/pali-root-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hant"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = ""
 uuid = "5293ffb9-887e-4cf2-af78-48bf52a85304"

+ 1 - 1
api-v8/public/dicttext/zh/speed-up-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hant"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "Kosalla Bhikkhu"
 uuid = "25746fe5-b60d-4e10-a923-f264e2b6ac1e"

+ 1 - 1
api-v8/public/dicttext/zh/syhy-huang-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "水野宏元编著,黃秉榮译"
 uuid = "0e4dc5c8-a228-4693-92ba-7d42918d8a91"

+ 1 - 1
api-v8/public/dicttext/zh/syhy-li-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "李瑩"
 uuid = "6aa9ec8b-bba4-4bcd-abd2-9eae015bad2b"

+ 1 - 1
api-v8/public/dicttext/zh/syhy-miji-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hans"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "覓寂尊者"
 uuid = "eb99f8b4-c3e5-43af-9102-6a93fcb97db6"

+ 1 - 1
api-v8/public/dicttext/zh/syhy/shuihan.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hant"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "原著:水野弘元; 汉译:黃秉榮;"
 uuid = "3acf0c0f-59a7-4d25-a3d9-bf394a266ebd"

+ 1 - 1
api-v8/public/dicttext/zh/yfhb-paper/index.ini

@@ -6,7 +6,7 @@ src_lang = "pa"
 dest_lang = "zh-Hant"
 isbn = ""
 publisher = ""
-year = 1980
+published = 1980
 url = ""
 author = "覓寂尊者"
 uuid = "d4b2c69e-9321-4d86-ad8d-2824436fad26"

+ 2 - 0
api-v8/routes/api.php

@@ -110,6 +110,7 @@ use App\Http\Controllers\ProjectTreeController;
 use App\Http\Controllers\SiteInfoController;
 use App\Http\Controllers\PaliBookCategoryController;
 use App\Http\Controllers\AccessTokenController;
+use App\Http\Controllers\SearchWordSliceController;
 
 
 
@@ -277,4 +278,5 @@ Route::group(['prefix' => 'v2'], function () {
     Route::apiResource('site-info', SiteInfoController::class);
     Route::apiResource('pali-book-category', PaliBookCategoryController::class);
     Route::apiResource('access-token', AccessTokenController::class);
+    Route::apiResource('search-word-slice', SearchWordSliceController::class);
 });

+ 3 - 3
dashboard-v4/dashboard/src/components/dict/CaseList.tsx

@@ -16,14 +16,14 @@ export interface ICaseListData {
 interface IWidget {
   word?: string;
   lines?: number;
-  onChange?: Function;
+  onChange?: (checkedList: string[]) => void;
 }
 const CaseListWidget = ({ word, lines, onChange }: IWidget) => {
   const [caseData, setCaseData] = useState<ICaseListData[]>();
   const [showAll, setShowAll] = useState(lines ? false : true);
   const [words, setWords] = useState<ICaseItem[]>();
   const [currWord, setCurrWord] = useState<string>();
-  const [checkedList, setCheckedList] = useState<CheckboxValueType[]>([]);
+  const [checkedList, setCheckedList] = useState<string[]>([]);
 
   useEffect(() => {
     setCaseData(
@@ -79,7 +79,7 @@ const CaseListWidget = ({ word, lines, onChange }: IWidget) => {
   }
 
   const onWordChange = (list: CheckboxValueType[]) => {
-    setCheckedList(list);
+    setCheckedList(list.map((item) => item.toString()));
   };
 
   const onCheckAllChange = (e: CheckboxChangeEvent) => {

+ 61 - 0
dashboard-v4/dashboard/src/components/dict/DictInfoCopyRef.tsx

@@ -0,0 +1,61 @@
+import { Button, message, Segmented, Typography } from "antd";
+import { SegmentedValue } from "antd/lib/segmented";
+import { useState } from "react";
+import { CopyOutlined } from "@ant-design/icons";
+import { IWordByDict } from "./WordCardByDict";
+import { useIntl } from "react-intl";
+const { Text } = Typography;
+
+interface IWidget {
+  data: IWordByDict;
+}
+const DictInfoCopyRef = ({ data }: IWidget) => {
+  const apaStr = `${data.meta?.author}. (${data.meta?.published}). ${data.dictname}. ${data.meta?.publisher}.`;
+  const mlaStr = `${data.meta?.author}. ${data.dictname}.  ${data.meta?.publisher}, ${data.meta?.published}.`;
+  const [text, setText] = useState(apaStr);
+  const intl = useIntl();
+
+  return (
+    <div>
+      <div style={{ textAlign: "center", padding: 20 }}>
+        <Segmented
+          options={["APA", "MLA"]}
+          onChange={(value: SegmentedValue) => {
+            switch (value) {
+              case "APA":
+                setText(apaStr);
+                break;
+              case "MLA":
+                setText(mlaStr);
+                break;
+              default:
+                break;
+            }
+          }}
+        />
+      </div>
+      <div>
+        <Text>{text}</Text>
+      </div>
+
+      <div style={{ textAlign: "center", padding: 20 }}>
+        <Button
+          type="primary"
+          style={{ width: 200 }}
+          icon={<CopyOutlined />}
+          onClick={() => {
+            navigator.clipboard.writeText(text).then(() => {
+              message.success("链接地址已经拷贝到剪贴板");
+            });
+          }}
+        >
+          {intl.formatMessage({
+            id: "buttons.copy",
+          })}
+        </Button>
+      </div>
+    </div>
+  );
+};
+
+export default DictInfoCopyRef;

+ 2 - 1
dashboard-v4/dashboard/src/components/dict/DictSearch.tsx

@@ -23,10 +23,11 @@ const DictSearchWidget = ({ word, compact = false }: IWidget) => {
 
   const fetchDict = (word: string) => {
     const url = `/v2/dict?word=${word}`;
-    console.info("url", url);
+    console.info("api request", url);
     setLoading(true);
     get<IApiDictContentData>(url)
       .then((json) => {
+        console.info("api response", json);
         setTableData(json.data);
       })
       .finally(() => setLoading(false))

+ 55 - 11
dashboard-v4/dashboard/src/components/dict/WordCardByDict.tsx

@@ -1,20 +1,28 @@
-import { Button, Card, Popover, Space } from "antd";
+import { Button, Card, Popover, Space, Tabs } from "antd";
 import { Typography } from "antd";
 import { InfoCircleOutlined } from "@ant-design/icons";
 
 import Marked from "../general/Marked";
 import MdView from "../template/MdView";
 import "./style.css";
+import DictInfoCopyRef from "./DictInfoCopyRef";
 
-const { Title } = Typography;
+const { Title, Text } = Typography;
 
 export interface IWordByDict {
   dictname: string;
   description?: string;
+  meta?: IDictInfo;
   word?: string;
   note?: string;
   anchor: string;
 }
+export interface IDictInfo {
+  author: string;
+  publisher: string;
+  published?: string;
+  url: string;
+}
 interface IWidgetWordCardByDict {
   data: IWordByDict;
   children?: React.ReactNode;
@@ -26,15 +34,51 @@ const WordCardByDictWidget = ({ data, children }: IWidgetWordCardByDict) => {
         <Title level={5} id={data.anchor}>
           {data.dictname}
         </Title>
-        {data.description ? (
-          <Popover
-            overlayStyle={{ maxWidth: 600 }}
-            content={<Marked text={data.description} />}
-            placement="bottom"
-          >
-            <Button type="link" icon={<InfoCircleOutlined />} />
-          </Popover>
-        ) : undefined}
+        <Popover
+          overlayStyle={{ maxWidth: 600 }}
+          content={
+            <div>
+              <Tabs
+                size="small"
+                style={{ width: 600 }}
+                items={[
+                  {
+                    label: "详情",
+                    key: "info",
+                    children: (
+                      <div>
+                        <div>
+                          <Text strong>{data.dictname}</Text>
+                        </div>
+                        <div>
+                          <Text type="secondary">Author:</Text>
+                          <Text>{data.meta?.author}</Text>
+                        </div>
+                        <div>
+                          <Text type="secondary">Publish:</Text>
+                          <Text>{data.meta?.publisher}</Text>
+                        </div>
+                        <div>
+                          <Text type="secondary">At:</Text>
+                          <Text>{data.meta?.published}</Text>
+                        </div>
+                        <Marked text={data.description} />
+                      </div>
+                    ),
+                  },
+                  {
+                    label: "复制引用信息",
+                    key: "reference",
+                    children: <DictInfoCopyRef data={data} />,
+                  },
+                ]}
+              />
+            </div>
+          }
+          placement="bottom"
+        >
+          <Button type="link" icon={<InfoCircleOutlined />} />
+        </Popover>
       </Space>
       <div className="dict_content">
         <MdView html={data.note} />