Bläddra i källkod

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

bhikkhu-kosalla-china 3 år sedan
förälder
incheckning
9474fc0cc0

+ 19 - 13
app/Console/Commands/UpgradeDaily.php

@@ -4,7 +4,7 @@ namespace App\Console\Commands;
 
 
 use Illuminate\Console\Command;
 use Illuminate\Console\Command;
 use Illuminate\Support\Carbon;
 use Illuminate\Support\Carbon;
-use Illuminate\Support\Facades\Http;
+
 
 
 class UpgradeDaily extends Command
 class UpgradeDaily extends Command
 {
 {
@@ -40,12 +40,15 @@ class UpgradeDaily extends Command
     public function handle()
     public function handle()
     {
     {
         $start = time();
         $start = time();
-		$this->call('message:webhook',[
-			'listener' => 'dingtalk',
-			'url' => 'dingtalk1',
-			'title' => "后台任务",
-			'message' => " wikipali: 每日统计后台任务开始执行。",
-		]);
+		if(app()->isLocal()==false){
+			$this->call('message:webhook',[
+				'listener' => 'dingtalk',
+				'url' => 'dingtalk1',
+				'title' => "后台任务",
+				'message' => " wikipali: 每日统计后台任务开始执行。",
+			]);
+		}
+
         # 刷巴利语句子uuid 仅调用一次
         # 刷巴利语句子uuid 仅调用一次
         $this->call('upgrade:palitextid');
         $this->call('upgrade:palitextid');
         //巴利原文段落库目录结构改变时运行
         //巴利原文段落库目录结构改变时运行
@@ -62,12 +65,15 @@ class UpgradeDaily extends Command
 
 
         $time = time()-$start;
         $time = time()-$start;
 
 
-		$this->call('message:webhook',[
-			'listener' => 'dingtalk',
-			'url' => 'dingtalk1',
-			'title' => "后台任务",
-			'message' => "wikipali: 每日统计后台任务执行完毕。用时{$time}",
-		]);;
+		if(app()->isLocal()==false){
+			$this->call('message:webhook',[
+				'listener' => 'dingtalk',
+				'url' => 'dingtalk1',
+				'title' => "后台任务",
+				'message' => "wikipali: 每日统计后台任务执行完毕。用时{$time}",
+			]);			
+		}
+
 
 
         return 0;
         return 0;
     }
     }

+ 2 - 1
app/Console/Commands/UpgradePaliText.php

@@ -84,7 +84,8 @@ class UpgradePaliText extends Command
 				Log::error( "can not open csv file. filename=" . $csvFile) ;
 				Log::error( "can not open csv file. filename=" . $csvFile) ;
 				continue;
 				continue;
 			}
 			}
-			$title_data = PaliText::where('book',$from)->orderby('paragraph','asc')->get();
+			$title_data = PaliText::select(['book','paragraph','level','parent','toc'])
+								->where('book',$from)->orderby('paragraph','asc')->get();
             {
             {
 				$paragraph_count = count($title_data);
 				$paragraph_count = count($title_data);
 				$paragraph_info = array();
 				$paragraph_info = array();

+ 2 - 1
app/Console/Commands/WebHook.php

@@ -3,6 +3,7 @@
 namespace App\Console\Commands;
 namespace App\Console\Commands;
 
 
 use Illuminate\Console\Command;
 use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Http;
 
 
 class WebHook extends Command
 class WebHook extends Command
 {
 {
@@ -47,7 +48,7 @@ class WebHook extends Command
 				break;
 				break;
 			case 'dingtalk':
 			case 'dingtalk':
 				# code...
 				# code...
-				$url = $url[$this->argument('url')];
+				$url = $this->url[$this->argument('url')];
 				$param = [
 				$param = [
 				"markdown"=> [
 				"markdown"=> [
 					"title"=> $this->argument('title'), 
 					"title"=> $this->argument('title'), 

+ 57 - 32
app/Http/Controllers/ProgressChapterController.php

@@ -165,11 +165,12 @@ class ProgressChapterController extends Controller
             */
             */
                 $chapters = ProgressChapter::select('channel_id')
                 $chapters = ProgressChapter::select('channel_id')
                                            ->selectRaw('count(*) as count')
                                            ->selectRaw('count(*) as count')
-                                           ->with(['channel' => function($query) {  //city对应上面province模型中定义的city方法名  闭包内是子查询
+                                           ->with(['channel' => function($query) {  
                                                 return $query->select('*');
                                                 return $query->select('*');
                                             }])
                                             }])
                                            ->leftJoin('channels','progress_chapters.channel_id', '=', 'channels.uid')
                                            ->leftJoin('channels','progress_chapters.channel_id', '=', 'channels.uid')
-                                           ->where("progress",">",$minProgress);
+                                           ->where("progress",">",$minProgress)
+										   ->where('channels.status','>=',30);
                 if(!empty($request->get('channel_type'))){
                 if(!empty($request->get('channel_type'))){
                     $chapters =  $chapters->where('channels.type',$request->get('channel_type'));
                     $chapters =  $chapters->where('channels.type',$request->get('channel_type'));
                 }
                 }
@@ -250,6 +251,7 @@ class ProgressChapterController extends Controller
                     $channel = "";
                     $channel = "";
                 }
                 }
 
 
+				
 
 
 
 
                 $param[] = $minProgress;
                 $param[] = $minProgress;
@@ -260,28 +262,43 @@ class ProgressChapterController extends Controller
                 }else{
                 }else{
                     $whereLang = "   ";
                     $whereLang = "   ";
                 }                
                 }                
+
+				if($request->has('channel_type') && !empty($request->get('channel_type'))){
+					$channel_type = "and ch.type = ? "; 
+					$param[] = $request->get('channel_type');
+				}else{
+					$channel_type = "";
+				}	
+
                 $param_count = $param;
                 $param_count = $param;
                 $param[] = $offset;
                 $param[] = $offset;
 
 
 
 
                 $query = "
                 $query = "
-                select tpc.uid, tpc.book ,tpc.para,tpc.channel_id,tpc.title,pt.toc,pt.path,tpc.progress,tpc.summary,tpc.created_at,tpc.updated_at 
+                select tpc.pc_uid as uid, tpc.book ,tpc.para,tpc.channel_id,tpc.title,pt.toc,pt.path,tpc.progress,tpc.summary,tpc.created_at,tpc.updated_at 
                     from (
                     from (
-                        select * from (
-                            select anchor_id as cid from (
-                                select tm.anchor_id , count(*) as co 
-                                    from $tm as  tm
-                                    left join $tg as t on tm.tag_id = t.id
-                                    where tm.table_name  = 'progress_chapters'  
-                                    $in1
-                                    group by tm.anchor_id
-                            ) T 
-                                $where1 
-                        ) CID 
-                        left join $pc as pc on CID.cid = pc.uid 
-                        where pc.progress > ? 
-                        $channel  $whereLang
-                        order by created_at desc
+						select pcd.uid as pc_uid, ch.uid as ch_uid, book , para, channel_id,progress, title ,pcd.summary , pcd.created_at,pcd.updated_at
+							from (
+								select uid, book,para,lang,progress,channel_id,title,summary ,created_at ,updated_at
+									from (
+										select anchor_id as cid 
+											from (
+												select tm.anchor_id , count(*) as co 
+													from $tm as  tm
+													left join $tg as t on tm.tag_id = t.id
+													where tm.table_name  = 'progress_chapters'  
+													$in1
+													group by tm.anchor_id
+											) T 
+											$where1 
+									) CID 
+								left join $pc as pc on CID.cid = pc.uid 
+								where pc.progress > ? 
+								$channel  $whereLang
+							) pcd
+						left join channels as ch on pcd.channel_id = ch.uid
+						where ch.status >= 30 $channel_type
+                        order by pcd.created_at desc
                         limit 20 offset ?
                         limit 20 offset ?
                     ) tpc 
                     ) tpc 
                     left join $pt as pt on tpc.book = pt.book and tpc.para = pt.paragraph;";
                     left join $pt as pt on tpc.book = pt.book and tpc.para = pt.paragraph;";
@@ -299,20 +316,28 @@ class ProgressChapterController extends Controller
 
 
                 //计算按照这个条件搜索到的总数
                 //计算按照这个条件搜索到的总数
                 $query  = "
                 $query  = "
-                         select count(*) as count from (
-                            select anchor_id as cid from (
-                                select tm.anchor_id , count(*) as co 
-                                    from $tm as  tm
-                                    left join $tg as t on tm.tag_id = t.id
-                                    where tm.table_name  = 'progress_chapters'  
-                                    $in1
-                                    group by tm.anchor_id
-                            ) T 
-                                $where1 
-                        ) CID 
-                        left join $pc as pc on CID.cid = pc.uid 
-                        where pc.progress > ? 
-                        $channel   $whereLang
+                         select count(*) as count 
+							from (
+								select *
+								from (
+									select anchor_id as cid 
+										from (
+											select tm.anchor_id , count(*) as co 
+												from $tm as  tm
+												left join $tg as t on tm.tag_id = t.id
+												where tm.table_name  = 'progress_chapters'  
+												$in1
+												group by tm.anchor_id
+										) T 
+										$where1 
+								) CID 
+								left join $pc as pc on CID.cid = pc.uid 
+								where pc.progress > ? 
+								$channel   $whereLang
+							) pcd
+							left join channels as ch on pcd.channel_id = ch.uid
+							where ch.status >= 30 $channel_type
+
                 ";
                 ";
                 $count = DB::select($query,$param_count);
                 $count = DB::select($query,$param_count);
                 $all_count = $count[0]->count;
                 $all_count = $count[0]->count;

+ 16 - 2
app/Http/Controllers/ViewController.php

@@ -7,6 +7,7 @@ use App\Models\ProgressChapter;
 use App\Models\PaliText;
 use App\Models\PaliText;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use Illuminate\Support\Str;
 use Illuminate\Support\Str;
+use Illuminate\Support\Facades\Log;
 
 
 class ViewController extends Controller
 class ViewController extends Controller
 {
 {
@@ -117,14 +118,21 @@ class ViewController extends Controller
         ];
         ];
         if(isset($_COOKIE['user_uid'])){
         if(isset($_COOKIE['user_uid'])){
             //已经登陆
             //已经登陆
+			Log::info('已经登陆');
             $user_id = $_COOKIE['user_uid'];
             $user_id = $_COOKIE['user_uid'];
             $param['user_id'] = $user_id;
             $param['user_id'] = $user_id;
         }else{
         }else{
+			Log::info('没有登陆');
             $param['user_ip'] = $clientIp;
             $param['user_ip'] = $clientIp;
         }
         }
+		
         $new = View::firstOrNew($param);
         $new = View::firstOrNew($param);
+		Log::info('获取记录或新建');
+		Log::info(print_r($new, true));
         $new->user_ip = $clientIp;
         $new->user_ip = $clientIp;
 		//获取标题 和 meta数据
 		//获取标题 和 meta数据
+		Log::info('获取标题 和 meta数据');
+
 		switch($request->get("target_type")){
 		switch($request->get("target_type")){
 			case "chapter":
 			case "chapter":
 				$new->title = ProgressChapter::where("channel_id",$request->get("channel"))
 				$new->title = ProgressChapter::where("channel_id",$request->get("channel"))
@@ -134,15 +142,21 @@ class ViewController extends Controller
 				$new->org_title = PaliText::where("book",$request->get("book"))
 				$new->org_title = PaliText::where("book",$request->get("book"))
 										->where("paragraph",$request->get("para"))
 										->where("paragraph",$request->get("para"))
 										->value("toc");
 										->value("toc");
-				$new->meta = [
+				Log::info('获取标题 成功');
+
+				$new->meta = \json_encode([
 					"book"=>$request->get("book"),
 					"book"=>$request->get("book"),
 					"para"=>$request->get("para"),
 					"para"=>$request->get("para"),
 					"channel"=>$request->get("channel"),
 					"channel"=>$request->get("channel"),
-				];
+				]);
+				Log::info('获取meta数据成功');
+
 				break;
 				break;
 		}
 		}
 		$new->count = $new->count+1;
 		$new->count = $new->count+1;
         $new->save();
         $new->save();
+		Log::info('保存成功');
+
         $count = View::where("target_id",$new->target_id)->count();
         $count = View::where("target_id",$new->target_id)->count();
         return $this->ok($count);
         return $this->ok($count);
     }
     }

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

@@ -365,7 +365,7 @@ function gotoArticle(articleId) {
 function OneHitChapter(book,para,channel){
 function OneHitChapter(book,para,channel){
     fetch('/api/v2/view',{
     fetch('/api/v2/view',{
         method: 'POST',
         method: 'POST',
-        credentials: 'include',
+        credentials: 'same-origin',
         headers: {
         headers: {
             'Content-Type': 'application/json'
             'Content-Type': 'application/json'
         },
         },

+ 1 - 1
public/app/group/group.js

@@ -1,4 +1,4 @@
-var _my_channal = null;
+var _my_channal = new Array();
 var get_channel_list_callback = null;
 var get_channel_list_callback = null;
 channal_list();
 channal_list();
 
 

+ 7 - 2
public/app/nissaya/get.php

@@ -31,6 +31,11 @@ if (isset($_GET["end"])) {
 } else {
 } else {
     $end = 0;
     $end = 0;
 }
 }
+if (isset($_GET["nsyid"])) {
+    $nsyid = substr($_GET["nsyid"],1) ;
+} else {
+    $nsyid = '';
+}
 add_edit_event(_NISSAYA_FIND_, "{$book}-{$para}-{$begin}-{$end}");
 add_edit_event(_NISSAYA_FIND_, "{$book}-{$para}-{$begin}-{$end}");
 
 
 PDO_Connect("" . _FILE_DB_PAGE_INDEX_);
 PDO_Connect("" . _FILE_DB_PAGE_INDEX_);
@@ -42,8 +47,8 @@ foreach ($Fetch as $key => $value) {
     $Fetch_nsy_book = PDO_FetchRow($query, array($value["book"], $value["page1"]));
     $Fetch_nsy_book = PDO_FetchRow($query, array($value["book"], $value["page1"]));
     if ($Fetch_nsy_book) {
     if ($Fetch_nsy_book) {
         $prefix = $Fetch_nsy_book["table"];
         $prefix = $Fetch_nsy_book["table"];
-        $query = "SELECT * from {$prefix}_pagematch where bookid=? and bookpagenumber=?";
-        $Fetch_nsy_index = PDO_FetchRow($query, array($Fetch_nsy_book["bookid"], $value["page2"]));
+        $query = "SELECT * from {$prefix}_pagematch where bookid=? and bookpagenumber=? and nsyid = ?";
+        $Fetch_nsy_index = PDO_FetchRow($query, array($Fetch_nsy_book["bookid"], $value["page2"],$nsyid ));
         $Fetch_nsy_index["dir"] = $prefix;
         $Fetch_nsy_index["dir"] = $prefix;
         $result["data"][] = $Fetch_nsy_index;
         $result["data"][] = $Fetch_nsy_index;
     } else {
     } else {

+ 57 - 0
public/app/nissaya/get_book_list.php

@@ -0,0 +1,57 @@
+<?php
+require_once "../public/_pdo.php";
+require_once "../config.php";
+require_once "../ucenter/active.php";
+
+$result["error"] = "";
+$result["data"] = array();
+
+if (isset($_GET["book"])) {
+    $book = $_GET["book"];
+} else {
+    $result["error"] = "no param";
+    echo json_encode($result, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+if (isset($_GET["para"])) {
+    $para = $_GET["para"];
+} else {
+    $result["error"] = "no param";
+    echo json_encode($result, JSON_UNESCAPED_UNICODE);
+    exit;
+}
+
+if (isset($_GET["begin"])) {
+    $begin = $_GET["begin"];
+} else {
+    $begin = 0;
+}
+if (isset($_GET["end"])) {
+    $end = $_GET["end"];
+} else {
+    $end = 0;
+}
+add_edit_event(_NISSAYA_FIND_, "{$book}-{$para}-{$begin}-{$end}");
+
+PDO_Connect("" . _FILE_DB_PAGE_INDEX_);
+$query = "SELECT * from m where book=? and para=?";
+$Fetch = PDO_FetchRow($query, array($book, $para));
+    $query = "SELECT * from book_match where book_vri=? and vol=?";
+    $Fetch_nsy_book = PDO_FetchRow($query, array($Fetch["book"], $Fetch["page1"]));
+    if ($Fetch_nsy_book) {
+        $prefix = $Fetch_nsy_book["table"];
+		
+        $query = "select nsyid from {$prefix}_pagematch where bookid = ? and bookpagenumber = ? group by nsyid";
+        $Fetch_nsy_book = PDO_FetchAll($query, array($Fetch_nsy_book["bookid"],$Fetch["page2"]));
+		foreach ($Fetch_nsy_book as $key => $book) {
+			# code...
+			$query = "select nsyname from {$prefix}_pagematch where nsyid = ? ";
+			$Fetch_nsy_book[$key]['name'] = PDO_FetchRow($query, array($book["nsyid"]))['nsyname'];
+			$Fetch_nsy_book[$key]['type'] = $prefix;
+		}
+		$result["data"] =  json_encode($Fetch_nsy_book, JSON_UNESCAPED_UNICODE);
+        
+    } else {
+        $result["error"] = "error: in table book_match";
+    }
+echo json_encode($result, JSON_UNESCAPED_UNICODE);

+ 7 - 1
public/app/nissaya/index.php

@@ -23,6 +23,12 @@ if(isset($_GET["book"])){
 else{
 else{
 	$book = 0;
 	$book = 0;
 }
 }
+if(isset($_GET["nsyid"])){
+	$nsyid = $_GET["nsyid"];
+}
+else{
+	$nsyid = 0;
+}
 if(isset($_GET["par"])){
 if(isset($_GET["par"])){
 	$para = $_GET["par"];
 	$para = $_GET["par"];
 }
 }
@@ -44,7 +50,7 @@ else{
 ?>
 ?>
 <script>
 <script>
 $(document).ready(function () {
 $(document).ready(function () {
-	nissaya_get(<?php echo "{$book},{$para},{$begin},{$end}";?>);
+	nissaya_load(<?php echo "'{$nsyid}',{$book},{$para},{$begin},{$end}";?>);
 });
 });
 </script>
 </script>
 
 

+ 49 - 2
public/app/nissaya/nissaya.js

@@ -1,7 +1,46 @@
 var _nsy_book_dir = "";
 var _nsy_book_dir = "";
 var _nsy_book_id = "";
 var _nsy_book_id = "";
 
 
-function nissaya_get(book, para, begin = 0, end = 0) {
+function nissaya_load(nsyid,book, para, begin = 0, end = 0){
+	if(nsyid==0){
+		nissaya_get_books(book, para);
+	}else{
+		nissaya_get(nsyid,book, para, begin, end );
+	}
+}
+function render_nissaya_books(list,book,para,begin=0,end=0){
+	let books = JSON.parse(list);
+	let html ="<ol>";
+	for (const iterator of books) {
+		html += "<li>";
+		html += "<a href='index.php?book="+book+"&par="+para+"&begin="+begin+"&end="+end+"&nsyid=a"+iterator.nsyid+"'>";
+		html +=  iterator.nsyid + "-" + iterator.name;
+		html += "</a>";
+		html += "</li>";
+	}
+	html += "</ol>";
+	return html;
+}
+function nissaya_get_books(book, para) {
+	$.get(
+		"../nissaya/get_book_list.php",
+		{
+			book: book,
+			para: para,
+		},
+		function (data) {
+			let result = JSON.parse(data);
+			if (result.error == "") {
+				if (result.data.length > 0) {
+					//找到的书的列表
+					$("#contence").html(render_nissaya_books(result.data,book,para));
+				}
+			}
+		}
+	);
+
+}
+function nissaya_get(nissayabook,book, para, begin = 0, end = 0) {
 	if (book == 0 || para == 0) {
 	if (book == 0 || para == 0) {
 		return;
 		return;
 	}
 	}
@@ -12,6 +51,7 @@ function nissaya_get(book, para, begin = 0, end = 0) {
 			para: para,
 			para: para,
 			begin: begin,
 			begin: begin,
 			end: end,
 			end: end,
+			nsyid:nissayabook,
 		},
 		},
 		function (data) {
 		function (data) {
 			let result = JSON.parse(data);
 			let result = JSON.parse(data);
@@ -29,7 +69,14 @@ function nissaya_get(book, para, begin = 0, end = 0) {
 }
 }
 
 
 function render_on_page(params) {
 function render_on_page(params) {
-	let filename = params.dir + "/" + params.book + "_" + params.page + ".gif";
+	//加入前导零补足3位
+	let prefix='';
+	if(params.page < 10){
+		prefix='00';
+	}else if(params.page < 100){
+		prefix='0';
+	}
+	let filename = params.dir + "/" + params.book + "/" + prefix + params.page + ".png";
 	let html = "";
 	let html = "";
 
 
 	html += "<div class='img_box' dir='" + params.dir + "' book='" + params.book + "' page='" + params.page + "'>";
 	html += "<div class='img_box' dir='" + params.dir + "' book='" + params.book + "' page='" + params.page + "'>";

+ 6 - 4
public/app/palicanon/palicanon.js

@@ -185,15 +185,17 @@ function updataHistory(){
 
 
 function communityGetChapter(offset=0){
 function communityGetChapter(offset=0){
     next_page_loader_show();
     next_page_loader_show();
-    $.getJSON(
-		"/api/v2/progress?view=chapter",
-		{
+	let param = {
 			tags: _tags,
 			tags: _tags,
 			lang: _lang,
 			lang: _lang,
             channel: _channel,
             channel: _channel,
             channel_type: _channelType,
             channel_type: _channelType,
             offset: offset
             offset: offset
-		}
+		};
+	console.log("查询条件", param);
+    $.getJSON(
+		"/api/v2/progress?view=chapter",
+		param
 	)
 	)
     .done(function (data, status) {
     .done(function (data, status) {
             $("#filter_bar_left").html(data.data.count+"个章节");
             $("#filter_bar_left").html(data.data.count+"个章节");

+ 2 - 2
public/app/public/lang/default.json

@@ -656,11 +656,11 @@
 		"pass": "pass.",
 		"pass": "pass.",
 		"space": "&nbsp;",
 		"space": "&nbsp;",
 		"channel_type": "channel type",
 		"channel_type": "channel type",
-		"master_copy": "pāli",
-		"nissaya": "nissaya",
 		"community_new": "community new",
 		"community_new": "community new",
 		"pali_text": "pali text",
 		"pali_text": "pali text",
 		"my_read": "recent",
 		"my_read": "recent",
+		"master_copy": "pāli",
+		"nissaya": "nissaya",
 		"": ""
 		"": ""
 	},
 	},
 	"grammastr": [
 	"grammastr": [

+ 2 - 2
public/app/public/lang/en.json

@@ -655,11 +655,11 @@
 		"pass": "pass.",
 		"pass": "pass.",
 		"space": "&nbsp;",
 		"space": "&nbsp;",
 		"channel_type": "channel type",
 		"channel_type": "channel type",
-		"master_copy": "pāli",
-		"nissaya": "nissaya",
 		"community_new": "community new",
 		"community_new": "community new",
 		"pali_text": "pali text",
 		"pali_text": "pali text",
 		"my_read": "recent",
 		"my_read": "recent",
+		"master_copy": "pāli",
+		"nissaya": "nissaya",
 		"": ""
 		"": ""
 	},
 	},
 	"grammastr": [
 	"grammastr": [

+ 2 - 2
public/app/public/lang/my.json

@@ -636,11 +636,11 @@
 		"pass": "အောင်သည်။ ကျော်ဖျက်သည်။",
 		"pass": "အောင်သည်။ ကျော်ဖျက်သည်။",
 		"space": "&nbsp;",
 		"space": "&nbsp;",
 		"channel_type": "ချန်နယ်အမျိုးအစား",
 		"channel_type": "ချန်နယ်အမျိုးအစား",
-		"master_copy": "ပါလိ",
-		"nissaya": "နိဿယ",
 		"community_new": "community new",
 		"community_new": "community new",
 		"pali_text": "pali text",
 		"pali_text": "pali text",
 		"my_read": "recent",
 		"my_read": "recent",
+		"master_copy": "ပါလိ",
+		"nissaya": "နိဿယ",
 		"": ""
 		"": ""
 	},
 	},
 	"grammastr": [
 	"grammastr": [

+ 3 - 2
public/app/public/lang/si.json

@@ -660,10 +660,11 @@
 		"pass": "pass.",
 		"pass": "pass.",
 		"space": "&nbsp;",
 		"space": "&nbsp;",
 		"channel_type": "channel type",
 		"channel_type": "channel type",
-		"master_copy": "පාලි",
-		"nissaya": "සන‍්න‍ය",
+		"community_new": "community new",
 		"pali_text": "pali text",
 		"pali_text": "pali text",
 		"my_read": "recent",
 		"my_read": "recent",
+		"master_copy": "පාලි",
+		"nissaya": "සන‍්න‍ය",
 		"": ""
 		"": ""
 	},
 	},
 	"grammastr": [
 	"grammastr": [

+ 2 - 2
public/app/public/lang/zh-cn.json

@@ -658,11 +658,11 @@
 		"pass": "被动",
 		"pass": "被动",
 		"space": "",
 		"space": "",
 		"channel_type": "资源类型",
 		"channel_type": "资源类型",
-		"master_copy": "巴利底本",
-		"nissaya": "依词释",
 		"community_new": "社区动态",
 		"community_new": "社区动态",
 		"pali_text": "圣典原文",
 		"pali_text": "圣典原文",
 		"my_read": "我的阅读",
 		"my_read": "我的阅读",
+		"master_copy": "巴利底本",
+		"nissaya": "依词释",
 		"": ""
 		"": ""
 	},
 	},
 	"grammastr": [
 	"grammastr": [

+ 2 - 2
public/app/public/lang/zh-tw.json

@@ -657,11 +657,11 @@
 		"pass": "被動",
 		"pass": "被動",
 		"channel_type": "資源類型",
 		"channel_type": "資源類型",
 		"space": "",
 		"space": "",
-		"master_copy": "巴利底本",
-		"nissaya": "依詞釋",
 		"community_new": "社區動態",
 		"community_new": "社區動態",
 		"pali_text": "聖典原文",
 		"pali_text": "聖典原文",
 		"my_read": "我的閱讀",
 		"my_read": "我的閱讀",
+		"master_copy": "巴利底本",
+		"nissaya": "依詞釋",
 		"": ""
 		"": ""
 	},
 	},
 	"grammastr": [
 	"grammastr": [

+ 34 - 24
public/app/term/note.js

@@ -371,16 +371,18 @@ function note_channal_list() {
 					try {
 					try {
 						let active = JSON.parse(data);
 						let active = JSON.parse(data);
 						_channalData = active;
 						_channalData = active;
-						for (const iterator of _my_channal) {
-							let found = false;
-							for (const one of active) {
-								if (iterator.uid == one.uid) {
-									found = true;
-									break;
+						if (Array.isArray(_my_channal)) {
+							for (const iterator of _my_channal) {
+								let found = false;
+								for (const one of active) {
+									if (iterator.uid == one.uid) {
+										found = true;
+										break;
+									}
+								}
+								if (found == false) {
+									_channalData.push(iterator);
 								}
 								}
-							}
-							if (found == false) {
-								_channalData.push(iterator);
 							}
 							}
 						}
 						}
 						let strHtml = "";
 						let strHtml = "";
@@ -1618,10 +1620,12 @@ function add_new_tran_button_click(obj) {
 
 
 	let html = "<div style='display:flex; max-width: 70vw; white-space: normal;'>";
 	let html = "<div style='display:flex; max-width: 70vw; white-space: normal;'>";
 	var first_lang = "";
 	var first_lang = "";
-	for (const iterator of _my_channal) {
-		if (iterator.lang) {
-			first_lang = iterator.lang;
-			break;
+	if (Array.isArray(_my_channal)) {
+		for (const iterator of _my_channal) {
+			if (iterator.lang) {
+				first_lang = iterator.lang;
+				break;
+			}
 		}
 		}
 	}
 	}
 	//母语channel列表
 	//母语channel列表
@@ -1629,9 +1633,11 @@ function add_new_tran_button_click(obj) {
 	html += "<li>";
 	html += "<li>";
 	html += gLocal.language[first_lang];
 	html += gLocal.language[first_lang];
 	html += "</li>";
 	html += "</li>";
-	for (const iterator of _my_channal) {
-		if (iterator.status > 0 && first_lang.indexOf(iterator.lang) != -1 && iterator.lang != 0) {
-            html += renderChannelButton(iterator,obj);
+	if (Array.isArray(_my_channal)) {
+		for (const iterator of _my_channal) {
+			if (iterator.status > 0 && first_lang.indexOf(iterator.lang) != -1 && iterator.lang != 0) {
+				html += renderChannelButton(iterator,obj);
+			}
 		}
 		}
 	}
 	}
 	html += "<li><a href='../channal/my_channal_index.php' target='_blank'><button>" + gLocal.gui.new + "&nbsp;" + gLocal.gui.channel + "</button></a></li>"
 	html += "<li><a href='../channal/my_channal_index.php' target='_blank'><button>" + gLocal.gui.new + "&nbsp;" + gLocal.gui.channel + "</button></a></li>"
@@ -1642,9 +1648,11 @@ function add_new_tran_button_click(obj) {
 	html += gLocal.gui.other;
 	html += gLocal.gui.other;
 	html += "&nbsp;<button style='height: 1.8em;' onmouseover='hidden_control(this)'>➡</button>"
 	html += "&nbsp;<button style='height: 1.8em;' onmouseover='hidden_control(this)'>➡</button>"
 	html += "</li>";
 	html += "</li>";
-	for (const iterator of _my_channal) {
-		if (iterator.status > 0 && first_lang.indexOf(iterator.lang) == -1 && iterator.lang != 0) {
-			html += renderChannelButton(iterator,obj);
+	if (Array.isArray(_my_channal)) {
+		for (const iterator of _my_channal) {
+			if (iterator.status > 0 && first_lang.indexOf(iterator.lang) == -1 && iterator.lang != 0) {
+				html += renderChannelButton(iterator,obj);
+			}
 		}
 		}
 	}
 	}
 	html += "</ul>";
 	html += "</ul>";
@@ -1664,9 +1672,11 @@ function add_new_tran_button_click(obj) {
 	html += "<li>";
 	html += "<li>";
 	html += "collaborate";
 	html += "collaborate";
 	html += "</li>";
 	html += "</li>";
-	for (const iterator of _my_channal) {
-		if (iterator.status > 0 && iterator.lang == 0 && checkStringIsChinese(iterator.name) == false) {
-			html += renderChannelButton(iterator,obj);
+	if (Array.isArray(_my_channal)) {
+		for (const iterator of _my_channal) {
+			if (iterator.status > 0 && iterator.lang == 0 && checkStringIsChinese(iterator.name) == false) {
+				html += renderChannelButton(iterator,obj);
+			}
 		}
 		}
 	}
 	}
 	html += "</ul>";
 	html += "</ul>";
@@ -2381,14 +2391,14 @@ function note_get_pr(channel, id) {
 }
 }
 
 
 function get_channel_by_id(id) {
 function get_channel_by_id(id) {
-	if (typeof _channalData != "undefined") {
+	if (Array.isArray(_channalData)) {
 		for (const iterator of _channalData) {
 		for (const iterator of _channalData) {
 			if (iterator.id == id) {
 			if (iterator.id == id) {
 				return iterator;
 				return iterator;
 			}
 			}
 		}
 		}
 	}
 	}
-	if (typeof _my_channal != "undefined") {
+	if (Array.isArray(_my_channal)) {
 		for (const iterator of _my_channal) {
 		for (const iterator of _my_channal) {
 			if (iterator.id == id) {
 			if (iterator.id == id) {
 				return iterator;
 				return iterator;