فهرست منبع

Merge branch 'laravel' of https://github.com/iapt-platform/mint into laravel

bhikkhu-kosalla-china 3 سال پیش
والد
کامیت
7684dff64a

+ 20 - 7
app/Console/Commands/TestRedis.php

@@ -47,17 +47,30 @@ class TestRedis extends Command
 		$this->info("redis hash get:".Redis::hGet("test-redis-hash",'hash'));
 
 		$this->info("test cache");
-		Cache::put('cache-key','cache value',10);
-		$this->info('catche test: ',Cache::get('cache-key'));
-		cache(["cache-key-2"=>'cache value 2']);
-		$this->info('cache() test',cache("cache-key-2"));
-		$value = Cache::get('cache-key-3',function(){
+		$this->info("cache put key=cache-key value=cache-value");
+		Cache::put('cache-key','cache-value',1000);
+		if(Cache::has('cache-key')){
+			$this->info('cache get: ',Cache::get('cache-key'));
+		}else{
+			$this->error('no key cache-key');
+		}
+		$this->info("test cache() function");
+		$this->info("cache() key=cache-key-2 value=cache-value-2");
+		cache(["cache-key-2"=>'cache-value-2']);
+		if(Cache::has('cache-key-2')){
+			$this->info('cache() get: ',Cache::get('cache-key-2'));
+		}else{
+			$this->error('no key cache-key-2');
+		}
+
+		$this->info("test cache remember()");
+		$value = Cache::remember('cache-key-3',600,function(){
 			return 'cache-value-3';
 		});
 		if(Cache::has('cache-key-3')){
-			$this->info("cache-key-3 exist");
+			$this->info("cache-key-3 exist value=",Cache::get('cache-key-3'));
 		}else{
-			$this->info("cache-key-3 no");
+			$this->error("cache::remember() fail.");
 		}
 
 

+ 8 - 1
app/Console/Commands/WebHookArticleNew.php

@@ -53,10 +53,17 @@ class WebHookArticleNew extends Command
 				$book = $row['book'];
                 $para = $row['para'];
 				$channel_id = $row['channel_id'];
-                $title = $row['toc'];
+				if(!empty($row['title'])){
+					$title = str_replace("\n","",$row['title']);
+				}else{
+					$title = $row['toc'];
+				}
+                
 				$link = env('APP_URL',"http://127.0.0.1:8000")."/app/article/index.php?view=chapter&book={$book}&par={$para}&channel={$channel_id}";
 				$message .= "1. [{$title}]({$link})\n";				
 			}
+			$link = env('APP_URL',"http://127.0.0.1:8000")."/app/palicanon";
+			$message .= "\n [更多]({$link})";
 			$this->info($message);
 			$url = $this->argument('host');
 			switch ($this->argument('type')) {

+ 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结束
 	}
 

+ 7 - 2
public/app/article/article.js

@@ -393,8 +393,10 @@ function palicanon_load() {
 				start: _start,
 				end: _end,
 			}
-            if(_channal !==""){
+            if(_channal !== ""){
+				param.channel = _channal;
                 for (const iterator of _channal.split(",")) {
+					//增加点击次数
                     OneHitChapter(_book,_par,iterator);
                 }
             }
@@ -414,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]");
@@ -424,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"],

+ 38 - 3
public/app/reader/get_para1.php

@@ -30,6 +30,10 @@ if (isset($_GET["begin"])) {
 if (isset($_GET["end"])) {
     $_end = $_GET["end"];
 }
+if (isset($_GET["channel"])) {
+    $_channel = $_GET["channel"];
+}
+
 $_view = $_GET["view"];
 
 $output["toc"] = array();
@@ -43,6 +47,12 @@ $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));
+$dbh_toc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 
 if ($_view == "sent") {
     $output["content"] = "{{". $_book . "-" . $_para . "-". $_start . "-" . $_end . "}}";
@@ -119,6 +129,9 @@ if ($FetchParInfo) {
     /*
     目录
     */
+	if(isset($_channel)){
+		$firstChannel = explode(',',$_channel)[0];
+	}
     $sTocOutput = "\n\n";
 	if(count($toc)>1){
 		$currLevel = $toc[0]["level"];
@@ -149,20 +162,42 @@ if ($FetchParInfo) {
 				# code...
 				$space .= "  ";
 			}
-			$sTocOutput .= $space . "- [{$sToc}](../article/index.php?view=chapter&book={$_book}&par={$value["paragraph"]})\n";
+			//目录进度
+			$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);
+				$sth_title->execute(array($_book, $value["paragraph"], $firstChannel));
+				$trans_title = $sth_title->fetch(PDO::FETCH_ASSOC);
+				if ($trans_title) {
+					if(!empty($trans_title['title'])){
+						$sToc = $trans_title['title'];
+					}
+					$progress = "<".sprintf('%d',$trans_title['progress']*100)."%";
+				}
+				$urlChannel = "&channel={$_channel}";
+			}
+			$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);

+ 10 - 2
public/app/term/note.js

@@ -647,13 +647,21 @@ function note_ref_init(target='_blank') {
 	$("chapter").click(function () {
 		let bookid = $(this).attr("book");
 		let para = $(this).attr("para");
-		window.open("../article/?view=chapter&book=" + bookid + "&par=" + para, target);
+		let urlChannel='';
+		if(_channal !== ""){
+			urlChannel = "&channel=" + _channal;
+		}
+		window.open("../article/?view=chapter&book=" + bookid + "&par=" + para + urlChannel, target);
 	});
 
 	$("para").click(function () {
 		let bookid = $(this).attr("book");
 		let para = $(this).attr("para");
-		window.open("../article/?view=para&book=" + bookid + "&par=" + para, target);
+		let urlChannel='';
+		if(_channal !== ""){
+			urlChannel = "&channel=" + _channal;
+		}		
+		window.open("../article/?view=para&book=" + bookid + "&par=" + para + urlChannel, target);
 	});
 }
 /*

+ 4 - 0
public/app/term/term.css

@@ -1204,4 +1204,8 @@ button.primary {
     background-color: var(--link-hover-color);
     color: var(--btn-hover-color);
     border-radius: 5px;
+}
+
+.vertical .preview .popup_contence{
+    max-width: max(50vw, 100%);
 }

+ 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,

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 23 - 23
public/pali_title/207_pali.csv


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است