package
1.0.0
Repository: https://github.com/0raja/road.git
Documentation: pkg.go.dev

# Functions

AddComment @Summary 创建评论 @Description 创建一个对于帖子的评论或对评论的回复 @Tags 评论 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id body int64 true "帖子ID" @Param content body string true "评论内容 1<=len<=100" @Param to_comment_id body int64 true "回复的评论ID" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /comment/add [post].
AddManager @Summary 添加管理员 @Description 添加一个管理员的信息 @Tags 管理员 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param Authorization header string true "Bearer 用户令牌" @Param username body int64 true "用户名 3<=len<=50" @Param password body string true "密码 6<=len<=32" @Param avatar_url body string true "头像链接" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /manager/create [post].
AddPost @Summary 新增帖子 @Description 新增一个帖子的封面,标题,简介,内容以及确定其是否公开 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param cover body string true "封面链接" @Param title body string true "标题 1<=len<=50" @Param abstract body string true "简介 1<=len<=100" @Param content body string true "内容" @Param public body bool true "是否公开 Enums[true,false]" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/create [post].
AddPostTag @Summary 给一个帖子加上一个标签 @Description 给一个帖子加上一个标签 @Tags 文章和标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id body int64 true "帖子ID" @Param tag_id body int64 true "标签ID" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /postTag/add [post].
AddTag @Summary 增加一个标签 @Description 增加一个标签 @Tags 标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param tag_name body string true "标签名" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /tag/add [post].
CheckManagerName @Summary 检查管理员名是否存在 @Description 检查管理员名是否存在 @Tags 管理员 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param username path string true "用户名 3<=len<=50" @Success 200 {bool} bool "返回是否存在此管理员" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /manager/check/{username} [get].
CheckTagName @Summary 判断标签名是否存在 @Description 判断标签名是否存在 @Tags 标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param tag_name query string true "标签名" @Success 200 {object} logic.ListTagsReply "返回帖子对应的所有标签的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /tag/check{tag_name} [get].
DeleteComment @Summary 删除评论 @Description 删除一个评论 @Tags 评论 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param comment_id path int64 true "需要删除的评论ID" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /comment/{comment_id} [delete].
DeleteManager @Summary 删除管理员 @Description 删除一个管理员 @Tags 管理员 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param username path string true "用户名" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /manager/{username} [delete].
DeletePostTag @Summary 删除一个帖子的标签 @Description 删除一个帖子的标签 @Tags 文章和标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id body int64 true "帖子ID" @Param tag_id body int64 true "标签ID" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /postTag/delete [delete].
DeleteTag @Summary 删除一个标签 @Description 删除一个标签 @Tags 标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param tag_id path int64 true "标签ID" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /tag/{tag_id} [delete].
GetGrowViewsByPostID @Summary 获取指定帖子的新增访问量 @Description 获取指定帖子的新增访问量 @Tags views @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id path int64 true "帖子ID" @Success 200 {int64} int64 "返回对应帖子的新增访问量" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /views/post/{post_id} [get].
GetPost @Summary 获取一个帖子的完整信息 @Description 获取一个帖子的完整信息 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id path int64 true "帖子ID" @Success 200 {object} logic.Post "获取一个帖子的ID,封面,标题,简介,内容,是否公开,是否删除以及,创建时间,修改时间,点赞数和浏览数" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/post/{post_id} [get].
GetPostInfo @Summary 获取一个帖子的简介信息 @Description 获取一个帖子的简介信息 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id path int64 true "帖子ID" @Success 200 {object} logic.PostInfo "返回一个帖子的ID,封面,标题,简介,是否公开,是否删除以及,创建时间和修改时间以及点赞数和访问数和其对应标签的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/info/{post_id} [get].
GetToken @Summary 获取token @Description 用户将被重定向到github授权,服务器会得到授权后返回用户信息和token,retoken @Tags auth @Accept application/json @Produce application/json @Success 200 {object} logic.GetTokenReply "返回用户信息和token以及retoken" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /token/get [get].
GetUserInfo @Summary 获取用户信息 @Description 获取用户的用户名,头像链接,仓库链接,ip地址,创建时间,修改时间 @Tags user @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param username path string true "用户名" @Success 200 {object} logic.User "用户信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /user/{username} [get].
GetUserStar @Summary 获取用户对于某个帖子的点赞情况 @Description 通过post_id获取用户对于某个帖子的点赞情况 @Tags user_star @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id path int64 true "帖子ID" @Success 200 {bool} bool "true表示已经点过赞,false表示没有" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /star/{post_id} [get].
ListComments @Summary 显示评论 @Description 根据post_id和偏移量显示一个帖子的部分评论的内容 @Tags 评论 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id query int64 true "需要显示评论的帖子ID" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {array} logic.ListCommentByPostIDReply "返回评论的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /comment/list [get].
ListManagers @Summary 列出管理员 @Description 列出管理员 @Tags 管理员 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListManagerReply "返回管理员的用户名" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /manager/list [get].
ListPostInfos @Summary 列出帖子简介 @Description 列出帖子简介,默认按创建时间倒序 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param list_by query string true "列出什么类型的帖子 Enums(infos,public,private,deleted,topping,star_num,visited_num) 分别对应默认时间排序,公开的,私密的,删除的,置顶的,点赞数排序,访问数排序" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListPostInfosReply "返回帖子简介的数组和描述数组大小的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/infos/list [get].
ListPostInfosByTagID @Summary 列出一个标签对应的所有帖子简介信息 @Description 列出一个标签对应的所有帖子简介信息 @Tags 文章和标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param tag_id query int64 true "标签ID" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListPostInfosByTagIDReply "返回帖子对应的所有标签的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /postTag/infos [get].
ListPostInfosOrderByGrowingVisited @Summary 通过按新增访问数排序的帖子简介信息 @Description 通过按新增访问数排序的帖子简介信息,按新增访问数由高到低排序 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListPostInfosReply "返回帖子简介的数组和描述数组大小的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/infos/visit [get].
ListTags @Summary 列出标签 @Description 列出标签 @Tags 标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListTagsReply "返回帖子对应的所有标签的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /tag/update [get].
ListTagsByPostID @Summary 列出一个帖子对应的所有标签 @Description 列出一个帖子对应的所有标签 @Tags 文章和标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id query int64 true "帖子ID" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListTagsReply "返回帖子对应的所有标签的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /postTag/tags [get].
ListUsers @Summary 列出用户信息 @Description 列出用户的用户名,头像链接,仓库链接,ip地址,创建时间,修改时间 @Tags user @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListUsersReply "用户信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /user/users [get].
ListUsersByCreateTime @Summary 通过时间段来检索用户信息 @Description 通过时间段来检索用户信息 @Tags user @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param start_time query string true "起始时间 (2002-03-26 09:00:00)" @Param end_time query string true "结束时间 (2002-03-26 09:00:00)" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListUsersReply "返回帖子简介的数组和描述数组大小的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /user/createTime [get].
ListViewsByCreateTime @Summary 获取时间段内的访问数量 @Description 获取时间段内的访问数量 @Tags views @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param start_time query string true "起始时间 (2002-03-26 09:00:00)" @Param end_time query string true "结束时间 (2002-03-26 09:00:00)" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListViewsByCreateTimeReply "指定时间内的所有访问数" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /views/all [get].
LoginManager @Summary 管理员登录 @Description 用于管理员使用账号和密码进行登录 @Tags 管理员 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param username body string true "用户名 3<=len<=50" @Param password body string true "密码 6<=len<=32" @Success 200 {object} logic.LoginManagerReply "返回用户信息和授权码" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /manager/login [post].
ModifyComment @Summary 修改评论 @Description 修改一个评论的内容 @Tags 评论 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param comment_id body int64 true "需要修改的评论ID" @Param content body string true "评论修改后的内容 1<=len<=100" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /comment/update [put].
ModifyPostDeleted @Summary 修改一个帖子删除状态 @Description 修改一个帖子删除状态 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id body int64 true "帖子ID" @Param deleted body bool false "帖子删除状态,默认为false" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/delete [put].
ModifyPostPublic @Summary 修改一个帖子公开状态 @Description 修改一个帖子公开状态 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id body int64 true "帖子ID" @Param public body bool true "帖子公开状态,默认为false" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/public [put].
RealDeletePost @Summary 真正删除一个帖子 @Description 将一个处于删除状态的帖子真正删除 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id path int64 true "帖子ID" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/{post_id} [delete].
RefreshToken @Summary 刷新token @Description 将过期的token和未过期的retoken换取新的token @Tags auth @Accept application/json @Produce application/json @Param token body string true "过期的token" @Param re_token body string true "未过期的刷新token" @Success 200 {object} logic.RefreshTokenReply "返回用户信息和新的token" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /token/refresh [put].
SearchPostInfosByCreateTime @Summary 通过时间段来检索帖子 @Description 通过时间段来检索帖子,默认按创建时间先后倒序 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param start_time query string true "起始时间 (2002-03-26)" @Param end_time query string true "结束时间 (2002-03-26)" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListPostInfosReply "返回帖子简介的数组和描述数组大小的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/infos/time [get].
SearchPostInfosByKey @Summary 通过关键字搜索帖子的标题和简介 @Description 通过关键字搜索帖子的标题和简介,默认按置顶先后倒序 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param key query string key "关键字 1<=len<=15" @Param page query int false "页码 default 1" @Param page_size query int false "每页数量 default and max 10" @Success 200 {object} logic.ListPostInfosReply "返回帖子简介的数组和描述数组大小的信息" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/infos/search [get].
No description provided by the author
UpdateManager @Summary 修改管理员头像和密码 @Description 修改管理员头像和密码,空字符串表示不修改 @Tags 管理员 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param password body string true "新密码 6<=len<=32" @Param avatar_url body string true "新头像链接" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /manager/update [put].
UpdatePost @Summary 更新帖子 @Description 更新一个帖子的封面,标题,简介,内容以及确定其是否公开 @Tags 文章 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id body int64 true "帖子ID" @Param cover body string true "封面链接" @Param title body string true "标题" @Param abstract body string true "简介" @Param content body string true "内容" @Param public body bool true "是否公开" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /post/update [put].
UpdateTag @Summary 修改一个标签的名字 @Description 修改一个标签的名字 @Tags 标签 @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param tag_id body int64 true "标签ID" @Param tag_name body string true "更改后名字" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /tag/update [put].
Upload 上传服务 @Summary 上传服务,目前支持图片(png,svg,jpg,webp,bmp,20m以内)和文件(50m以内) @Description 上传图片 @Tags Upload @Accept multipart/form-data @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param file formData file true "文件" @Param file_type body string true "文件类型 Enums(image,file)" @Success 200 {string} string "上传文件的url" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /upload [post].
UserStarPost @Summary 用户对某个帖子点赞或取消点赞 @Description 用户对某个帖子点赞或取消点赞 @Tags user_star @Accept application/json @Produce application/json @Param Authorization header string true "Bearer 用户令牌" @Param post_id body int64 true "帖子ID" @Param state body bool false "点赞状态 Enums(true,false) 默认为false" @Success 200 {string} string "" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /star/update [put].