Sfoglia il codice sorgente

Merge pull request #955 from visuddhinanda/laravel

:bug: 没有channel 目录显示错误
visuddhinanda 3 anni fa
parent
commit
90c94a0d0f

+ 26 - 27
app/Http/Controllers/UserDictController.php

@@ -295,34 +295,33 @@ class UserDictController extends Controller
 
 	private function update_redis($word){
 		#更新 redis
-
-		//if ($this->redis != false) 
-		{
-			{
-				$Fetch = UserDict::where(['word'=>$word['word'],"source"=>"_SYS_USER_WBW_"])->get();
-				$redisWord=array();
-				foreach ($Fetch as  $one) {
-					# code...
-					$redisWord[] = array(
-									$one["id"],
-									$one["word"],
-									$one["type"],
-									$one["grammar"],
-									$one["parent"],
-									$one["mean"],
-									$one["note"],
-									$one["factors"],
-									$one["factormean"],
-									$one["status"],
-									$one["confidence"],
-									$one["creator_id"],
-									$one["source"],
-									$one["language"]
-									);
-				}
-				Redis::hSet("dict://user",$word['word'],json_encode($redisWord,JSON_UNESCAPED_UNICODE));			
-			}
+		$Fetch = UserDict::where(['word'=>$word['word'],"source"=>"_USER_WBW_"])->get();
+		$redisWord=array();
+		foreach ($Fetch as  $one) {
+			# code...
+			$redisWord[] = array(
+							$one["id"],
+							$one["word"],
+							$one["type"],
+							$one["grammar"],
+							$one["parent"],
+							$one["mean"],
+							$one["note"],
+							$one["factors"],
+							$one["factormean"],
+							$one["status"],
+							$one["confidence"],
+							$one["creator_id"],
+							$one["source"],
+							$one["language"]
+							);
 		}
+		$redisData = json_encode($redisWord,JSON_UNESCAPED_UNICODE);
+		Log::info("word={$word['word']} redis-data={$redisData}");
+		Redis::hSet("dict/user",$word['word'],$redisData);
+		$redisData1 = Redis::hGet("dict/user",$word['word']);
+		Log::info("word={$word['word']} redis-data1={$redisData1}");
+
 		#更新redis结束
 	}
 

+ 4 - 1
public/app/article/article.js

@@ -416,6 +416,9 @@ function palicanon_load() {
 				try {
 					let result = JSON.parse(data);
 					if (result) {
+						if(result.debug){
+							console.log("debug:",result.debug);
+						}
 						_sent_data=result;
                         if(result.title==""){
                             $("#article_title").html("[unnamed]");
@@ -426,7 +429,7 @@ function palicanon_load() {
 						$("#page_title").text(result.title);
 						$("#article_subtitle").html(result.subtitle);
 						//$("#article_author").html(result.username.nickname + "@" + result.username.username);
-                        
+                        console.log("content:",result.content);
 						$("#contents").html(note_init(result.content));
 						note_refresh_new(function () {
                             if(document.querySelector("#para_focus")){

+ 2 - 1
public/app/dict/dict_lookup.php

@@ -341,7 +341,8 @@ function lookup_user($word){
 	$Fetch=array();
 	
 	if($redis){
-		$wordData = $redis->hGet("dict://user",$word);
+		$rediskey = Redis["prefix"]."dict/user";
+		$wordData = $redis->hGet($rediskey,$word);
 			if($wordData){
 				if(!empty($wordData)){
 					$arrWord = json_decode($wordData,true);

+ 4 - 4
public/app/dict/redis_import_user.php

@@ -2,7 +2,7 @@
 require_once __DIR__."/../config.php";
 require_once __DIR__."/../redis/function.php";
 
-$rediskey = "dict://user";
+$rediskey = Redis["prefix"]."dict/user";
 if (PHP_SAPI == "cli") {
 	$redis = redis_connect();
 	if ($redis != false) {
@@ -12,7 +12,7 @@ if (PHP_SAPI == "cli") {
 		$stmtPli = $dbh->query($query);
 		while ($word = $stmtPli->fetch(PDO::FETCH_ASSOC)) {
 			# code...
-			$query = "SELECT * from "._TABLE_DICT_WBW_." where word = ? and source = '_USER_DATA_' ";
+			$query = "SELECT * from "._TABLE_DICT_WBW_." where word = ? and (source = '_USER_DATA_' or source = '_USER_WBW_') ";
 			$stmt = $dbh->prepare($query);
 			$stmt->execute(array($word["word"]));
 			if ($stmt) {
@@ -24,8 +24,8 @@ if (PHP_SAPI == "cli") {
 									$one["id"],
 									$one["word"],
 									$one["type"],
-									$one["gramma"],
-									$one["base"],
+									$one["grammar"],
+									$one["parent"],
 									$one["mean"],
 									$one["note"],
 									$one["factors"],

+ 12 - 7
public/app/reader/get_para1.php

@@ -47,6 +47,8 @@ $output["content"]="";
 $output["owner"]="";
 $output["username"]=array("username"=>"","nickname"=>"");
 $output["status"]="";
+$output["debug"]='';
+
 
 $dns = _FILE_DB_PALI_TOC_;
 $dbh_toc = new PDO($dns, _DB_USERNAME_, _DB_PASSWORD_, array(PDO::ATTR_PERSISTENT => true));
@@ -161,6 +163,8 @@ if ($FetchParInfo) {
 				$space .= "  ";
 			}
 			//目录进度
+			$progress = "";
+			$urlChannel = "";
 			if(isset($firstChannel)){
 				$query = "SELECT title , progress FROM "._TABLE_PROGRESS_CHAPTER_."  WHERE book= ? AND para= ?  AND channel_id=?";
 				$sth_title = $dbh_toc->prepare($query);
@@ -171,28 +175,29 @@ if ($FetchParInfo) {
 						$sToc = $trans_title['title'];
 					}
 					$progress = "<".sprintf('%d',$trans_title['progress']*100)."%";
-				}else{
-					$progress = "";
 				}
 				$urlChannel = "&channel={$_channel}";
-			}else{
-				$urlChannel = "";
 			}
-
+			$sToc = str_replace("[[","",$sToc);
+			$sToc = str_replace("]]","",$sToc);
 			$sTocOutput .= $space . "- [{$sToc}](../article/index.php?view=chapter&book={$_book}&par={$value["paragraph"]}{$urlChannel}){$progress}\n";
 		}		
 	}
-$sTocOutput .= "\n\n";
+	$sTocOutput .= "\n\n";
 
+	$output["debug"] .= "chapter_strlen:{$FetchParInfo["chapter_strlen"]}\n";
     if ($FetchParInfo["chapter_strlen"] > _MAX_CHAPTER_LEN_ && $_view === "chapter" && count($toc) > 1) {
         #文档过大,只加载目录
+		$output["debug"] .= "文档过大,只加载目录\n";
 		if ($toc[1]["paragraph"] - $_para > 1) {
-            # 中间有间隔
+            # 最高级目录和下一个目录中间有正文层级的段落间隔
+			$output["debug"] .= "最高级目录和下一个目录中间有正文层级的段落间隔\n";
             $paraBegin = $_para;
             $paraEnd = $toc[1]["paragraph"] - 1;
             $output["head"] = 1;
         } else {
             #中间无间隔
+			$output["debug"] .= "最高级目录和下一个目录中间无正文层级的段落间隔\n";
             $output["content"] .= $sTocOutput;
             echo json_encode($output, JSON_UNESCAPED_UNICODE);
             exit;

+ 1 - 1
public/app/studio/dict_find_auto.php

@@ -101,7 +101,7 @@ array_push($db_file_list, array(_DIR_DICT_3RD_ . "/uhan_en.db", ""));
 
 $db_file_list[] = array("","wbwdict://new/".$_COOKIE["userid"],true);	
 $db_file_list[] = array(_FILE_DB_TERM_,"dict://term",true);	
-$db_file_list[] = array(_FILE_DB_WBW1_,"dict://user",true);
+$db_file_list[] = array(_FILE_DB_WBW1_,Redis["prefix"]."dict/user",true);
 
 $db_file_list[] = array( _DIR_DICT_SYSTEM_ . "/sys_regular.db","dict://regular",true);
 $db_file_list[] = array( _DIR_DICT_SYSTEM_ . "/sys_irregular.db","dict://irregular",true);

+ 1 - 1
public/app/studio/dict_find_one.php

@@ -70,7 +70,7 @@ $db_file_list = array();
 //词典列表
 if ($dict_name == "") {
     $db_file_list[] = array(_FILE_DB_TERM_,"dict://term",true);	
-	$db_file_list[] = array(_FILE_DB_WBW1_,"dict://user",true);
+	$db_file_list[] = array(_FILE_DB_WBW1_,Redis["prefix"]."dict/user",true);
 	
     $db_file_list[] = array( _DIR_DICT_SYSTEM_ . "/sys_regular.db","dict://regular",true);
     $db_file_list[] = array( _DIR_DICT_SYSTEM_ . "/sys_irregular.db","dict://irregular",true);

+ 4 - 4
public/dicttext/thin/dict_info.csv

@@ -8,13 +8,13 @@ zh-hans,7,巴利语字汇,四念住课程开示集要巴利语字汇(葛印卡)
 zh-hant,8,汉译パーリ语辞典-黃秉榮,汉译パーリ语辞典 黃秉榮譯 词数 7735.
 en,9,Pali-Dict Vri,Pali-Dictionary Vipassana Research Institute
 zh-hant,10,パーリ语辞典--勘误表  ,《水野弘元--巴利语辞典--勘误表》 Bhikkhu Santagavesaka 覓寂尊者 2007.8.2 词数 90.
-my,11,Tipiṭaka Pāḷi-Myanmar,Tipiṭaka Pāḷi-Myanmar Dictionary တိပိဋက-ပါဠိျမန္မာ အဘိဓာန္
+my,11,Tipiṭaka Pāḷi-Myanmar,Tipiṭaka Pāḷi-Myanmar Dictionary တိပိဋက-ပါဠိမြန်မာ အဘိဓာန်
 zh-hans,12,巴利语汇解,巴利语汇解&巴利新音译 玛欣德尊者
 en,13,Buddhist Dictionary,Buddhist Dictionary by NYANATILOKA MAHATHERA
-my,14,Pali Roots Dictionary,Pali Roots Dictionary ဓါတ္အဘိဓာန္
+my,14,Pali Roots Dictionary,Pali Roots Dictionary ဓါတ်အဘိဓာန်
 en,15,PTS P-E dictionary ,PTS Pali-English dictionary The Pali Text Society's Pali-English dictionary
 vn,16,Pali Viet Vinaya Terms,Pali Viet Vinaya Terms  Từ điển các thuật ngữ về luật do tỳ khưu Giác Nguyên sưu tầm.
-my,17,U Hau Sein’s Pāḷi-Myanmar,U Hau Sein’s Pāḷi-Myanmar Dictionary ပါဠိျမန္မာ အဘိဓာန္(ဦးဟုတ္စိန္)
+my,17,U Hau Sein’s Pāḷi-Myanmar,U Hau Sein’s Pāḷi-Myanmar Dictionary ပါဠိမြန်မာ အဘိဓာန်(ဦးဟုတ်စိန်)
 jp,18,パーリ语辞典,パーリ语辞典 日本水野弘元教授 词数 13772.
 zh-hant,19,汉译パーリ语辞典-李瑩,汉译パーリ语辞典 李瑩譯 词数 708.
 vn,20,Pali Viet Dictionary,Pali Viet Dictionary  Bản dịch của ngài Bửu Chơn.
@@ -30,6 +30,6 @@ en,31,Gramma Book,
 zh-hant,32,語法彙編,語法彙編 覓寂尊者
 zh-hant,33,聖典語速成手冊,
 en,34,Pāḷi Speed-up School,
-my,35,U Hau Sein’s Pāḷi-Myanmar-Roma,U Hau Sein’s Pāḷi-Myanmar Dictionary ပါဠိျမန္မာ အဘိဓာန္(ဦးဟုတ္စိန္)
+my,35,U Hau Sein’s Pāḷi-Myanmar-Roma,U Hau Sein’s Pāḷi-Myanmar Dictionary ပါဠိမြန်မာ အဘိဓာန်(ဦးဟုတ်စိန်)
 zh-hans,36,U Hau Sein’s Pāḷi-谷歌中文,
 en,37,U Hau Sein’s Pāḷi-Google English,