Explorar o código

Merge pull request #953 from visuddhinanda/laravel

修改疑惑度脱的目录结构
visuddhinanda %!s(int64=3) %!d(string=hai) anos
pai
achega
118e42e84c

+ 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')) {

+ 3 - 1
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);
                 }
             }

+ 31 - 1
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();
@@ -44,6 +48,10 @@ $output["owner"]="";
 $output["username"]=array("username"=>"","nickname"=>"");
 $output["status"]="";
 
+$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 . "}}";
     echo json_encode($output, JSON_UNESCAPED_UNICODE);
@@ -119,6 +127,9 @@ if ($FetchParInfo) {
     /*
     目录
     */
+	if(isset($_channel)){
+		$firstChannel = explode(',',$_channel)[0];
+	}
     $sTocOutput = "\n\n";
 	if(count($toc)>1){
 		$currLevel = $toc[0]["level"];
@@ -149,7 +160,26 @@ if ($FetchParInfo) {
 				# code...
 				$space .= "  ";
 			}
-			$sTocOutput .= $space . "- [{$sToc}](../article/index.php?view=chapter&book={$_book}&par={$value["paragraph"]})\n";
+			//目录进度
+			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)."%";
+				}else{
+					$progress = "";
+				}
+				$urlChannel = "&channel={$_channel}";
+			}else{
+				$urlChannel = "";
+			}
+
+			$sTocOutput .= $space . "- [{$sToc}](../article/index.php?view=chapter&book={$_book}&par={$value["paragraph"]}{$urlChannel}){$progress}\n";
 		}		
 	}
 $sTocOutput .= "\n\n";

+ 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%);
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 23 - 23
public/pali_title/207_pali.csv


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio