Browse Source

Merge pull request #993 from visuddhinanda/laravel

#992 🐛 句子链接点击问题
visuddhinanda 3 years ago
parent
commit
5895cb0d55

+ 4 - 3
documents/proto/article.proto

@@ -1,5 +1,5 @@
-syntax = "proto3"
-import "public.proto"
+syntax = "proto3";
+import "public.proto";
 /*
  * Article 服务
  * 
@@ -16,6 +16,7 @@ service Article{
 	rpc RemoveArticleFromAnthologye (ArticleRequest) returns (ArticleReply){}
 
 	rpc GetAnthologyListForStudio (ArticleListRequest) returns (AnthologyeListReply){}
+	rpc GetAnthologyListForArticle (ArticleListRequest) returns (AnthologyeListReply){}
 	rpc GetAnthologye (AnthologyeRequest) returns (AnthologyeReply){}
 	rpc SetAnthology (AnthologyeRequest) returns (AnthologyeReply){}
 	rpc AddAnthology (AnthologyeRequest) returns (AnthologyeReply){}
@@ -26,7 +27,7 @@ message ArticleListRequest{
 	string Id = 1;
 	string Search = 3;
 	EnumAllowingSearch SearchCol = 4;
-	int32  PageNo = 5;
+	int32  CurrentPage = 5;
 	int32  PageSize = 6;
 	EnumAllowingOrderby OrderBy = 7;
 	bool   Desc = 8;

+ 8 - 4
documents/proto/channel.proto

@@ -1,10 +1,14 @@
-syntax = "proto3"
-import "public.proto"
+syntax = "proto3";
+import "public.proto";
+
+package channel;
 /*
  * channel/版本 服务
+ * Studio 建立的时候会建立一个默认channel 
+ * 默认channel 一定为公开channel
  */
 service Channel{
-	rpc GetChannelListForChannel (ChannelListRequest) returns (ChannelListReply){}
+	rpc GetChannelListForStudio (ChannelListRequest) returns (ChannelListReply){}
 	rpc GetChannel (ChannelRequest) returns (ChannelReply){}
 	rpc SetChannel (ChannelRequest) returns (ChannelReply){}
 	rpc AddChannel (ChannelRequest) returns (ChannelReply){}
@@ -15,7 +19,7 @@ message ChannelListRequest{
 	string Id = 1;
 	string Search = 3;
 	EnumAllowingSearch SearchCol = 4;
-	int32  PageNo = 5;
+	int32  CurrentPage = 5;
 	int32  PageSize = 6;
 	EnumAllowingOrderby OrderBy = 7;
 	bool   Desc = 8;

+ 93 - 0
documents/proto/chapter.proto

@@ -0,0 +1,93 @@
+syntax = "proto3";
+import "public.proto";
+
+package chapter;
+/*
+ * channel/版本 服务
+ */
+service Chapter{
+	rpc GetStudioList (ChapterListRequest) returns (ResListReply){}//查询符合要求的 studio 列表
+	rpc GetChannelList (ChapterListRequest) returns (ResListReply){}//查询符合要求的 channel 列表
+	rpc GetTagList (ChapterListRequest) returns (ResListReply){}//查询符合要求的 tag 列表
+	rpc GetLangList (ChapterListRequest) returns (ResListReply){}//查询符合要求的 language 列表
+	rpc GetChapterList (ChapterListRequest) returns (ChapterListReply){}//查询符合要求的 chapter 列表
+	rpc GetChapterTitle (ChapterRequest) returns (ChapterReply){} //获取章节标题
+	rpc GetChapter (ChapterRequest) returns (ChapterReply){}
+	rpc UpgradeChapter (ChapterRequest) returns (ChapterReply){} //这个不确定要不要,可能可以放到mq
+}
+
+message ChapterListRequest{
+	string Id = 1;
+	string Search = 3;
+	EnumAllowingSearch SearchCol = 4;
+	int32  CurrentPage = 5;
+	int32  PageSize = 6;
+	EnumAllowingOrderby OrderBy = 7;
+	bool   Desc = 8;
+}
+
+enum EnumAllowingSearch{
+	EAS_TITLE = 0;
+}
+enum EnumAllowingOrderby{
+	EAO_CREATE_AT =  0;
+	EAO_TITLE =  1;
+}
+
+enum EnumChannelType{
+	ECT_TRANSLATION = 0;
+	ECT_ORIGINAL = 1;
+	ECT_NISSAYA = 2;
+	ECT_COMMENTRAY = 3;
+	ECT_GENERAL = 4;
+}
+
+message ChapterRequest{
+	string Id        = 1;
+	int32  Book = 2;
+	int32  Paragraph = 3;
+	string Channel = 4;
+	EnumChannelType ChannelType = 4;
+	string PaliTitle = 5;
+	string Title     = 2;
+	string Summary   = 3;	
+	string StudioId     = 5;
+
+	string Lang = 51;
+	repeated User  Editors = 52;
+	EnumPublicity Publicity = 53;
+
+	string CreatedAt = 101; 
+	string UpdatedAt = 102; 
+}
+
+
+message ChapterReply{
+	bool ok = 1;
+	string message = 2;
+	ChapterRequest data = 3;
+}
+
+message ResWithCount{
+	string Id = 1;
+	string Name = 2;
+	int32  Count = 3;
+}
+message ResListReply{
+	bool ok = 1;
+	string message = 2;
+	message data{
+		repeated ResWithCount rows = 1;
+	}
+}
+
+message ChapterListReply{
+	bool ok = 1;
+	string message = 2;
+	message data{
+		repeated ChapterRequest rows = 1;
+		int32    Count = 2;
+		int32    PageNo = 3;
+		int32    PageSize = 4;
+	}
+}

+ 13 - 11
documents/proto/course.proto

@@ -1,7 +1,9 @@
-syntax = "proto3"
-import "public.proto"
+syntax = "proto3";
+import "public.proto";
+
+package course;
 /*
- * 课程服务
+ * 课程服务 
  */
 service Course{
 	rpc GetCourseListForStudio (CourseListRequest) returns (CourseListReply){}
@@ -16,8 +18,8 @@ message CourseListRequest{
 	string Id = 1;
 	string Search = 3;
 	EnumAllowingSearch SearchCol = 4;
-	int32  PageNo = 5;
-	int32  PageSize = 6;
+	int32  CurrentPage = 5; //current page number
+	int32  PageSize = 6; //The number of items to be shown per page.
 	EnumAllowingOrderby OrderBy = 7;
 	bool   Desc = 8;
 }
@@ -37,11 +39,11 @@ message CourseRequest{
 	string Summary   = 4;	
 	string Cover     = 5;	
 	string Content   = 6;	
-	EnumContentType ContentType = 6;
+	EnumContentType ContentType = 7;
 	string Html = 8;
-	string StartAt     = 7;
-	string EndAt       = 8;
-	repeated Tag Tags = 6;
+	string StartAt     = 9;
+	string EndAt       = 10;
+	repeated Tag Tags = 11;
 
 	string Lang = 51;
 	string EditorId = 52;
@@ -55,8 +57,8 @@ message CourseList{
 	string Title = 2;
 	string Subtitle = 3;
 	string Summary = 4;						
-	date   Start = 5;
-	date   End   = 6;
+	string   Start = 5;
+	string   End   = 6;
 	string Cover = 7;
 	int32  Children = 8;
 }

+ 148 - 0
documents/proto/dictionary.proto

@@ -0,0 +1,148 @@
+syntax = "proto3";
+import "public.proto";
+
+package dictionary;
+
+/*
+ * dictionary 服务
+ * 逐词译数据推送到社区字典,当这个channel是公开channel的时候。以channel的名义公开。不是公开channel ,推送到该studio默认channel
+ * 每个channel对应一个且仅一个用户字典
+ * 协作用户使用公共channel干活。公开的社区词典数据进到这个channel ,以及自己的默认channel
+ */
+service Dictionary{
+	//词典管理
+	rpc GetDictListForStudio (DictListRequest) returns (DictListReply){} //列出 studio 里面的全部字典
+	rpc GetDictListForChannel (DictListRequest) returns (DictListReply){} //列出 channel 里面的全部字典
+	rpc GetDict (DictRequest) returns (DictReply){}
+	rpc SetDict (DictRequest) returns (DictReply){}
+	rpc AddDict (DictRequest) returns (DictReply){}
+	rpc DelDict (DictRequest) returns (DictReply){}
+
+	//单词管理
+	rpc GetWordListForStudio (WordListRequest) returns (WordListReply){}
+	rpc GetWordListForDict (WordListRequest) returns (WordListReply){}
+	rpc GetWordListForChannel (WordListRequest) returns (WordListReply){} //这个 channel 里面的全部术语
+	rpc GetWord (WordRequest) returns (DictReply){}
+	rpc SetWord (WordRequest) returns (DictReply){}
+	rpc AddWord (WordRequest) returns (DictReply){}
+	rpc DelWord (WordRequest) returns (DictReply){}
+}
+
+message DictListRequest{
+	string Id = 1;
+	string Search = 3;
+	EnumAllowingSearch SearchCol = 4;
+	int32  CurrentPage = 5;
+	int32  PageSize = 6;
+	EnumAllowingOrderby OrderBy = 7;
+	bool   Desc = 8;
+}
+
+enum EnumAllowingSearch{
+	EAS_WORD = 0;
+	EAS_NOTE = 1;
+}
+enum EnumAllowingOrderby{
+	EAO_CREATED_AT = 0;
+	EAO_UPDATED_AT = 0;
+	EAO_WORD       = 1;
+}
+
+message DictRequest{
+	string Id          = 1;
+	string Word        = 2;
+	string Tag         = 3;	
+	string Meaning     = 4;
+	string Meaning2    = 5;
+	string Note        = 6;
+	string Channel     = 7;
+	string Studio      = 8;
+
+	string Lang             = 51;
+	string EditorId         = 52;
+	EnumPublicity Publicity = 53;
+
+	string CreatedAt = 101; 
+	string UpdatedAt = 102; 
+}
+
+
+message DictReply{
+	bool ok          = 1;
+	string message   = 2;
+	DictRequest data = 3;
+}
+
+message DictListReply{
+	bool ok = 1;
+	string message = 2;
+	message data{
+		repeated DictRequest rows = 1;
+		int32    Count = 2;
+		int32    PageNo = 3;
+		int32    PageSize = 4;
+	}
+}
+
+
+
+message WordListRequest{
+	string Id = 1;
+	string Search = 3;
+	EnumAllowingSearch SearchCol = 4;
+	int32  CurrentPage = 5;
+	int32  PageSize = 6;
+	EnumAllowingOrderby OrderBy = 7;
+	bool   Desc = 8;
+}
+
+enum EnumWordAllowingSearch{
+	EWAS_WORD = 0;
+	EWAS_NOTE = 1;
+}
+enum EnumWordAllowingOrderby{
+	EWAO_UPDATED_AT = 0;	
+	EWAO_CREATED_AT = 1;
+	EWAO_WORD       = 2;
+}
+
+message WordRequest{
+	string Id            = 1;
+	string Word          = 2;
+	string Type          = 3;	
+	string Grammar       = 4;
+	string Parent        = 5;
+	string Meaning       = 6;
+	string Note          = 7;
+	string Factors       = 8;
+	string FactorMeaning = 9;
+	string Confidence    = 10;
+	string Meta          = 11;
+	string Channel       = 12;
+	string Studio        = 13;
+
+	string Lang             = 51;
+	string Editor           = 52;
+	EnumPublicity Publicity = 53;
+
+	string CreatedAt = 101; 
+	string UpdatedAt = 102; 
+}
+
+
+message WordReply{
+	bool ok          = 1;
+	string message   = 2;
+	WordRequest data = 3;
+}
+
+message WordListReply{
+	bool ok = 1;
+	string message = 2;
+	message data{
+		repeated WordRequest rows = 1;
+		int32    Count = 2;
+		int32    PageNo = 3;
+		int32    PageSize = 4;
+	}
+}

+ 81 - 0
documents/proto/group.proto

@@ -0,0 +1,81 @@
+syntax = "proto3";
+import "public.proto";
+
+package group;
+/*
+ * Group/群组 服务
+ */
+service Group{
+	rpc GetGroupListForStudio (GroupListRequest) returns (GroupListReply){}
+	rpc GetGroup (GroupRequest) returns (GroupReply){}
+	rpc SetGroup (GroupRequest) returns (GroupReply){}
+	rpc AddGroup (GroupRequest) returns (GroupReply){}
+	rpc DelGroup (GroupRequest) returns (GroupReply){}
+
+	rpc AddMember (User) returns (MemberReply){}
+	rpc RemoveMember (User) returns (MemberReply){}
+	rpc GetMemberListForGroup (GroupListRequest) returns (GroupMemberListReply){}
+
+}
+
+message GroupListRequest{
+	string Id = 1;
+	string Search = 3;
+	EnumAllowingSearch SearchCol = 4;
+	int32  CurrentPage = 5; //current page number
+	int32  PageSize = 6; //The number of items to be shown per page.
+	EnumAllowingOrderby OrderBy = 7;
+	bool   Desc = 8;
+}
+
+enum EnumAllowingSearch{
+	EAS_NAME = 0;
+}
+enum EnumAllowingOrderby{
+	EAO_CREATE_AT =  0;
+	EAO_NAME =  1;
+}
+
+
+message GroupRequest{
+	string Id        = 1;
+	string Name     = 2;
+	string Summary   = 3;	
+	string StudioId     = 5;
+
+	string EditorId = 52;
+	EnumPublicity Publicity = 53;
+
+	string CreatedAt = 101; 
+	string UpdatedAt = 102; 
+}
+
+
+message GroupReply{
+	bool ok = 1;
+	string message = 2;
+	GroupRequest data = 3;
+}
+
+message GroupListReply{
+	bool ok = 1;
+	string message = 2;
+	message data{
+		repeated GroupRequest rows = 1;
+		int32    Count = 2;
+		int32    PageNo = 3;
+		int32    PageSize = 4;
+	}
+}
+message MemberReply{
+	bool ok = 1;
+	string message = 2;
+	User data = 3;
+}
+message GroupMemberListReply{
+	bool ok = 1;
+	string message = 2;
+	message data{
+		repeated User rows = 1;
+	}
+}

+ 15 - 5
documents/proto/public.proto

@@ -1,4 +1,4 @@
-syntax = "proto3"
+syntax = "proto3";
 
 enum EnumContentType{
 	ECT_MARKDOWN = 0;
@@ -13,11 +13,21 @@ enum EnumPublicity{
 }
 
 message Tag{
-	string Id = 0;
-	string Name = 1;
+	string Id = 1;
+	string Name = 2;
 }
 
 message Channel{
-	string Id = 0;
-	string Name = 1;
+	string Id = 1;
+	string Name = 2;
+}
+
+message Studio{
+	string Id = 1;
+	string Name = 2;
+}
+message User{
+	string Id = 1;
+	string Name = 2;
+	string NickName = 3;
 }

+ 6 - 5
documents/proto/studio.proto

@@ -1,5 +1,6 @@
-syntax = "proto3"
-import "public.proto"
+syntax = "proto3";
+import "public.proto";
+
 /*
  * studio 服务
  * 每个用户注册时有一个默认studio。与用户名相同。
@@ -19,7 +20,7 @@ message StudioListRequest{
 	string Id = 1;
 	string Search = 3;
 	EnumAllowingSearch SearchCol = 4;
-	int32  PageNo = 5;
+	int32  CurrentPage = 5;
 	int32  PageSize = 6;
 	EnumAllowingOrderby OrderBy = 7;
 	bool   Desc = 8;
@@ -32,12 +33,12 @@ enum EnumAllowingOrderby{
 	EAO_CREATE_AT =  0;
 	EAO_NAME =  1;
 }
-
+ 
 message StudioRequest{
 	string Id        = 1;
 	string Name     = 2;
 	string Summary   = 3;	
-	string Cover     = 4;	
+	string Cover     = 4;
 	string Owner     = 5;
 	string CreatedAt = 6; 
 	string UpdatedAt = 7; 

+ 76 - 0
documents/proto/term.proto

@@ -0,0 +1,76 @@
+syntax = "proto3";
+import "public.proto";
+
+package term;
+
+/*
+ * Term 服务
+ * 
+ *  
+ * 
+ */
+service Term{
+	rpc GetTermListForStudio (TermListRequest) returns (TermListReply){}
+	rpc GetTermListForWord (TermListRequest) returns (TermListReply){}
+	rpc GetTermListForChannel (TermListRequest) returns (TermListReply){} //这个 channel 里面的全部术语
+	rpc GetTerm (TermRequest) returns (TermReply){}
+	rpc SetTerm (TermRequest) returns (TermReply){}
+	rpc AddTerm (TermRequest) returns (TermReply){}
+	rpc DelTerm (TermRequest) returns (TermReply){}
+}
+
+message TermListRequest{
+	string Id = 1;
+	string Search = 3;
+	EnumAllowingSearch SearchCol = 4;
+	int32  CurrentPage = 5;
+	int32  PageSize = 6;
+	EnumAllowingOrderby OrderBy = 7;
+	bool   Desc = 8;
+}
+
+enum EnumAllowingSearch{
+	EAS_WORD = 0;
+	EAS_NOTE = 1;
+}
+enum EnumAllowingOrderby{
+	EAO_UPDATED_AT = 0;
+	EAO_CREATED_AT = 1;
+	EAO_WORD       = 2;
+}
+
+message TermRequest{
+	string Id          = 1;
+	string Word        = 2;
+	string Tag         = 3;	
+	string Meaning     = 4;
+	string Meaning2    = 5;
+	string Note        = 6;
+	string Channel     = 7;
+	string Studio      = 8;
+
+	string Lang             = 51;
+	User   Editor           = 52;
+	EnumPublicity Publicity = 53;
+
+	string CreatedAt = 101; 
+	string UpdatedAt = 102; 
+}
+
+
+message TermReply{
+	bool ok          = 1;
+	string message   = 2;
+	TermRequest data = 3;
+}
+
+message TermListReply{
+	bool ok = 1;
+	string message = 2;
+	message data{
+		repeated TermRequest rows = 1;
+		int32    Count = 2;
+		int32    PageNo = 3;
+		int32    PageSize = 4;
+	}
+}

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

@@ -644,7 +644,7 @@ function onChannelChange() {
 }
 //点击引用 需要响应的事件
 function note_ref_init(target='_blank') {
-	$("chapter").click(function () {
+	$("chapter").off("click").on("click",function () {
 		let bookid = $(this).attr("book");
 		let para = $(this).attr("para");
 		let urlChannel='';
@@ -654,7 +654,7 @@ function note_ref_init(target='_blank') {
 		window.open("../article/?view=chapter&book=" + bookid + "&par=" + para + urlChannel, target);
 	});
 
-	$("para").click(function () {
+	$("para").off("click").on("click",function () {
 		let bookid = $(this).attr("book");
 		let para = $(this).attr("para");
 		let urlChannel='';