Browse Source

Merge branch 'master' of https://github.com/bhikkhu-kosalla-china/mint

bhikkhu-kosalla-china 4 năm trước cách đây
mục cha
commit
f019f8cdf5

+ 1 - 0
.gitignore

@@ -13,6 +13,7 @@
 /package-lock.json
 /yarn.lock
 /composer.lock
+/app/phpinfo.php
 
 # dependencies
 /vendor/

+ 19 - 4
api/main.go

@@ -5,6 +5,7 @@ import (
 	"github.com/go-pg/pg/v10"
 	"github.com/iapt-platform/mint"
 	"fmt"
+    "github.com/go-redis/redis/v8"
 )
 
 func main() {
@@ -19,6 +20,13 @@ func main() {
 
 	rt := gin.Default()
 
+	rdb := redis.NewClient(&redis.Options{
+        Addr:     "localhost:6379",
+        Password: "", // no password set
+        DB:       0,  // use default DB
+    })
+
+
 	// TODO 在这里进行http mount
 
 	rt.GET("/demo/user/:id", mint.GetDemo(db))
@@ -56,15 +64,15 @@ func main() {
 
 	//文章
 	//根据id查询
-	rt.GET("/api/article/:aid",mint.GetArticle(db))
+	rt.GET("/api/article/:aid",mint.GetArticle(db,rdb))
 	//输入标题查询符合条件的 title% 
 	rt.GET("/api/article/title/:title",mint.GetArticleByTitle(db))
 	//新建课
 	rt.PUT("/api/article",mint.PutArticle(db))
 	//修改
-	rt.POST("/api/article",mint.PostAritcle(db))//改
+	rt.POST("/api/article",mint.PostAritcle(db,rdb))//改
 	//删除
-	rt.DELETE("/api/article/:aid",mint.DeleteArticle(db))
+	rt.DELETE("/api/article/:aid",mint.DeleteArticle(db,rdb))
 
 	//文集
 	//根据id查询
@@ -78,9 +86,16 @@ func main() {
 	//删除
 	rt.DELETE("/api/collection/:cid",mint.DeleteCollection(db))
 
-	rt.GET("/api/article_list/:cid",mint.GetCollectionArticleList(db))//改
+	//文章列表
+	rt.GET("/api/article_list/collection/:cid",mint.GetCollectionArticleList(db))//改
 	//修改
 	rt.POST("/api/article_list/article/:aid",mint.PostArticleListByArticle(db))//改
 
+
+	rt.DELETE("/api/article_list",mint.DeleteArticleInList(db,rdb))
+	rt.DELETE("/api/article_list/article/:aid",mint.DeleteArticleInList(db,rdb))
+	rt.DELETE("/api/article_list/collection/:cid",mint.DeleteCollectionInList(db,rdb))
+
 	rt.Run()
 }
+

+ 58 - 17
api/mint/article.go

@@ -6,8 +6,13 @@ import (
 	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/go-pg/pg/v10"
+	"github.com/go-redis/redis/v8"
+	"context"
 	"time"
 )
+var ctx = context.Background()
+
+
 /*
     id SERIAL PRIMARY KEY,
     uuid         VARCHAR (36) ,
@@ -28,36 +33,66 @@ import (
 type Article struct {
 	Id     int `form:"id" json:"id" binding:"required"`
 	Title string `form:"title" json:"title" binding:"required"`
-	Subtitle string `form:"subtitle" json:"subtitle" binding:"required"`
-	Summary string `form:"summary" json:"summary" binding:"required"`
-	Content string `form:"content" json:"content" binding:"required"`
+	Subtitle string `form:"subtitle" json:"subtitle"`
+	Summary string `form:"summary" json:"summary"`
+	Content string `form:"content" json:"content"`
 	OwnerId int
-	Setting string `form:"setting" json:"setting" binding:"required"`
-	Status int `form:"status" json:"status" binding:"required"`
+	Setting string `form:"setting" json:"setting"`
+	Status int `form:"status" json:"status"`
 	Version int
     DeletedAt time.Time
     CreatedAt time.Time
     UpdatedAt time.Time
 }
 //查询
-func GetArticle(db *pg.DB) gin.HandlerFunc {
+func GetArticle(db *pg.DB, rdb *redis.Client) gin.HandlerFunc {
 	return func(c *gin.Context) {
 		lid,err := strconv.ParseInt(c.Param("aid"),10,64)
 		if err != nil {
 			panic(err)
 		}
-		fmt.Println("get lesson")
-		// TODO 在这里进行db操作
-		// Select user by primary key.
+		fmt.Println("get article")
+		rkey := "article://"+c.Param("aid")
+		n, err := rdb.Exists(ctx,rkey).Result()
+		if err != nil  {
+			fmt.Println(err)
+		}else if n == 0 {
+			fmt.Println("redis key not exist")
+		}else{
+			fmt.Println("redis key exist")
+			val, err := rdb.HGetAll(ctx, rkey).Result()
+			if err != nil || val == nil {
+				//有错误或者没查到
+				fmt.Println("redis error")
+					
+			}else{
+				fmt.Println("redis no error")
+				c.JSON(http.StatusOK, gin.H{
+					"data": val,
+				})
+				return
+			}	
+		}
+
 		article := &Article{Id: int(lid)}
-		err = db.Model(article).WherePK().Select()
+		err = db.Model(article).Column("id","title","subtitle","content","owner_id","setting","status","version","updated_at").WherePK().Select()
 		if err != nil {
 			panic(err)
-		}
-		
+		}			
 		c.JSON(http.StatusOK, gin.H{
-			"message": "article-"+article.Title,
+			"data": article,
 		})
+		//写入redis
+		rdb.HSet(ctx,rkey,"id",article.Id)
+		rdb.HSet(ctx,rkey,"title",article.Title)
+		rdb.HSet(ctx,rkey,"subtitle",article.Subtitle)
+		rdb.HSet(ctx,rkey,"content",article.Content)
+		rdb.HSet(ctx,rkey,"owner_id",article.OwnerId)
+		rdb.HSet(ctx,rkey,"setting",article.Setting)
+		rdb.HSet(ctx,rkey,"status",article.Status)
+		rdb.HSet(ctx,rkey,"version",article.Version)
+		rdb.HSet(ctx,rkey,"updated_at",article.UpdatedAt)
+			
 	}
 }
 
@@ -110,7 +145,7 @@ func PutArticle(db *pg.DB) gin.HandlerFunc{
 
 
 //修改
-func PostAritcle(db *pg.DB) gin.HandlerFunc{
+func PostAritcle(db *pg.DB,rdb *redis.Client) gin.HandlerFunc{
 	return func(c *gin.Context){
 		var form Article
 
@@ -126,14 +161,16 @@ func PostAritcle(db *pg.DB) gin.HandlerFunc{
 		c.JSON(http.StatusOK,gin.H{
 			"message":"update ok",
 		})
+		rkey := "article://"+strconv.Itoa(form.Id)
+		rdb.Del(ctx,rkey)
 	}
 }
 
 
 //删
-func DeleteArticle(db *pg.DB) gin.HandlerFunc{
+func DeleteArticle(db *pg.DB ,rdb *redis.Client) gin.HandlerFunc{
 	return func(c *gin.Context){
-		id,err := strconv.ParseInt(c.Param("aid"),10,64)
+		id,err := strconv.Atoi(c.Param("aid"))
 		if err != nil {
 			panic(err)
 		}
@@ -145,9 +182,13 @@ func DeleteArticle(db *pg.DB) gin.HandlerFunc{
 		if err != nil {
 			panic(err)
 		}
-		
+		//TODO 删除article_list表相关项目
 		c.JSON(http.StatusOK,gin.H{
 			"message":"delete "+c.Param("lid"),
 		})
+
+		rkey := "article://"+c.Param("aid")
+		rdb.Del(ctx,rkey)
+
 	}
 }

+ 45 - 1
api/mint/article_list.go

@@ -7,8 +7,10 @@ import (
 	"github.com/go-pg/pg/v10"
 	"time"
 	"encoding/json"
-
+	"github.com/go-redis/redis/v8"
 )
+
+
 type ArticleList struct {
 	Id     int `form:"id" json:"id"`
 	CollectionId int `form:"collection_id" json:"collection_id" binding:"required"`
@@ -91,4 +93,46 @@ func PostArticleListByArticle(db *pg.DB) gin.HandlerFunc{
 	}
 }
 
+//删
+func DeleteArticleInList(db *pg.DB ,rdb *redis.Client) gin.HandlerFunc{
+	return func(c *gin.Context){
+		id,err := strconv.Atoi(c.Param("aid"))
+		if err != nil {
+			panic(err)
+		}
+		//删之前获取 course_id
+		_, err = db.Model((*ArticleList)(nil)).Where("article_id = ?",id).Delete()
+		if err != nil {
+			panic(err)
+		}
+		//TODO 删除article_list表相关项目
+		c.JSON(http.StatusOK,gin.H{
+			"message":"delete "+c.Param("aid"),
+		})
+
+		rkey := "article_list://"+c.Param("aid")
+		rdb.Del(ctx,rkey)
 
+	}
+}
+//删
+func DeleteCollectionInList(db *pg.DB ,rdb *redis.Client) gin.HandlerFunc{
+	return func(c *gin.Context){
+		id,err := strconv.Atoi(c.Param("cid"))
+		if err != nil {
+			panic(err)
+		}
+		//删之前获取 course_id
+		_, err = db.Model((*ArticleList)(nil)).Where("collection_id = ?",id).Delete()
+		if err != nil {
+			panic(err)
+		}
+		//TODO 删除article_list表相关项目
+		c.JSON(http.StatusOK,gin.H{
+			"message":"delete "+c.Param("cid"),
+		})
+
+		rkey := "article_list://collection_"+c.Param("cid")
+		rdb.Del(ctx,rkey)
+	}
+}

+ 15 - 0
api/mint/redis.go

@@ -0,0 +1,15 @@
+package mint
+
+import (
+	"github.com/go-redis/redis/v8"
+)
+
+
+func RedisConnect() *redis.Client{
+    rdb := redis.NewClient(&redis.Options{
+        Addr:     "localhost:6379",
+        Password: "", // no password set
+        DB:       0,  // use default DB
+    })
+	return(rdb)
+}

+ 1 - 1
app/channal/my_channal_post.php

@@ -57,7 +57,7 @@ else{
 
 	// 设置 逐词译库可见性
 	PDO_Connect(_FILE_DB_USER_WBW_);
-	$query="UPDATE wbw_block SET lang = ?  , status = ? where  channal = ?  ";
+	$query="UPDATE "._TABLE_USER_WBW_BLOCK_." SET lang = ?  , status = ? where  channal = ?  ";
 	$sth = PDO_Execute($query,array($_POST["lang"],$_POST["status"],$_POST["id"]));
 	if (!$sth || ($sth && $sth->errorCode() != 0)) {
 		$error = PDO_ErrorInfo();

+ 2 - 2
app/db/wbw_block.php

@@ -6,13 +6,13 @@ require_once "../channal/function.php";
 class WbwBlock extends Table
 {
     function __construct($redis=false) {
-		parent::__construct(_FILE_DB_USER_WBW_, "wbw_block", "", "",$redis);
+		parent::__construct(_FILE_DB_USER_WBW_, _TABLE_USER_WBW_BLOCK_, "", "",$redis);
     }
 
 	public function getPower($blockId){
 		$channelInfo = new Channal($this->redis);
 		$power = 0;
-		$query = "SELECT channal,owner from wbw_block   where id= ?  ";
+		$query = "SELECT channal,owner from "._TABLE_USER_WBW_BLOCK_."   where id= ?  ";
 		$row = $this->fetch($query,array($blockId));
 		if($row ){
 			if(empty($row["channal"])){

+ 2 - 2
app/doc/edit_wbw.php

@@ -58,8 +58,8 @@ foreach($Fetch as $row){
     echo '<div class="title" style="flex:3;padding-bottom:5px;">'.$row["lang"].'</div>';
     echo '<div class="title" style="flex:2;padding-bottom:5px;">';
     // 查询逐词解析库
-    PDO_Connect(""._FILE_DB_USER_WBW_);
-    $query = "select count(*) from wbw_block where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList}  limit 0,100";
+    PDO_Connect(_FILE_DB_USER_WBW_);
+    $query = "SELECT count(*) from "._TABLE_USER_WBW_BLOCK_." where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList}  limit 0,100";
     $FetchWBW = PDO_FetchOne($query);
     echo '</div>';
     echo '<div class="title" style="flex:2;padding-bottom:5px;">';

+ 10 - 10
app/doc/fork.php

@@ -59,8 +59,8 @@ if (isset($_GET["channel"]) == false) {
         echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["name"] . '</div>';
         echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["lang"] . '</div>';
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
-        PDO_Connect("" . _FILE_DB_USER_WBW_);
-        $query = "select count(*) from wbw_block where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
+        PDO_Connect(_FILE_DB_USER_WBW_);
+        $query = "SELECT count(*) from "._TABLE_USER_WBW_BLOCK_." where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
         $FetchWBW = PDO_FetchOne($query);
         echo '</div>';
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
@@ -73,8 +73,8 @@ if (isset($_GET["channel"]) == false) {
         echo '</div>';
 
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
-        PDO_Connect("" . _FILE_DB_SENTENCE_);
-        $query = "select count(*) from sentence where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
+        PDO_Connect(_FILE_DB_SENTENCE_);
+        $query = "SELECT count(*) from sentence where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
         $FetchWBW = PDO_FetchOne($query);
         echo '</div>';
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
@@ -101,7 +101,7 @@ if (isset($_GET["channel"]) == false) {
 {
     PDO_Connect("" . _FILE_DB_FILEINDEX_);
     $doc_id = $_GET["doc_id"];
-    $query = "select * from fileindex where id= ? ";
+    $query = "SELECT * from fileindex where id= ? ";
     $Fetch = PDO_FetchAll($query, array($doc_id));
     $iFetch = count($Fetch);
     if ($iFetch > 0) {
@@ -120,7 +120,7 @@ if (isset($_GET["channel"]) == false) {
         } else {
             //别人的文档
             //查询自己是否以前打开过
-            $query = "select * from fileindex where parent_id='{$doc_id}' and user_id='{$uid}' ";
+            $query = "SELECT * from fileindex where parent_id='{$doc_id}' and user_id='{$uid}' ";
             $FetchSelf = PDO_FetchAll($query);
             $iFetchSelf = count($FetchSelf);
             if ($iFetchSelf > 0) {
@@ -234,7 +234,7 @@ if (isset($_GET["channel"]) == false) {
                             case 6:
                                 #逐词解析
                                 $blockid = $blocks[$i]->block_id;
-                                $query = "select * from wbw_block where id= ? ";
+                                $query = "select * from "._TABLE_USER_WBW_BLOCK_." where id= ? ";
                                 $stmt = $dbhWBW->prepare($query);
                                 $stmt->execute(array($blockid));
                                 $fBlock = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -257,7 +257,7 @@ if (isset($_GET["channel"]) == false) {
                                         ));
                                 }
 
-                                $query = "select * from wbw where block_id= ? ";
+                                $query = "select * from "._TABLE_USER_WBW_." where block_id= ? ";
                                 $stmtWBW = $dbhWBW->prepare($query);
                                 $stmtWBW->execute(array($fBlock[0]["id"]));
                                 $fBlockData = $stmtWBW->fetchAll(PDO::FETCH_ASSOC);
@@ -288,7 +288,7 @@ if (isset($_GET["channel"]) == false) {
 
                     if (count($arrNewBlock) > 0) {
                         $dbhWBW->beginTransaction();
-                        $query = "INSERT INTO wbw_block ('id','parent_id','channal','owner','book','paragraph','style','lang','status','modify_time','receive_time') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+                        $query = "INSERT INTO "._TABLE_USER_WBW_BLOCK_." ('id','parent_id','channal','owner','book','paragraph','style','lang','status','modify_time','receive_time') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
                         $stmtNewBlock = $dbhWBW->prepare($query);
                         foreach ($arrNewBlock as $oneParam) {
                             $stmtNewBlock->execute($oneParam);
@@ -308,7 +308,7 @@ if (isset($_GET["channel"]) == false) {
                     if (count($arrNewBlockData) > 0) {
                         // 开始一个事务,逐词解析数据 关闭自动提交
                         $dbhWBW->beginTransaction();
-                        $query = "INSERT INTO wbw ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+                        $query = "INSERT INTO "._TABLE_USER_WBW_." ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
                         $stmtWbwData = $dbhWBW->prepare($query);
                         foreach ($arrNewBlockData as $oneParam) {
                             $stmtWbwData->execute($oneParam);

+ 9 - 9
app/doc/fork_channel.php

@@ -70,7 +70,7 @@ if (isset($_GET["dest_channel"]) == false) {
         echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["name"] . '</div>';
         echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["lang"] . '</div>';
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
-        $query = "select count(*) from wbw_block where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
+        $query = "select count(*) from "._TABLE_USER_WBW_BLOCK_." where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
         $FetchWBW = PDO_FetchOne($query);
         echo '</div>';
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
@@ -110,7 +110,7 @@ $srcPower = (int)$channelInfo->getPower($_GET["src_channel"]);
         } else {
             //别人的文档
             //查询以前自己是否曾经复刻
-            $query = "select * from wbw_block where parent_channel=? and owner=? ";
+            $query = "SELECT * from "._TABLE_USER_WBW_BLOCK_." where parent_channel=? and owner=? ";
             $FetchSelf = PDO_FetchAll($query,array($_GET["src_channel"],$_COOKIE["userid"]));
             $iFetchSelf = count($FetchSelf);
             if ($iFetchSelf > 0) {
@@ -139,7 +139,7 @@ $srcPower = (int)$channelInfo->getPower($_GET["src_channel"]);
 
                     $blocks = $_para;
                     for ($i = 0; $i < count($blocks); $i++) {
-						$query = "select id from wbw_block where book= ? and paragraph = ? and channal = ? ";
+						$query = "SELECT id from "._TABLE_USER_WBW_BLOCK_." where book= ? and paragraph = ? and channal = ? ";
 						$stmt = $dbhWBW->prepare($query);
 						$stmt->execute(array($_GET["book"],$iPara,$_GET["dest_channel"]));
 						$fDest = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -149,7 +149,7 @@ $srcPower = (int)$channelInfo->getPower($_GET["src_channel"]);
 						}
 						#逐词解析
 						$iPara = $blocks[$i];
-						$query = "select * from wbw_block where book= ? and paragraph = ? and channal = ? ";
+						$query = "SELECT * from "._TABLE_USER_WBW_BLOCK_." where book= ? and paragraph = ? and channal = ? ";
 						$stmt = $dbhWBW->prepare($query);
 						$stmt->execute(array($_GET["book"],$iPara,$_GET["src_channel"]));
 						$fBlock = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -178,7 +178,7 @@ $srcPower = (int)$channelInfo->getPower($_GET["src_channel"]);
 								));
 						}
 
-						$query = "select * from wbw where block_id= ? ";
+						$query = "SELECT * from "._TABLE_USER_WBW_." where block_id= ? ";
 						$stmtWBW = $dbhWBW->prepare($query);
 						$stmtWBW->execute(array($fBlock[0]["id"]));
 						$fBlockData = $stmtWBW->fetchAll(PDO::FETCH_ASSOC);
@@ -204,14 +204,14 @@ $srcPower = (int)$channelInfo->getPower($_GET["src_channel"]);
 					# 查找目标block是否存在
 
 					//删除旧的逐词解析block数据块
-					$query = "DELETE from wbw_block where  paragraph = ? AND book = ? AND channal = ? ";
+					$query = "DELETE from "._TABLE_USER_WBW_BLOCK_." where  paragraph = ? AND book = ? AND channal = ? ";
 					$stmt = $dbhWBW->prepare($query);
 					$stmt->execute(array($iPara,$_GET["book"],$_GET["dest_channel"]));
 					
                     //新增逐词解析block数据块
                     if (count($arrNewBlock) > 0) {
                         $dbhWBW->beginTransaction();
-                        $query = "INSERT INTO wbw_block ('id','parent_id','channal','parent_channel','owner','book','paragraph','style','lang','status','modify_time','receive_time','create_time') VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
+                        $query = "INSERT INTO "._TABLE_USER_WBW_BLOCK_." ('id','parent_id','channal','parent_channel','owner','book','paragraph','style','lang','status','modify_time','receive_time','create_time') VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
                         $stmtNewBlock = $dbhWBW->prepare($query);
                         foreach ($arrNewBlock as $oneParam) {
                             $stmtNewBlock->execute($oneParam);
@@ -231,7 +231,7 @@ $srcPower = (int)$channelInfo->getPower($_GET["src_channel"]);
 
 					//删除逐词解析数据块
 					if(isset($destId)){
-						$query = "DELETE from wbw where  block_id = ? ";
+						$query = "DELETE from "._TABLE_USER_WBW_." where  block_id = ? ";
 						$stmt = $dbhWBW->prepare($query);
 						$stmt->execute($destId);
 					}
@@ -239,7 +239,7 @@ $srcPower = (int)$channelInfo->getPower($_GET["src_channel"]);
                     if (count($arrNewBlockData) > 0) {
                         // 开始一个事务,逐词解析数据 关闭自动提交
                         $dbhWBW->beginTransaction();
-                        $query = "INSERT INTO wbw ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+                        $query = "INSERT INTO "._TABLE_USER_WBW_." ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
                         $stmtWbwData = $dbhWBW->prepare($query);
                         foreach ($arrNewBlockData as $oneParam) {
                             $stmtWbwData->execute($oneParam);

+ 2 - 2
app/doc/load_channal_para.php

@@ -45,7 +45,7 @@ $dh_wbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 foreach ($paralist as $para) {
 
     $albumId = UUID::v4();
-    $query = "SELECT * FROM wbw_block WHERE channal=? AND book = ? AND paragraph = ?  ";
+    $query = "SELECT * FROM "._TABLE_USER_WBW_BLOCK_." WHERE channal=? AND book = ? AND paragraph = ?  ";
     $stmt = $dh_wbw->prepare($query);
     $stmt->execute(array($channal, $book, $para));
     $FetchBlock = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -69,7 +69,7 @@ foreach ($paralist as $para) {
 
         echo "<data>\n";
         $block_id = $FetchBlock["id"];
-        $query = "SELECT * from wbw where block_id= ? order by wid ASC";
+        $query = "SELECT * from "._TABLE_USER_WBW_." where block_id= ? order by wid ASC";
         $stmt = $dh_wbw->prepare($query);
         $stmt->execute(array($block_id));
         $wbw_data = $stmt->fetchAll(PDO::FETCH_ASSOC);

+ 3 - 3
app/doc/pcs2db.php

@@ -58,7 +58,7 @@ if (isset($_GET["channel"]) == false) {
         echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["lang"] . '</div>';
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
         PDO_Connect("" . _FILE_DB_USER_WBW_);
-        $query = "select count(*) from wbw_block where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
+        $query = "select count(*) from "._TABLE_USER_WBW_BLOCK_." where channal = '{$row["id"]}' and book='{$mbook}' and paragraph in ({$paragraph})  limit 0,100";
         $FetchWBW = PDO_FetchOne($query);
         echo '</div>';
         echo '<div class="title" style="flex:2;padding-bottom:5px;">';
@@ -343,7 +343,7 @@ $dataBlock = $xml->xpath('//block');
     #插入逐词解析块数据
     if (count($arrNewBlock) > 0) {
         $dbhWBW->beginTransaction();
-        $query = "INSERT INTO wbw_block (
+        $query = "INSERT INTO "._TABLE_USER_WBW_BLOCK_." (
 										'id',
 										'parent_id',
 										'channal',
@@ -376,7 +376,7 @@ $dataBlock = $xml->xpath('//block');
     if (count($arrNewBlockData) > 0) {
         // 开始一个事务,逐词解析数据 关闭自动提交
         $dbhWBW->beginTransaction();
-        $query = "INSERT INTO wbw ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+        $query = "INSERT INTO "._TABLE_USER_WBW_." ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
         $stmtWbwData = $dbhWBW->prepare($query);
         foreach ($arrNewBlockData as $oneParam) {
             $stmtWbwData->execute($oneParam);

+ 19 - 9
app/path.php

@@ -50,14 +50,17 @@ define("_DIR_USER_IMG_", __DIR__ . "/../tmp/user/media/3");
 define("_DIR_USER_IMG_LINK_", "../../tmp/user/media/3");
 define("_DIR_MYDOCUMENT_", "/my_document");
 
+# 逐词解析字典文件
+define("_FILE_DB_WBW1_",  __DIR__ . "/../tmp/user/wbw.db3");
+
 #数据库
 # 数据库基本参数
 define("_DB_ENGIN_", "sqlite");
 
 define("_DB_HOST_", "localhost");
 define("_DB_PORT_", "5432");
-define("_DB_USERNAME_", "");
-define("_DB_PASSWORD_", "");
+define("_DB_USERNAME_", "postgres");
+define("_DB_PASSWORD_", "123456");
 define("_DB_NAME_", "mint");
 
 //语料库数据表 pali canon db file 
@@ -84,6 +87,7 @@ define("_FILE_DB_PALI_INDEX_", "sqlite:" . __DIR__ . "/../tmp/appdata/palicanon/
 //页码对应
 define("_FILE_DB_PAGE_INDEX_", "sqlite:" . __DIR__ . "/../tmp/appdata/palicanon/pagemap.db3");
 //以书为单位的单词汇总表
+//define("_FILE_DB_BOOK_WORD_", "pgsql:host="._DB_HOST_.";port="._DB_PORT_.";dbname="._DB_NAME_.";user="._DB_USERNAME_.";password="._DB_PASSWORD_.";");
 define("_FILE_DB_BOOK_WORD_", "sqlite:" . __DIR__ . "/../tmp/appdata/palicanon/bookword.db3");
 define("_TABLE_BOOK_WORD_", "bookword");
 //黑体字数据表
@@ -123,14 +127,20 @@ define("_TABLE_PART_", "part");
 //读写频繁
 # 逐词解析表
 define("_FILE_DB_USER_WBW_", "sqlite:" . __DIR__ . "/../tmp/user/user_wbw.db3");
+define("_TABLE_USER_WBW_", "wbw");
+define("_TABLE_USER_WBW_BLOCK_", "wbw_block");
 # 译文
 define("_FILE_DB_SENTENCE_", "sqlite:" . __DIR__ . "/../tmp/user/sentence.db3");
+define("_TABLE_SENTENCE_", "sentence");
+define("_TABLE_SENTENCE_BLOCK_", "sent_block");
 # 译文编辑历史
 define("_FILE_DB_USER_SENTENCE_HISTORAY_", "sqlite:" . __DIR__ . "/../tmp/user/usent_historay.db3");
+define("_TABLE_SENTENCE_HISTORAY_", "sent_historay");
 # 逐词解析字典
 define("_FILE_DB_WBW_", "sqlite:" . __DIR__ . "/../tmp/user/wbw.db3");
-# 逐词解析字典文件
-define("_FILE_DB_WBW1_",  __DIR__ . "/../tmp/user/wbw.db3");
+define("_TABLE_DICT_WBW_", "wbw");
+define("_TABLE_DICT_WBW_INDEX_", "wbw_index");
+
 
 //写入频繁 读取不频繁
 # 用户行为记录
@@ -139,15 +149,16 @@ define("_FILE_DB_USER_ACTIVE_LOG_", "sqlite:" . __DIR__ . "/../tmp/user/user_act
 
 
 //读取频繁 写入不频繁 
+# 用户账号
+define("_FILE_DB_USERINFO_", "sqlite:" . __DIR__ . "/../tmp/user/userinfo.db3");
+# 版本风格 
+define("_FILE_DB_CHANNAL_", "sqlite:" . __DIR__ . "/../tmp/user/channal.db3");
+
 # 文章 文集
 define("_FILE_DB_USER_ARTICLE_", "sqlite:" . __DIR__ . "/../tmp/user/article.db3");
 
 # 术语
 define("_FILE_DB_TERM_", "sqlite:" . __DIR__ . "/../tmp/user/dhammaterm.db");
-# 版本风格 
-define("_FILE_DB_CHANNAL_", "sqlite:" . __DIR__ . "/../tmp/user/channal.db3");
-# 用户账号
-define("_FILE_DB_USERINFO_", "sqlite:" . __DIR__ . "/../tmp/user/userinfo.db3");
 # 协作
 define("_FILE_DB_USER_SHARE_", "sqlite:" . __DIR__ . "/../tmp/user/share.db3");
 
@@ -175,7 +186,6 @@ define("_FILE_DB_MEDIA_", "sqlite:" . __DIR__ . "/../tmp/user/media.db3");
 define("_FILE_DB_USER_DICT_", "sqlite:" . __DIR__ . "/../tmp/user/udict.db3");
 
 
-
 # 评论 尚未启用
 define("_FILE_DB_COMMENTS_", "sqlite:" . __DIR__ . "/../tmp/user/comments.db3");
 

+ 1 - 1
app/public/_pdo.php

@@ -2,7 +2,7 @@
 function PDO_Connect($dsn, $user="", $password="")
 {
     global $PDO;
-    $PDO = new PDO($dsn, $user, $password,array(PDO::ATTR_PERSISTENT=>true));
+    $PDO = new PDO($dsn,_DB_USERNAME_,_DB_PASSWORD_,array(PDO::ATTR_PERSISTENT=>true));
     $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 }
 function PDO_FetchOne($query, $params=null)

+ 1 - 0
app/search/paliword_search.php

@@ -162,6 +162,7 @@ switch ($op) {
             $time_start = microtime_float();
 
             PDO_Connect(_FILE_DB_PALI_INDEX_);
+			//TODO 在没有查到书的时候$strFirstBookList为 (  需要修改
             $query = "SELECT book,paragraph, wordindex FROM word WHERE \"wordindex\" in $strQueryWordId and book in $strFirstBookList group by book,paragraph LIMIT 0,20";
             $Fetch = PDO_FetchAll($query);
             //echo "<div>$query</div>";

+ 3 - 3
app/studio/project.php

@@ -203,7 +203,7 @@ switch ($op) {
 
                             PDO_Connect(_FILE_DB_USER_WBW_);
                             $PDO->beginTransaction();
-                            $query = "INSERT INTO wbw_block ('id','parent_id','channal','owner','book','paragraph','style','lang','status','modify_time','receive_time') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+                            $query = "INSERT INTO "._TABLE_USER_WBW_BLOCK_." ('id','parent_id','channal','owner','book','paragraph','style','lang','status','modify_time','receive_time') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
                             $stmt = $PDO->prepare($query);
                             foreach ($block_data as $oneParam) {
                                 $stmt->execute($oneParam);
@@ -221,7 +221,7 @@ switch ($op) {
                             // 开始一个事务,关闭自动提交
 
                             $PDO->beginTransaction();
-                            $query = "INSERT INTO wbw ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+                            $query = "INSERT INTO "._TABLE_USER_WBW_." ('id','block_id','book','paragraph','wid','word','data','modify_time','receive_time','status','owner') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
                             $stmt = $PDO->prepare($query);
                             foreach ($wbw_data as $oneParam) {
                                 $stmt->execute($oneParam);
@@ -356,7 +356,7 @@ switch ($op) {
                     echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["lang"] . '</div>';
                     echo '<div class="title" style="flex:2;padding-bottom:5px;">';
                     PDO_Connect( _FILE_DB_USER_WBW_);
-                    $query = "select count(*) from wbw_block where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList}  limit 0,100";
+                    $query = "select count(*) from "._TABLE_USER_WBW_BLOCK_." where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList}  limit 0,100";
                     $FetchWBW = PDO_FetchOne($query);
                     echo '</div>';
                     echo '<div class="title" style="flex:2;padding-bottom:5px;">';

+ 2 - 2
app/studio/project_load_article.php

@@ -32,7 +32,7 @@ if (count($Fetch) > 0) {
             case "6":
                 {
                     $albumId = UUID::v4();
-                    $query = "select * from wbw_block where id='" . $block->block_id . "'";
+                    $query = "select * from "._TABLE_USER_WBW_BLOCK_." where id='" . $block->block_id . "'";
                     $stmt = $dh_wbw->query($query);
                     $FetchBlock = $stmt->fetchAll(PDO::FETCH_ASSOC);
                     echo "\n<block>";
@@ -52,7 +52,7 @@ if (count($Fetch) > 0) {
                     echo "<id>{$block->block_id}</id>";
                     echo "</info>\n";
                     echo "<data>\n";
-                    $query = "select * from wbw where block_id='" . $block->block_id . "'";
+                    $query = "select * from "._TABLE_USER_WBW_." where block_id='" . $block->block_id . "'";
                     $stmt = $dh_wbw->query($query);
                     $wbw_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
                     foreach ($wbw_data as $word) {

+ 2 - 2
app/studio/project_load_db.php

@@ -31,7 +31,7 @@ if (count($Fetch) > 0) {
             case "6":
                 {
                     $albumId = UUID::v4();
-                    $query = "select * from wbw_block where id='" . $block->block_id . "'";
+                    $query = "select * from "._TABLE_USER_WBW_BLOCK_." where id='" . $block->block_id . "'";
                     $stmt = $dh_wbw->query($query);
                     $FetchBlock = $stmt->fetchAll(PDO::FETCH_ASSOC);
                     echo "\n<block>";
@@ -51,7 +51,7 @@ if (count($Fetch) > 0) {
                     echo "<id>{$block->block_id}</id>";
                     echo "</info>\n";
                     echo "<data>\n";
-                    $query = "SELECT * FROM wbw WHERE block_id='" . $block->block_id . "' order by wid ASC";
+                    $query = "SELECT * FROM "._TABLE_USER_WBW_." WHERE block_id='" . $block->block_id . "' order by wid ASC";
                     $stmt = $dh_wbw->query($query);
                     $wbw_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
                     foreach ($wbw_data as $word) {

+ 1 - 1
app/sync/table_wbw_block.php

@@ -6,7 +6,7 @@ require_once "../sync/function.php";
 
 $input = (object) [
     "database" =>  _FILE_DB_USER_WBW_,
-    "table" =>  "wbw_block",
+    "table" =>  _TABLE_USER_WBW_BLOCK_,
     "uuid" =>  "id",
     "sync_id" =>  ["id"],
     "modify_time" =>  "modify_time",

+ 24 - 23
app/term/note.js

@@ -204,21 +204,33 @@ function note_refresh_new(callback = null) {
 	}
 }
 
-//渲染阅读模式句子
-function render_read_mode_sent(iterator) {
-	let id = iterator.id;
-	let strPalitext =
+//渲染巴利原文句子
+function render_pali_sent(palitext){
+	let output = "";
+	output =
 		"<pali book='" +
-		iterator.book +
+		palitext.book +
 		"' para='" +
-		iterator.para +
+		palitext.para +
 		"' begin='" +
-		iterator.begin +
+		palitext.begin +
 		"' end='" +
-		iterator.end +
-		"' >" +
-		iterator.palitext +
-		"</pali>";
+		palitext.end +
+		"' >";
+	if(palitext.book<1000){
+		output += palitext.palitext;
+	}
+	else{
+		output += marked(palitext.palitext);
+	}
+		
+	output +="</pali>";
+	return output;
+}
+//渲染阅读模式句子
+function render_read_mode_sent(iterator) {
+	let id = iterator.id;
+	let strPalitext =render_pali_sent(iterator);
 
 	if (
 		$("#" + id)
@@ -588,18 +600,7 @@ function note_json_html(in_json) {
 	output += "</div>";
 	output += " </div>";
 
-	let strPalitext =
-		"<pali book='" +
-		in_json.book +
-		"' para='" +
-		in_json.para +
-		"' begin='" +
-		in_json.begin +
-		"' end='" +
-		in_json.end +
-		"' >" +
-		in_json.palitext +
-		"</pali>";
+	let strPalitext = render_pali_sent(in_json);
 
 	output += "<div class='note_body'>";
 	output += "<div class='palitext_div'>";

+ 8 - 0
app/term/term.css

@@ -970,3 +970,11 @@ ins {
 	background-color: greenyellow;
 	text-decoration: unset;
 }
+
+pali>p {
+    display: inline;
+}
+
+.para_mode .palitext{
+	text-indent: 2em;
+}

+ 3 - 3
app/uwbw/create_wbw.php

@@ -78,7 +78,7 @@ $dbh_wbw->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 
 foreach ($_para as $key => $para) {
     # code...
-    $query = "SELECT count(*) FROM wbw_block WHERE channal = ? AND book= ? and paragraph = ? ";
+    $query = "SELECT count(*) FROM "._TABLE_USER_WBW_BLOCK_." WHERE channal = ? AND book= ? and paragraph = ? ";
     $FetchWBW = PDO_FetchOne($query,array($_channel,$_book,$para));
     if($FetchWBW==0){
         #建立
@@ -107,7 +107,7 @@ foreach ($_para as $key => $para) {
                                         "readonly"=>false
                                     );
         $dbh_wbw->beginTransaction();
-        $query="INSERT INTO wbw_block ('id',
+        $query="INSERT INTO "._TABLE_USER_WBW_BLOCK_." ('id',
                                                                  'parent_id',
                                                                  'channal',
                                                                  'owner',
@@ -179,7 +179,7 @@ foreach ($_para as $key => $para) {
             // 开始一个事务,关闭自动提交
 
             $dbh_wbw->beginTransaction();
-            $query="INSERT INTO wbw ('id',
+            $query="INSERT INTO "._TABLE_USER_WBW_." ('id',
                                                            'block_id',
                                                            'book',
                                                            'paragraph',

+ 1 - 1
app/uwbw/update.php

@@ -47,7 +47,7 @@ if (count($aData) > 0) {
 
     /* 开始一个事务,关闭自动提交 */
     $PDO->beginTransaction();
-    $query = "UPDATE wbw SET data= ?  , receive_time= ?  , modify_time= ?   where block_id= ?  and wid= ?  ";
+    $query = "UPDATE "._TABLE_USER_WBW_." SET data= ?  , receive_time= ?  , modify_time= ?   where block_id= ?  and wid= ?  ";
     $sth = $PDO->prepare($query);
 
     foreach ($aData as $data) {

+ 6 - 4
app/uwbw/update_analytics.php

@@ -1,19 +1,21 @@
 <?php
+/*
+统计三十天内的逐词译创建与更新
+*/
 require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once '../public/load_lang.php';
 require_once '../public/function.php';
 
 global $PDO;
-PDO_Connect("" . _FILE_DB_USER_WBW_);
+PDO_Connect(_FILE_DB_USER_WBW_);
 
 echo "Day Index,创建,更新\n";
 $end = strtotime("now") * 1000;
 $begin = strtotime("-1 day") * 1000;
 for ($i = 0; $i < 30; $i++) {
-    //$query = "select count(*) from wbw where \"create_time\" > ".$PDO->quote($begin)." AND \"create_time\" < ".$PDO->quote($end). " AND owner = ".$PDO->quote($_COOKIE["userid"]);
-    $create = 0; //PDO_FetchOne($query);
-    $query = "select count(*) from wbw where  \"modify_time\" > " . $PDO->quote($begin) . " AND \"modify_time\" < " . $PDO->quote($end) . " AND owner = " . $PDO->quote($_COOKIE["username"]);
+    $create = 0; 
+    $query = "SELECT count(*) from "._TABLE_USER_WBW_." where  \"modify_time\" > " . $PDO->quote($begin) . " AND \"modify_time\" < " . $PDO->quote($end) . " AND owner = " . $PDO->quote($_COOKIE["username"]);
     $modify = PDO_FetchOne($query);
     echo date("m/d/Y", $begin / 1000) . ',' . $create . "," . $modify . "\n";
     $end = $begin;

+ 4 - 1
app/uwbw/wbw_analyse.php

@@ -1,4 +1,7 @@
 <?php
+/*
+逐词解析数据库数据分析
+*/
 require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once '../public/load_lang.php';
@@ -7,7 +10,7 @@ require_once '../public/function.php';
 global $PDO;
 PDO_Connect("" . _FILE_DB_USER_WBW_);
 
-$query = "SELECT * from wbw where  1";
+$query = "SELECT * from "._TABLE_USER_WBW_." where  1";
 
 $sth = $PDO->prepare($query);
 $sth->execute();

+ 2 - 2
app/uwbw/wbw_channel_list.php

@@ -56,7 +56,7 @@ foreach ($coop_channal as $key => $value) {
 
 # 查询全网公开 的
 PDO_Connect( _FILE_DB_USER_WBW_);
-$query = "SELECT  channal FROM wbw_block WHERE  paragraph IN ($place_holders)  AND book = ? AND channal IS NOT NULL AND status = 30 group by channal ";
+$query = "SELECT  channal FROM "._TABLE_USER_WBW_BLOCK_." WHERE  paragraph IN ($place_holders)  AND book = ? AND channal IS NOT NULL AND status = 30 group by channal ";
 $publicChannel = PDO_FetchAll($query, $params);
 foreach ($publicChannel as $key => $channel) {
 	# code...
@@ -73,7 +73,7 @@ $outputData = array();
 foreach ($channelList as $key => $row) {
     $queryParam = $params;
     $queryParam[] = $key;
-    $query = "SELECT count(*) FROM wbw_block WHERE  paragraph IN ($place_holders)  AND book = ? AND channal = ? ";
+    $query = "SELECT count(*) FROM "._TABLE_USER_WBW_BLOCK_." WHERE  paragraph IN ($place_holders)  AND book = ? AND channal = ? ";
     $wbwCount = PDO_FetchOne($query, $queryParam);
     $channelList[$key]["wbw_para"] = $wbwCount;
     $channelList[$key]["count"] = count($_para);

+ 7 - 6
docker/README.md

@@ -20,12 +20,15 @@
   ```
 
 - Enjoy it!
-  
+
+  ![workspace](documents/workspace.png)
+  ![start](documents/start.png)
+
   ```bash
   # for the first time start
-  ./docker/ubuntu/first.sh
+  ./docker/first.sh
   # fot the next time start
-  ./docker/ubuntu/next.sh
+  ./docker/next.sh
   
   # start servers
   > sudo supervisord -c /etc/supervisor/supervisord.conf
@@ -34,11 +37,9 @@
   > sudo rabbitmq-plugins enable rabbitmq_management
 
   # enable redis clusters
-  > ./docker/redis.sh
+  > /etc/redis/redis.sh
   ```
 
-  ![start](documents/start.png)
-
   - RabbitMQ: `http://localhost:15672`, user `guest`, password `guest`
   - Redis cluster ports `6371~6376`
   - Minio server: `http://localhost:9001` user `admin`, password `12345678`

BIN
docker/documents/start.png


BIN
docker/documents/workspace.png


+ 1 - 1
docker/first.sh

@@ -1,2 +1,2 @@
 #!/bin/sh
-podman run --name mint -it --userns=keep-id --hostname=palm --user=$(id -ur):$(id -gr) --network host --events-backend=file -v $PWD:/workspace:z palm
+podman run --name mint -it --userns=keep-id --hostname=palm --user=$(id -ur):$(id -gr) --network host --events-backend=file -v $PWD/..:/workspace:z palm

+ 0 - 18
docker/redis.sh

@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# https://redis.io/topics/cluster-tutorial
-set -e
-
-echo "setup redis clusters"
-redis-cli --cluster create \
-    127.0.0.1:6371 \
-    127.0.0.1:6372 \
-    127.0.0.1:6373 \
-    127.0.0.1:6374 \
-    127.0.0.1:6375 \
-    127.0.0.1:6376 \
-    --cluster-replicas 1
-    
-echo "done."
-
-exit 0

+ 54 - 0
documents/rebuild-aim.md

@@ -0,0 +1,54 @@
+# 重构目标
+
+## 藏经阁-Libray
+### 
+
+|栏目| 问题 | 解决方案 | 技术路线 | 标签 | 紧迫程度 |
+| -- | -- |-- | -- | -- |-- |
+|通用功能| 没有点赞 | 每个栏目增加点赞按钮 | 增加点赞功能 | `增加功能` `增加表` | 低 |
+|[首页](home.md)| 最新的文章,哪怕质量不高也会在首页出现 | 最新列表改为按照本周点赞量排序 | 增加点赞功能 | `增加功能` `增加表` | 低 |
+|[首页](home.md)| 新人无法立即明白网站是干什么的 |  首页改为以介绍网站用途为主 | 更改设计为产品类网站风格 | `设计` | 低 |
+|[三藏](palicanon.md)| 新用户不习惯仅仅标签选经模式| 目录树和标签选择混合使用| 标签改为数据库存储前后端重写| `table` `设计` | 低 |
+|[三藏](palicanon.md)| 没有打开经文的历史记录 | 增加历史记录列表 | | `table` `设计` | 低 |
+|[三藏](palicanon.md)| 没有直观的显示最新完成的经文 | 增加以经文为单位的更新列表 | | `table` `设计` | 低 |
+|[三藏](palicanon.md)| 没有标题搜索 | 将搜索中的标题搜索移过来 | | | 低 |
+|[三藏](palicanon.md)| 全文搜素不支持经文范围 | 用标签过滤结果 搜索 | 给全文搜索传递标签参数 | |低 |
+| [课程](course.md)|没有关注 | 增加关注按钮 | 添加新数据表 | `table` |低 |
+| [字典](dict.md)| 不能增加用户字典 | 增加用户新建单词本功能 | 添加新数据表 | `table` |低 |
+| [术语百科](term.md)| 无法嵌入其他模块 |  | 通过url传参新建,修改,删除 |  | 高 |
+| [术语百科](term.md)| 重复新建相同词 |  | 拼写+标签+用户id+channel 唯一化 |  | 高 |
+| [文章](article.md)| 术语修改用的独立代码,代码维护量大 | 嵌入`术语百科` | iframe |  | 高 |
+| [文章](article.md)| 术语修改后没有立即更新译文显示 |  | 接受修改返回消息更新术语显示 |  | 高 |
+| [文章](article.md)| 按`+`添加新句子后句子没有在页面显示 | 添加新句子后立即在页面显示,然后才编辑存盘 |  |  | 中 |
+| [文章](article.md)| 保存修改建议后,没有立即显示pr按钮 |  | 收到保存成功消息,刷新句子组件 |  | 中 |
+| [文章](article.md)| 采纳修改建议后,没有立即更新显示 |  | 收到采纳成功消息,刷新句子组件 |  | 中 |
+
+### [搜索](search.md)
+### [个人空间](myzone.md)
+
+## 译经楼-Studio
+### [首页](stu_home.md)
+### [三藏分类](stu_pali.md)
+### [我的文档(最近打开)](stu_doc.md)
+### [逐词解析编辑](stu_wbw.md)
+### [协作文档](stu_coop.md)
+### [群组管理](stu_group.md)
+### [版本管理](stu_channel.md)
+### [课程管理](stu_course.md)
+### [单词本](stu_dict.md)
+### [百科词条](stu_term.md)
+### [文章](stu_article.md)
+### [文集](stu_collection.md)
+### 统计数据
+## 用户中心- User Center
+### [注册](sign_up.md)
+### [登陆](sign_in.md)
+### 找回密码
+### 个性化设置
+## 实用工具
+### 佛历
+### 圣典编码转换
+## 后台管理
+### 栏目内容管理
+### 用户管理
+### 数据表管理

+ 8 - 1
documents/zh/api/palicanon.md

@@ -35,4 +35,11 @@
 - `progress`: int 章节译文完成度  0-100
 - `trans_title` string, 根据lang查找对应的标题 如果没有查询到 无该变量
 
-## 
+## 
+
+## 书中的单词汇总表
+CREATE TABLE bookword (
+    book      INTEGER,
+    wordindex INTEGER,
+    count     INTEGER
+);

+ 4 - 29
documents/zh/api/readme.md

@@ -3,6 +3,7 @@
 ## 开发环境
 
 -   golang
+- gin
 -   PostgreSQL
 -   Redis
 -   ES
@@ -15,6 +16,9 @@ sudo apt install yarnpkg golang-go
 
 ## 文档资源
 
+
+`redis` https://pkg.go.dev/github.com/go-redis/redis/v8#section-documentation
+
 ## 依赖
 
 https://github.com/go-redis/redis
@@ -34,35 +38,6 @@ https://github.com/go-redis/redis
 -   [全文搜索](search.md)
 -   [其他工具表](others.md)
 
-```mermaid
-graph LR
-subgraph 后端
-    subgraph channel版本
-    channel[("channel")]
-    end
-    subgraph article文章
-    article[("article")]
-    article_list[("article_list")]
-    collection[("collection")]
-    end
-end
-
-subgraph 前端
-    subgraph 文集
-    collection_home("著作首页")
-    article_reader("文章阅读")
-    collection_edit("著作编辑")
-    article_edit("文章编辑")
-    end
-end
-collection_home --> collection
-collection_home --> article
-article_reader --> article
-article_reader --> collection
-article_reader --> article_list
-collection_edit --> collection
-article_edit  --> article
-```
 
 ## 数据表设计