1.迁移表时添加字段注释

2.修复游客状态评论接口报空指针的问题
pull/822/head
wanghaima 2022-10-28 12:33:36 +08:00
parent 4c6ef05fbd
commit d3993a2f08
14 changed files with 123 additions and 120 deletions

View File

@ -22,8 +22,8 @@ func (c *CommentController) Lists() {
page := pagination.PageUtil(int(count), pageIndex, conf.PageSize, comments) page := pagination.PageUtil(int(count), pageIndex, conf.PageSize, comments)
var data struct { var data struct {
DocId int `json:"doc_id"` DocId int `json:"doc_id"`
Page pagination.Page `json:"page"` Page pagination.Page `json:"page"`
} }
data.DocId = docid data.DocId = docid
data.Page = page data.Page = page
@ -43,6 +43,9 @@ func (c *CommentController) Create() {
m := models.NewComment() m := models.NewComment()
m.DocumentId = id m.DocumentId = id
if c.Member == nil {
c.JsonResult(1, "请先登录,再评论")
}
if len(c.Member.RealName) != 0 { if len(c.Member.RealName) != 0 {
m.Author = c.Member.RealName m.Author = c.Member.RealName
} else { } else {
@ -56,7 +59,7 @@ func (c *CommentController) Create() {
m.Insert() m.Insert()
var data struct { var data struct {
DocId int `json:"doc_id"` DocId int `json:"doc_id"`
} }
data.DocId = id data.DocId = id

View File

@ -17,18 +17,18 @@ import (
// Attachment struct . // Attachment struct .
type Attachment struct { type Attachment struct {
AttachmentId int `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"` AttachmentId int `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"`
BookId int `orm:"column(book_id);type(int)" json:"book_id"` BookId int `orm:"column(book_id);type(int);description(所属book id)" json:"book_id"`
DocumentId int `orm:"column(document_id);type(int);null" json:"doc_id"` DocumentId int `orm:"column(document_id);type(int);null;description(所属文档id)" json:"doc_id"`
FileName string `orm:"column(file_name);size(255)" json:"file_name"` FileName string `orm:"column(file_name);size(255);description(文件名称)" json:"file_name"`
FilePath string `orm:"column(file_path);size(2000)" json:"file_path"` FilePath string `orm:"column(file_path);size(2000);description(文件路径)" json:"file_path"`
FileSize float64 `orm:"column(file_size);type(float)" json:"file_size"` FileSize float64 `orm:"column(file_size);type(float);description(文件大小 字节)" json:"file_size"`
HttpPath string `orm:"column(http_path);size(2000)" json:"http_path"` HttpPath string `orm:"column(http_path);size(2000);description(文件路径)" json:"http_path"`
FileExt string `orm:"column(file_ext);size(50)" json:"file_ext"` FileExt string `orm:"column(file_ext);size(50);description(文件后缀)" json:"file_ext"`
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"`
CreateAt int `orm:"column(create_at);type(int)" json:"create_at"` CreateAt int `orm:"column(create_at);type(int);description(创建人id)" json:"create_at"`
} }
// TableName 获取对应数据库表名. // TableName 获取对应上传附件数据库表名.
func (m *Attachment) TableName() string { func (m *Attachment) TableName() string {
return "attachment" return "attachment"
} }

View File

@ -19,19 +19,19 @@ import (
type Blog struct { type Blog struct {
BlogId int `orm:"pk;auto;unique;column(blog_id)" json:"blog_id"` 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"` MemberAvatar string `orm:"-" json:"member_avatar"`
//文章类型:0 普通文章/1 链接文章 //文章类型: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 //链接到的项目中的文档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"` DocumentIdentify string `orm:"-" json:"document_identify"`
//关联文档的项目标识 //关联文档的项目标识
@ -39,25 +39,25 @@ type Blog struct {
//关联文档的项目ID //关联文档的项目ID
BookId int `orm:"-" json:"book_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。 //文章当前的状态枚举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)值。文章编辑才可为文章设定一个密码,凭这个密码才能对文章进行重新强加或修改。 //文章密码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 //修改人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"` 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"` 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"` AttachList []*Attachment `orm:"-" json:"attach_list"`
} }

View File

@ -36,53 +36,53 @@ var once = sync.Once{}
type Book struct { type Book struct {
BookId int `orm:"pk;auto;unique;column(book_id)" json:"book_id"` BookId int `orm:"pk;auto;unique;column(book_id)" json:"book_id"`
// BookName 项目名称. // 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 项目唯一标识.
Identify string `orm:"column(identify);size(100);unique" json:"identify"` Identify string `orm:"column(identify);size(100);unique;description(唯一标识)" json:"identify"`
//是否是自动发布 0 否/1 是 //是否是自动发布 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 否 //是否开启下载功能 0 是/1 否
IsDownload int `orm:"column(is_download);type(int);default(0)" json:"is_download"` 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)" json:"order_index"` OrderIndex int `orm:"column(order_index);type(int);default(0);description(排序)" json:"order_index"`
// Description 项目描述. // 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"` Publisher string `orm:"column(publisher);size(500);description(发行公司)" json:"publisher"`
Label string `orm:"column(label);size(500)" json:"label"` Label string `orm:"column(label);size(500);description(所属标签)" json:"label"`
// PrivatelyOwned 项目私有: 0 公开/ 1 私有 // 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. // 当项目是私有时的访问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 已删除 //状态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 包含文档数量.
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 评论设置的状态:open 为允许所有人评论closed 为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论.
CommentStatus string `orm:"column(comment_status);size(20);default(open)" json:"comment_status"` 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)" json:"comment_count"` 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 创建时间 .
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 为不限制 //每个文档保存的历史记录数量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不启用 //是否启用分享0启用/1不启用
IsEnableShare int `orm:"column(is_enable_share);type(int);default(0)" json:"is_enable_share"` 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)" json:"member_id"` 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" json:"modify_time"` ModifyTime time.Time `orm:"type(datetime);column(modify_time);null;auto_now;description(修改时间)" json:"modify_time"`
Version int64 `orm:"type(bigint);column(version)" json:"version"` Version int64 `orm:"type(bigint);column(version);description(版本)" json:"version"`
//是否使用第一篇文章项目为默认首页,0 否/1 是 //是否使用第一篇文章项目为默认首页,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 是 //是否开启自动保存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 { func (book *Book) String() string {

View File

@ -10,18 +10,18 @@ import (
type DocumentHistory struct { type DocumentHistory struct {
HistoryId int `orm:"column(history_id);pk;auto;unique" json:"history_id"` HistoryId int `orm:"column(history_id);pk;auto;unique" json:"history_id"`
Action string `orm:"column(action);size(255)" json:"action"` Action string `orm:"column(action);size(255);description(modify)" json:"action"`
ActionName string `orm:"column(action_name);size(255)" json:"action_name"` ActionName string `orm:"column(action_name);size(255);description(修改文档)" json:"action_name"`
DocumentId int `orm:"column(document_id);type(int);index" json:"doc_id"` DocumentId int `orm:"column(document_id);type(int);index;description(关联文档id)" json:"doc_id"`
DocumentName string `orm:"column(document_name);size(500)" json:"doc_name"` DocumentName string `orm:"column(document_name);size(500);description(关联文档id)" json:"doc_name"`
ParentId int `orm:"column(parent_id);type(int);index;default(0)" json:"parent_id"` ParentId int `orm:"column(parent_id);type(int);index;default(0);description(父级文档id)" json:"parent_id"`
Markdown string `orm:"column(markdown);type(text);null" json:"markdown"` Markdown string `orm:"column(markdown);type(text);null;description(文档内容)" json:"markdown"`
Content string `orm:"column(content);type(text);null" json:"content"` Content string `orm:"column(content);type(text);null;description(文档内容)" json:"content"`
MemberId int `orm:"column(member_id);type(int)" json:"member_id"` MemberId int `orm:"column(member_id);type(int);description(作者id)" json:"member_id"`
ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now;description(修改时间)" json:"modify_time"`
ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"`
Version int64 `orm:"type(bigint);column(version)" json:"version"` Version int64 `orm:"type(bigint);column(version);description(版本)" json:"version"`
IsOpen int `orm:"column(is_open);type(int);default(0)" json:"is_open"` IsOpen int `orm:"column(is_open);type(int);default(0);description(是否展开子目录 0阅读时关闭节点 1阅读时展开节点 2空目录 单击时会展开下级节点)" json:"is_open"`
} }
type DocumentHistorySimpleResult struct { type DocumentHistorySimpleResult struct {

View File

@ -25,26 +25,26 @@ import (
// Document struct. // Document struct.
type Document struct { type Document struct {
DocumentId int `orm:"pk;auto;unique;column(document_id)" json:"doc_id"` 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 文档唯一标识
Identify string `orm:"column(identify);size(100);index;null;default(null)" json:"identify"` Identify string `orm:"column(identify);size(100);index;null;default(null);description(唯一标识)" json:"identify"`
BookId int `orm:"column(book_id);type(int);index" json:"book_id"` 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)" json:"parent_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" json:"order_sort"` OrderSort int `orm:"column(order_sort);default(0);type(int);index;description(排序从小到大排序)" json:"order_sort"`
// Markdown markdown格式文档. // 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 发布后的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 未发布的 Html 格式内容.
Content string `orm:"column(content);type(text);null" json:"content"` Content string `orm:"column(content);type(text);null;description(文章内容)" json:"content"`
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"`
MemberId int `orm:"column(member_id);type(int)" json:"member_id"` MemberId int `orm:"column(member_id);type(int);description(关系用户id)" json:"member_id"`
ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"` ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now;description(修改时间)" json:"modify_time"`
ModifyAt int `orm:"column(modify_at);type(int)" json:"-"` ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"-"`
Version int64 `orm:"column(version);type(bigint);" json:"version"` Version int64 `orm:"column(version);type(bigint);description(版本关联历史文档里的version)" json:"version"`
//是否展开子目录0 否/1 是 /2 空间节点,单击时展开下一级 //是否展开子目录0 否/1 是 /2 空间节点,单击时展开下一级
IsOpen int `orm:"column(is_open);type(int);default(0)" json:"is_open"` 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)" json:"view_count"` ViewCount int `orm:"column(view_count);type(int);description(浏览量)" json:"view_count"`
AttachList []*Attachment `orm:"-" json:"attach"` AttachList []*Attachment `orm:"-" json:"attach"`
//i18n //i18n
Lang string `orm:"-"` Lang string `orm:"-"`

View File

@ -15,13 +15,13 @@ import (
//项目空间 //项目空间
type Itemsets struct { type Itemsets struct {
ItemId int `orm:"column(item_id);pk;auto;unique" json:"item_id"` ItemId int `orm:"column(item_id);pk;auto;unique" json:"item_id"`
ItemName string `orm:"column(item_name);size(500)" json:"item_name"` ItemName string `orm:"column(item_name);size(500);description(项目空间名称)" json:"item_name"`
ItemKey string `orm:"column(item_key);size(100);unique" json:"item_key"` ItemKey string `orm:"column(item_key);size(100);unique;description(项目空间标识)" json:"item_key"`
Description string `orm:"column(description);type(text);null" json:"description"` Description string `orm:"column(description);type(text);null;description(描述)" json:"description"`
MemberId int `orm:"column(member_id);size(100)" json:"member_id"` MemberId int `orm:"column(member_id);size(100);description(所属用户)" json:"member_id"`
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` 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" json:"modify_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)" json:"modify_at"` ModifyAt int `orm:"column(modify_at);type(int);description(修改人id)" json:"modify_at"`
BookNumber int `orm:"-" json:"book_number"` BookNumber int `orm:"-" json:"book_number"`
CreateTimeString string `orm:"-" json:"create_time_string"` CreateTimeString string `orm:"-" json:"create_time_string"`

View File

@ -9,9 +9,9 @@ import (
) )
type Label struct { type Label struct {
LabelId int `orm:"column(label_id);pk;auto;unique;" json:"label_id"` LabelId int `orm:"column(label_id);pk;auto;unique;description(项目标签id)" json:"label_id"`
LabelName string `orm:"column(label_name);size(50);unique" json:"label_name"` LabelName string `orm:"column(label_name);size(50);unique;description(项目标签名称)" json:"label_name"`
BookNumber int `orm:"column(book_number)" json:"book_number"` BookNumber int `orm:"column(book_number);description(包涵项目数量)" json:"book_number"`
} }
// TableName 获取对应数据库表名. // TableName 获取对应数据库表名.

View File

@ -29,22 +29,22 @@ import (
type Member struct { type Member struct {
MemberId int `orm:"pk;auto;unique;column(member_id)" json:"member_id"` MemberId int `orm:"pk;auto;unique;column(member_id)" json:"member_id"`
Account string `orm:"size(100);unique;column(account)" json:"account"` Account string `orm:"size(100);unique;column(account);description(登录名)" json:"account"`
RealName string `orm:"size(255);column(real_name)" json:"real_name"` RealName string `orm:"size(255);column(real_name);description(真实姓名)" json:"real_name"`
Password string `orm:"size(1000);column(password)" json:"-"` Password string `orm:"size(1000);column(password);description(密码)" json:"-"`
//认证方式: local 本地数据库 /ldap LDAP //认证方式: local 本地数据库 /ldap LDAP
AuthMethod string `orm:"column(auth_method);default(local);size(50);" json:"auth_method"` AuthMethod string `orm:"column(auth_method);default(local);size(50);description(授权方式 local:本地校验 ldapLDAP用户校验)" json:"auth_method"`
Description string `orm:"column(description);size(2000)" json:"description"` Description string `orm:"column(description);size(2000);description(描述)" json:"description"`
Email string `orm:"size(100);column(email);unique" json:"email"` Email string `orm:"size(100);column(email);unique;description(邮箱)" json:"email"`
Phone string `orm:"size(255);column(phone);null;default(null)" json:"phone"` Phone string `orm:"size(255);column(phone);null;default(null);description(手机)" json:"phone"`
Avatar string `orm:"size(1000);column(avatar)" json:"avatar"` Avatar string `orm:"size(1000);column(avatar);description(头像)" json:"avatar"`
//用户角色0 超级管理员 /1 管理员/ 2 普通用户 . //用户角色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"` RoleName string `orm:"-" json:"role_name"`
Status int `orm:"column(status);type(int);default(0)" json:"status"` //用户状态0 正常/1 禁用 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" json:"create_time"` CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add;description(创建时间)" json:"create_time"`
CreateAt int `orm:"type(int);column(create_at)" json:"create_at"` CreateAt int `orm:"type(int);column(create_at);description(创建人id)" json:"create_at"`
LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"` LastLoginTime time.Time `orm:"type(datetime);column(last_login_time);null;description(最后登录时间)" json:"last_login_time"`
//i18n //i18n
Lang string `orm:"-"` Lang string `orm:"-"`
} }

View File

@ -10,13 +10,13 @@ import (
type Relationship struct { type Relationship struct {
RelationshipId int `orm:"pk;auto;unique;column(relationship_id)" json:"relationship_id"` RelationshipId int `orm:"pk;auto;unique;column(relationship_id)" json:"relationship_id"`
MemberId int `orm:"column(member_id);type(int)" json:"member_id"` MemberId int `orm:"column(member_id);type(int);description(作者id)" json:"member_id"`
BookId int `orm:"column(book_id);type(int)" json:"book_id"` BookId int `orm:"column(book_id);type(int);description(所属项目id)" json:"book_id"`
// RoleId 角色0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者 // 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 { func (m *Relationship) TableName() string {
return "relationship" return "relationship"
} }

View File

@ -12,10 +12,10 @@ import (
//团队. //团队.
type Team struct { type Team struct {
TeamId int `orm:"column(team_id);pk;auto;unique;" json:"team_id"` TeamId int `orm:"column(team_id);pk;auto;unique;" json:"team_id"`
TeamName string `orm:"column(team_name);size(255)" json:"team_name"` TeamName string `orm:"column(team_name);size(255);description(团队名称)" json:"team_name"`
MemberId int `orm:"column(member_id);type(int);" json:"member_id"` MemberId int `orm:"column(member_id);type(int);description(创建人id)" json:"member_id"`
IsDelete bool `orm:"column(is_delete);default(0)" json:"is_delete"` 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" json:"create_time"` CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"`
MemberCount int `orm:"-" json:"member_count"` MemberCount int `orm:"-" json:"member_count"`
BookCount int `orm:"-" json:"book_count"` BookCount int `orm:"-" json:"book_count"`
MemberName string `orm:"-" json:"member_name"` MemberName string `orm:"-" json:"member_name"`

View File

@ -11,10 +11,10 @@ import (
type TeamMember struct { type TeamMember struct {
TeamMemberId int `orm:"column(team_member_id);pk;auto;unique;" json:"team_member_id"` 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"` TeamId int `orm:"column(team_id);type(int);description(团队id)" json:"team_id"`
MemberId int `orm:"column(member_id);type(int)" json:"member_id"` MemberId int `orm:"column(member_id);type(int);description(成员id)" json:"member_id"`
// RoleId 角色0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者 // 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"` RoleName string `orm:"-" json:"role_name"`
Account string `orm:"-" json:"account"` Account string `orm:"-" json:"account"`
RealName string `orm:"-" json:"real_name"` RealName string `orm:"-" json:"real_name"`

View File

@ -11,9 +11,9 @@ import (
type TeamRelationship struct { type TeamRelationship struct {
TeamRelationshipId int `orm:"column(team_relationship_id);pk;auto;unique;" json:"team_relationship_id"` TeamRelationshipId int `orm:"column(team_relationship_id);pk;auto;unique;" json:"team_relationship_id"`
BookId int `orm:"column(book_id)" json:"book_id"` BookId int `orm:"column(book_id);description(项目id)" json:"book_id"`
TeamId int `orm:"column(team_id)" json:"team_id"` TeamId int `orm:"column(team_id);description(团队id)" json:"team_id"`
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add;description(创建时间)" json:"create_time"`
TeamName string `orm:"-" json:"team_name"` TeamName string `orm:"-" json:"team_name"`
MemberCount int `orm:"-" json:"member_count"` MemberCount int `orm:"-" json:"member_count"`
BookMemberId int `orm:"-" json:"book_member_id"` BookMemberId int `orm:"-" json:"book_member_id"`

View File

@ -386,7 +386,7 @@ $(function () {
if(res.errcode === 0){ if(res.errcode === 0){
layer.msg("保存成功"); layer.msg("保存成功");
}else{ }else{
layer.msg("保存失败"); layer.msg(res.message);
} }
$("#btnSubmitComment").button("reset"); $("#btnSubmitComment").button("reset");
$("#commentContent").val(""); $("#commentContent").val("");