From d3993a2f089bdb90dbc3609b6cd32cc666e68d70 Mon Sep 17 00:00:00 2001 From: wanghaima Date: Fri, 28 Oct 2022 12:33:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=BF=81=E7=A7=BB=E8=A1=A8=E6=97=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5=E6=B3=A8=E9=87=8A=202.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=B8=B8=E5=AE=A2=E7=8A=B6=E6=80=81=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8A=A5=E7=A9=BA=E6=8C=87=E9=92=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/CommentController.go | 9 ++++-- models/AttachmentModel.go | 20 ++++++------ models/Blog.go | 30 +++++++++--------- models/BookModel.go | 54 ++++++++++++++++---------------- models/DocumentHistory.go | 24 +++++++------- models/DocumentModel.go | 30 +++++++++--------- models/Itemsets.go | 14 ++++----- models/LabelModel.go | 6 ++-- models/Member.go | 26 +++++++-------- models/Relationship.go | 8 ++--- models/Team.go | 8 ++--- models/TeamMember.go | 6 ++-- models/TeamRelationship.go | 6 ++-- static/js/kancloud.js | 2 +- 14 files changed, 123 insertions(+), 120 deletions(-) diff --git a/controllers/CommentController.go b/controllers/CommentController.go index 487c855b..352af04e 100644 --- a/controllers/CommentController.go +++ b/controllers/CommentController.go @@ -22,8 +22,8 @@ func (c *CommentController) Lists() { page := pagination.PageUtil(int(count), pageIndex, conf.PageSize, comments) var data struct { - DocId int `json:"doc_id"` - Page pagination.Page `json:"page"` + DocId int `json:"doc_id"` + Page pagination.Page `json:"page"` } data.DocId = docid data.Page = page @@ -43,6 +43,9 @@ func (c *CommentController) Create() { m := models.NewComment() m.DocumentId = id + if c.Member == nil { + c.JsonResult(1, "请先登录,再评论") + } if len(c.Member.RealName) != 0 { m.Author = c.Member.RealName } else { @@ -56,7 +59,7 @@ func (c *CommentController) Create() { m.Insert() var data struct { - DocId int `json:"doc_id"` + DocId int `json:"doc_id"` } data.DocId = id diff --git a/models/AttachmentModel.go b/models/AttachmentModel.go index eaf88286..8e2d45ce 100644 --- a/models/AttachmentModel.go +++ b/models/AttachmentModel.go @@ -17,18 +17,18 @@ import ( // Attachment struct . type Attachment struct { AttachmentId int `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"` - BookId int `orm:"column(book_id);type(int)" json:"book_id"` - DocumentId int `orm:"column(document_id);type(int);null" json:"doc_id"` - FileName string `orm:"column(file_name);size(255)" json:"file_name"` - FilePath string `orm:"column(file_path);size(2000)" json:"file_path"` - FileSize float64 `orm:"column(file_size);type(float)" json:"file_size"` - HttpPath string `orm:"column(http_path);size(2000)" json:"http_path"` - FileExt string `orm:"column(file_ext);size(50)" json:"file_ext"` - CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` - CreateAt int `orm:"column(create_at);type(int)" json:"create_at"` + BookId int `orm:"column(book_id);type(int);description(所属book id)" json:"book_id"` + DocumentId int `orm:"column(document_id);type(int);null;description(所属文档id)" json:"doc_id"` + FileName string `orm:"column(file_name);size(255);description(文件名称)" json:"file_name"` + FilePath string `orm:"column(file_path);size(2000);description(文件路径)" json:"file_path"` + FileSize float64 `orm:"column(file_size);type(float);description(文件大小 字节)" json:"file_size"` + HttpPath string `orm:"column(http_path);size(2000);description(文件路径)" json:"http_path"` + FileExt string `orm:"column(file_ext);size(50);description(文件后缀)" json:"file_ext"` + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add;description(创建时间)" json:"create_time"` + CreateAt int `orm:"column(create_at);type(int);description(创建人id)" json:"create_at"` } -// TableName 获取对应数据库表名. +// TableName 获取对应上传附件数据库表名. func (m *Attachment) TableName() string { return "attachment" } diff --git a/models/Blog.go b/models/Blog.go index 7e8e5d19..679d5694 100644 --- a/models/Blog.go +++ b/models/Blog.go @@ -19,19 +19,19 @@ import ( type Blog struct { BlogId int `orm:"pk;auto;unique;column(blog_id)" json:"blog_id"` //文章标题 - BlogTitle string `orm:"column(blog_title);size(500)" json:"blog_title"` + BlogTitle string `orm:"column(blog_title);size(500);description(文章标题)" json:"blog_title"` //文章标识 - BlogIdentify string `orm:"column(blog_identify);size(100);unique" json:"blog_identify"` + BlogIdentify string `orm:"column(blog_identify);size(100);unique;description(文章标识)" json:"blog_identify"` //排序序号 - OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"` + OrderIndex int `orm:"column(order_index);type(int);default(0);description(排序序号)" json:"order_index"` //所属用户 - MemberId int `orm:"column(member_id);type(int);default(0);index" json:"member_id"` + MemberId int `orm:"column(member_id);type(int);default(0);index;description(所属用户)" json:"member_id"` //用户头像 MemberAvatar string `orm:"-" json:"member_avatar"` //文章类型:0 普通文章/1 链接文章 - BlogType int `orm:"column(blog_type);type(int);default(0)" json:"blog_type"` + BlogType int `orm:"column(blog_type);type(int);default(0);description(文章类型: 0普通文章/1 链接文章)" json:"blog_type"` //链接到的项目中的文档ID - DocumentId int `orm:"column(document_id);type(int);default(0)" json:"document_id"` + DocumentId int `orm:"column(document_id);type(int);default(0);description(链接到的项目中的文档ID)" json:"document_id"` //文章的标识 DocumentIdentify string `orm:"-" json:"document_identify"` //关联文档的项目标识 @@ -39,25 +39,25 @@ type Blog struct { //关联文档的项目ID BookId int `orm:"-" json:"book_id"` //文章摘要 - BlogExcerpt string `orm:"column(blog_excerpt);size(1500)" json:"blog_excerpt"` + BlogExcerpt string `orm:"column(blog_excerpt);size(1500);description(文章摘要)" json:"blog_excerpt"` //文章内容 - BlogContent string `orm:"column(blog_content);type(text);null" json:"blog_content"` + BlogContent string `orm:"column(blog_content);type(text);null;description(文章内容)" json:"blog_content"` //发布后的文章内容 - BlogRelease string `orm:"column(blog_release);type(text);null" json:"blog_release"` + BlogRelease string `orm:"column(blog_release);type(text);null;description(发布后的文章内容)" json:"blog_release"` //文章当前的状态,枚举enum(’publish’,’draft’,’password’)值,publish为已 发表,draft为草稿,password 为私人内容(不会被公开) 。默认为publish。 - BlogStatus string `orm:"column(blog_status);size(100);default(publish)" json:"blog_status"` + BlogStatus string `orm:"column(blog_status);size(100);default(publish);description(状态:publish为已发表-默认,draft:草稿,password :私人内容-不会被公开)" json:"blog_status"` //文章密码,varchar(100)值。文章编辑才可为文章设定一个密码,凭这个密码才能对文章进行重新强加或修改。 - Password string `orm:"column(password);size(100)" json:"-"` + Password string `orm:"column(password);size(100);description(文章密码)" json:"-"` //最后修改时间 - Modified time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` + Modified time.Time `orm:"column(modify_time);type(datetime);auto_now;description(最后修改时间)" json:"modify_time"` //修改人id - ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"` ModifyRealName string `orm:"-" json:"modify_real_name"` //创建时间 - Created time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` + Created time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` CreateName string `orm:"-" json:"create_name"` //版本号 - Version int64 `orm:"type(bigint);column(version)" json:"version"` + Version int64 `orm:"type(bigint);column(version);description(版本号)" json:"version"` //附件列表 AttachList []*Attachment `orm:"-" json:"attach_list"` } diff --git a/models/BookModel.go b/models/BookModel.go index 8d8aee47..7521fa8b 100644 --- a/models/BookModel.go +++ b/models/BookModel.go @@ -36,53 +36,53 @@ var once = sync.Once{} type Book struct { BookId int `orm:"pk;auto;unique;column(book_id)" json:"book_id"` // BookName 项目名称. - BookName string `orm:"column(book_name);size(500)" json:"book_name"` + BookName string `orm:"column(book_name);size(500);description(名称)" json:"book_name"` //所属项目空间 - ItemId int `orm:"column(item_id);type(int);default(1)" json:"item_id"` + ItemId int `orm:"column(item_id);type(int);default(1);description(所属项目空间id)" json:"item_id"` // Identify 项目唯一标识. - Identify string `orm:"column(identify);size(100);unique" json:"identify"` + Identify string `orm:"column(identify);size(100);unique;description(唯一标识)" json:"identify"` //是否是自动发布 0 否/1 是 - AutoRelease int `orm:"column(auto_release);type(int);default(0)" json:"auto_release"` + AutoRelease int `orm:"column(auto_release);type(int);default(0);description(是否是自动发布 0 否/1 是)" json:"auto_release"` //是否开启下载功能 0 是/1 否 - IsDownload int `orm:"column(is_download);type(int);default(0)" json:"is_download"` - OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"` + IsDownload int `orm:"column(is_download);type(int);default(0);description(是否开启下载功能 0 是/1 否)" json:"is_download"` + OrderIndex int `orm:"column(order_index);type(int);default(0);description(排序)" json:"order_index"` // Description 项目描述. - Description string `orm:"column(description);size(2000)" json:"description"` + Description string `orm:"column(description);size(2000);description(项目描述)" json:"description"` //发行公司 - Publisher string `orm:"column(publisher);size(500)" json:"publisher"` - Label string `orm:"column(label);size(500)" json:"label"` + Publisher string `orm:"column(publisher);size(500);description(发行公司)" json:"publisher"` + Label string `orm:"column(label);size(500);description(所属标签)" json:"label"` // PrivatelyOwned 项目私有: 0 公开/ 1 私有 - PrivatelyOwned int `orm:"column(privately_owned);type(int);default(0)" json:"privately_owned"` + PrivatelyOwned int `orm:"column(privately_owned);type(int);default(0);description(项目私有: 0 公开/ 1 私有)" json:"privately_owned"` // 当项目是私有时的访问Token. - PrivateToken string `orm:"column(private_token);size(500);null" json:"private_token"` + PrivateToken string `orm:"column(private_token);size(500);null;description(当项目是私有时的访问Token)" json:"private_token"` //访问密码. - BookPassword string `orm:"column(book_password);size(500);null" json:"book_password"` + BookPassword string `orm:"column(book_password);size(500);null;description(访问密码)" json:"book_password"` //状态:0 正常/1 已删除 - Status int `orm:"column(status);type(int);default(0)" json:"status"` + Status int `orm:"column(status);type(int);default(0);description(状态:0 正常/1 已删除)" json:"status"` //默认的编辑器. - Editor string `orm:"column(editor);size(50)" json:"editor"` + Editor string `orm:"column(editor);size(50);description(默认的编辑器 markdown/html)" json:"editor"` // DocCount 包含文档数量. - DocCount int `orm:"column(doc_count);type(int)" json:"doc_count"` + DocCount int `orm:"column(doc_count);type(int);description(包含文档数量)" json:"doc_count"` // CommentStatus 评论设置的状态:open 为允许所有人评论,closed 为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论. - CommentStatus string `orm:"column(comment_status);size(20);default(open)" json:"comment_status"` - CommentCount int `orm:"column(comment_count);type(int)" json:"comment_count"` + CommentStatus string `orm:"column(comment_status);size(20);default(open);description(评论设置的状态:open 为允许所有人评论,closed 为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论.)" json:"comment_status"` + CommentCount int `orm:"column(comment_count);type(int);description(评论数量)" json:"comment_count"` //封面地址 - Cover string `orm:"column(cover);size(1000)" json:"cover"` + Cover string `orm:"column(cover);size(1000);description(封面地址)" json:"cover"` //主题风格 - Theme string `orm:"column(theme);size(255);default(default)" json:"theme"` + Theme string `orm:"column(theme);size(255);default(default);description(主题风格)" json:"theme"` // CreateTime 创建时间 . - CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add;description(创建时间)" json:"create_time"` //每个文档保存的历史记录数量,0 为不限制 - HistoryCount int `orm:"column(history_count);type(int);default(0)" json:"history_count"` + HistoryCount int `orm:"column(history_count);type(int);default(0);description(每个文档保存的历史记录数量,0 为不限制)" json:"history_count"` //是否启用分享,0启用/1不启用 - IsEnableShare int `orm:"column(is_enable_share);type(int);default(0)" json:"is_enable_share"` - MemberId int `orm:"column(member_id);size(100)" json:"member_id"` - ModifyTime time.Time `orm:"type(datetime);column(modify_time);null;auto_now" json:"modify_time"` - Version int64 `orm:"type(bigint);column(version)" json:"version"` + IsEnableShare int `orm:"column(is_enable_share);type(int);default(0);description(是否启用分享,0启用/1不启用)" json:"is_enable_share"` + MemberId int `orm:"column(member_id);size(100);description(作者id)" json:"member_id"` + ModifyTime time.Time `orm:"type(datetime);column(modify_time);null;auto_now;description(修改时间)" json:"modify_time"` + Version int64 `orm:"type(bigint);column(version);description(版本)" json:"version"` //是否使用第一篇文章项目为默认首页,0 否/1 是 - IsUseFirstDocument int `orm:"column(is_use_first_document);type(int);default(0)" json:"is_use_first_document"` + IsUseFirstDocument int `orm:"column(is_use_first_document);type(int);default(0);description(是否使用第一篇文章项目为默认首页,0 否/1 是)" json:"is_use_first_document"` //是否开启自动保存:0 否/1 是 - AutoSave int `orm:"column(auto_save);type(tinyint);default(0)" json:"auto_save"` + AutoSave int `orm:"column(auto_save);type(tinyint);default(0);description(是否开启自动保存:0 否/1 是)" json:"auto_save"` } func (book *Book) String() string { diff --git a/models/DocumentHistory.go b/models/DocumentHistory.go index 5f3c7b2b..02aee2a0 100644 --- a/models/DocumentHistory.go +++ b/models/DocumentHistory.go @@ -10,18 +10,18 @@ import ( type DocumentHistory struct { HistoryId int `orm:"column(history_id);pk;auto;unique" json:"history_id"` - Action string `orm:"column(action);size(255)" json:"action"` - ActionName string `orm:"column(action_name);size(255)" json:"action_name"` - DocumentId int `orm:"column(document_id);type(int);index" json:"doc_id"` - DocumentName string `orm:"column(document_name);size(500)" json:"doc_name"` - ParentId int `orm:"column(parent_id);type(int);index;default(0)" json:"parent_id"` - Markdown string `orm:"column(markdown);type(text);null" json:"markdown"` - Content string `orm:"column(content);type(text);null" json:"content"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` - ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` - ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` - Version int64 `orm:"type(bigint);column(version)" json:"version"` - IsOpen int `orm:"column(is_open);type(int);default(0)" json:"is_open"` + Action string `orm:"column(action);size(255);description(modify)" json:"action"` + ActionName string `orm:"column(action_name);size(255);description(修改文档)" json:"action_name"` + DocumentId int `orm:"column(document_id);type(int);index;description(关联文档id)" json:"doc_id"` + DocumentName string `orm:"column(document_name);size(500);description(关联文档id)" json:"doc_name"` + ParentId int `orm:"column(parent_id);type(int);index;default(0);description(父级文档id)" json:"parent_id"` + Markdown string `orm:"column(markdown);type(text);null;description(文档内容)" json:"markdown"` + Content string `orm:"column(content);type(text);null;description(文档内容)" json:"content"` + MemberId int `orm:"column(member_id);type(int);description(作者id)" json:"member_id"` + ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now;description(修改时间)" json:"modify_time"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"` + Version int64 `orm:"type(bigint);column(version);description(版本)" json:"version"` + IsOpen int `orm:"column(is_open);type(int);default(0);description(是否展开子目录 0:阅读时关闭节点 1:阅读时展开节点 2:空目录 单击时会展开下级节点)" json:"is_open"` } type DocumentHistorySimpleResult struct { diff --git a/models/DocumentModel.go b/models/DocumentModel.go index f0ed549c..560b370e 100644 --- a/models/DocumentModel.go +++ b/models/DocumentModel.go @@ -25,26 +25,26 @@ import ( // Document struct. type Document struct { DocumentId int `orm:"pk;auto;unique;column(document_id)" json:"doc_id"` - DocumentName string `orm:"column(document_name);size(500)" json:"doc_name"` + DocumentName string `orm:"column(document_name);size(500);description(文档名称)" json:"doc_name"` // Identify 文档唯一标识 - Identify string `orm:"column(identify);size(100);index;null;default(null)" json:"identify"` - BookId int `orm:"column(book_id);type(int);index" json:"book_id"` - ParentId int `orm:"column(parent_id);type(int);index;default(0)" json:"parent_id"` - OrderSort int `orm:"column(order_sort);default(0);type(int);index" json:"order_sort"` + Identify string `orm:"column(identify);size(100);index;null;default(null);description(唯一标识)" json:"identify"` + BookId int `orm:"column(book_id);type(int);index;description(关联bools表主键)" json:"book_id"` + ParentId int `orm:"column(parent_id);type(int);index;default(0);description(父级文档)" json:"parent_id"` + OrderSort int `orm:"column(order_sort);default(0);type(int);index;description(排序从小到大排序)" json:"order_sort"` // Markdown markdown格式文档. - Markdown string `orm:"column(markdown);type(text);null" json:"markdown"` + Markdown string `orm:"column(markdown);type(text);null;description(markdown内容)" json:"markdown"` // Release 发布后的Html格式内容. - Release string `orm:"column(release);type(text);null" json:"release"` + Release string `orm:"column(release);type(text);null;description(文章内容)" json:"release"` // Content 未发布的 Html 格式内容. - Content string `orm:"column(content);type(text);null" json:"content"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` - ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` - ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` - Version int64 `orm:"column(version);type(bigint);" json:"version"` + Content string `orm:"column(content);type(text);null;description(文章内容)" json:"content"` + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` + MemberId int `orm:"column(member_id);type(int);description(关系用户id)" json:"member_id"` + ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now;description(修改时间)" json:"modify_time"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"` + Version int64 `orm:"column(version);type(bigint);description(版本,关联历史文档里的version)" json:"version"` //是否展开子目录:0 否/1 是 /2 空间节点,单击时展开下一级 - IsOpen int `orm:"column(is_open);type(int);default(0)" json:"is_open"` - ViewCount int `orm:"column(view_count);type(int)" json:"view_count"` + IsOpen int `orm:"column(is_open);type(int);default(0);description(是否展开子目录 0:阅读时关闭节点 1:阅读时展开节点 2:空目录 单击时会展开下级节点)" json:"is_open"` + ViewCount int `orm:"column(view_count);type(int);description(浏览量)" json:"view_count"` AttachList []*Attachment `orm:"-" json:"attach"` //i18n Lang string `orm:"-"` diff --git a/models/Itemsets.go b/models/Itemsets.go index 07b8894f..11e88d6f 100644 --- a/models/Itemsets.go +++ b/models/Itemsets.go @@ -15,13 +15,13 @@ import ( //项目空间 type Itemsets struct { ItemId int `orm:"column(item_id);pk;auto;unique" json:"item_id"` - ItemName string `orm:"column(item_name);size(500)" json:"item_name"` - ItemKey string `orm:"column(item_key);size(100);unique" json:"item_key"` - Description string `orm:"column(description);type(text);null" json:"description"` - MemberId int `orm:"column(member_id);size(100)" json:"member_id"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` - ModifyTime time.Time `orm:"column(modify_time);type(datetime);null;auto_now" json:"modify_time"` - ModifyAt int `orm:"column(modify_at);type(int)" json:"modify_at"` + ItemName string `orm:"column(item_name);size(500);description(项目空间名称)" json:"item_name"` + ItemKey string `orm:"column(item_key);size(100);unique;description(项目空间标识)" json:"item_key"` + Description string `orm:"column(description);type(text);null;description(描述)" json:"description"` + MemberId int `orm:"column(member_id);size(100);description(所属用户)" json:"member_id"` + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` + ModifyTime time.Time `orm:"column(modify_time);type(datetime);null;auto_now;description(修改时间)" json:"modify_time"` + ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"modify_at"` BookNumber int `orm:"-" json:"book_number"` CreateTimeString string `orm:"-" json:"create_time_string"` diff --git a/models/LabelModel.go b/models/LabelModel.go index 49a8ebf8..9645b62a 100644 --- a/models/LabelModel.go +++ b/models/LabelModel.go @@ -9,9 +9,9 @@ import ( ) type Label struct { - LabelId int `orm:"column(label_id);pk;auto;unique;" json:"label_id"` - LabelName string `orm:"column(label_name);size(50);unique" json:"label_name"` - BookNumber int `orm:"column(book_number)" json:"book_number"` + LabelId int `orm:"column(label_id);pk;auto;unique;description(项目标签id)" json:"label_id"` + LabelName string `orm:"column(label_name);size(50);unique;description(项目标签名称)" json:"label_name"` + BookNumber int `orm:"column(book_number);description(包涵项目数量)" json:"book_number"` } // TableName 获取对应数据库表名. diff --git a/models/Member.go b/models/Member.go index 6a3569d3..1d836553 100644 --- a/models/Member.go +++ b/models/Member.go @@ -29,22 +29,22 @@ import ( type Member struct { MemberId int `orm:"pk;auto;unique;column(member_id)" json:"member_id"` - Account string `orm:"size(100);unique;column(account)" json:"account"` - RealName string `orm:"size(255);column(real_name)" json:"real_name"` - Password string `orm:"size(1000);column(password)" json:"-"` + Account string `orm:"size(100);unique;column(account);description(登录名)" json:"account"` + RealName string `orm:"size(255);column(real_name);description(真实姓名)" json:"real_name"` + Password string `orm:"size(1000);column(password);description(密码)" json:"-"` //认证方式: local 本地数据库 /ldap LDAP - AuthMethod string `orm:"column(auth_method);default(local);size(50);" json:"auth_method"` - Description string `orm:"column(description);size(2000)" json:"description"` - Email string `orm:"size(100);column(email);unique" json:"email"` - Phone string `orm:"size(255);column(phone);null;default(null)" json:"phone"` - Avatar string `orm:"size(1000);column(avatar)" json:"avatar"` + AuthMethod string `orm:"column(auth_method);default(local);size(50);description(授权方式 local:本地校验 ldap:LDAP用户校验)" json:"auth_method"` + Description string `orm:"column(description);size(2000);description(描述)" json:"description"` + Email string `orm:"size(100);column(email);unique;description(邮箱)" json:"email"` + Phone string `orm:"size(255);column(phone);null;default(null);description(手机)" json:"phone"` + Avatar string `orm:"size(1000);column(avatar);description(头像)" json:"avatar"` //用户角色:0 超级管理员 /1 管理员/ 2 普通用户 . - Role conf.SystemRole `orm:"column(role);type(int);default(1);index" json:"role"` + Role conf.SystemRole `orm:"column(role);type(int);default(1);index;description(用户角色: 0:超级管理员 1:管理员 2:普通用户)" json:"role"` RoleName string `orm:"-" json:"role_name"` - Status int `orm:"column(status);type(int);default(0)" json:"status"` //用户状态:0 正常/1 禁用 - CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"` - CreateAt int `orm:"type(int);column(create_at)" json:"create_at"` - LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"` + Status int `orm:"column(status);type(int);default(0);description(状态 0:启用 1:禁用)" json:"status"` //用户状态:0 正常/1 禁用 + CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add;description(创建时间)" json:"create_time"` + CreateAt int `orm:"type(int);column(create_at);description(创建人id)" json:"create_at"` + LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null;description(最后登录时间)" json:"last_login_time"` //i18n Lang string `orm:"-"` } diff --git a/models/Relationship.go b/models/Relationship.go index 7f9fe801..8de89c33 100644 --- a/models/Relationship.go +++ b/models/Relationship.go @@ -10,13 +10,13 @@ import ( type Relationship struct { RelationshipId int `orm:"pk;auto;unique;column(relationship_id)" json:"relationship_id"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` - BookId int `orm:"column(book_id);type(int)" json:"book_id"` + MemberId int `orm:"column(member_id);type(int);description(作者id)" json:"member_id"` + BookId int `orm:"column(book_id);type(int);description(所属项目id)" json:"book_id"` // RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者 - RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"` + RoleId conf.BookRole `orm:"column(role_id);type(int);description(角色-配置文件里写死:0 创始人-不能被移除 / 1 管理员/2 编辑者/3 观察者)" json:"role_id"` } -// TableName 获取对应数据库表名. +// TableName 获取对应数据库表名. 用户和项目的关联表 func (m *Relationship) TableName() string { return "relationship" } diff --git a/models/Team.go b/models/Team.go index c7226d76..cf974602 100644 --- a/models/Team.go +++ b/models/Team.go @@ -12,10 +12,10 @@ import ( //团队. type Team struct { TeamId int `orm:"column(team_id);pk;auto;unique;" json:"team_id"` - TeamName string `orm:"column(team_name);size(255)" json:"team_name"` - MemberId int `orm:"column(member_id);type(int);" json:"member_id"` - IsDelete bool `orm:"column(is_delete);default(0)" json:"is_delete"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` + TeamName string `orm:"column(team_name);size(255);description(团队名称)" json:"team_name"` + MemberId int `orm:"column(member_id);type(int);description(创建人id)" json:"member_id"` + IsDelete bool `orm:"column(is_delete);default(0);description(是否删除 0:否 1:是)" json:"is_delete"` + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` MemberCount int `orm:"-" json:"member_count"` BookCount int `orm:"-" json:"book_count"` MemberName string `orm:"-" json:"member_name"` diff --git a/models/TeamMember.go b/models/TeamMember.go index 4243638c..acfe4a86 100644 --- a/models/TeamMember.go +++ b/models/TeamMember.go @@ -11,10 +11,10 @@ import ( type TeamMember struct { TeamMemberId int `orm:"column(team_member_id);pk;auto;unique;" json:"team_member_id"` - TeamId int `orm:"column(team_id);type(int)" json:"team_id"` - MemberId int `orm:"column(member_id);type(int)" json:"member_id"` + TeamId int `orm:"column(team_id);type(int);description(团队id)" json:"team_id"` + MemberId int `orm:"column(member_id);type(int);description(成员id)" json:"member_id"` // RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者 - RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"` + RoleId conf.BookRole `orm:"column(role_id);type(int);description(RoleId 角色:0 创始人-创始人不能被移除 / 1 管理员/2 编辑者/3 观察者)" json:"role_id"` RoleName string `orm:"-" json:"role_name"` Account string `orm:"-" json:"account"` RealName string `orm:"-" json:"real_name"` diff --git a/models/TeamRelationship.go b/models/TeamRelationship.go index e6e82a7f..90fd5788 100644 --- a/models/TeamRelationship.go +++ b/models/TeamRelationship.go @@ -11,9 +11,9 @@ import ( type TeamRelationship struct { TeamRelationshipId int `orm:"column(team_relationship_id);pk;auto;unique;" json:"team_relationship_id"` - BookId int `orm:"column(book_id)" json:"book_id"` - TeamId int `orm:"column(team_id)" json:"team_id"` - CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` + BookId int `orm:"column(book_id);description(项目id)" json:"book_id"` + TeamId int `orm:"column(team_id);description(团队id)" json:"team_id"` + CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"` TeamName string `orm:"-" json:"team_name"` MemberCount int `orm:"-" json:"member_count"` BookMemberId int `orm:"-" json:"book_member_id"` diff --git a/static/js/kancloud.js b/static/js/kancloud.js index 75a60799..70754e0e 100644 --- a/static/js/kancloud.js +++ b/static/js/kancloud.js @@ -386,7 +386,7 @@ $(function () { if(res.errcode === 0){ layer.msg("保存成功"); }else{ - layer.msg("保存失败"); + layer.msg(res.message); } $("#btnSubmitComment").button("reset"); $("#commentContent").val("");