Documentation
¶
Index ¶
- func ActivateAccount(c *gin.Context)
- func ApplyShow(req component.BetterRequest[ApplyShowReq]) component.Response
- func ApplyTop(req component.BetterRequest[ApplyTopReq]) component.Response
- func ArticleReply(req component.BetterRequest[ArticleReplyId]) component.Response
- func ArticlesList(req component.BetterRequest[ArticlesListReq]) component.Response
- func ChangePassword(req component.BetterRequest[ChangePasswordReq]) component.Response
- func DeleteCategory(req ...) component.Response
- func DeleteNotification(req component.BetterRequest[DeleteNotificationReq]) component.Response
- func DeleteReply(req component.BetterRequest[DeleteReplyId]) component.Response
- func EditArticle(req component.BetterRequest[EditArticleReq]) component.Response
- func EditUser(req component.BetterRequest[EditUserReq]) component.Response
- func EditUserInfo(req component.BetterRequest[EditUserInfoReq]) component.Response
- func FirstOr[T any](d []T, defaultValue T) T
- func GenerateCaptcha() (string, string)
- func GenerateRSS(title, link, description string, items []Item) (string, error)
- func GetAllRoleItem(req component.BetterRequest[GetAllRoleItemReq]) component.Response
- func GetArticlesCategory() component.Response
- func GetArticlesEnum() component.Response
- func GetArticlesPage(param GetArticlesPageRequest) component.Response
- func GetCaptcha() component.Response
- func GetCategoryList(req component.BetterRequest[CategoryListReq]) component.Response
- func GetFileByFileName(c *gin.Context)
- func GetNotificationList(req component.BetterRequest[GetNotificationListReq]) component.Response
- func GetNotificationTypes(req component.BetterRequest[GetNotificationTypesReq]) component.Response
- func GetPermissionList(req component.BetterRequest[PermissionListReq]) component.Response
- func GetSetupStatus(req component.BetterRequest[SetupStatusReq]) component.Response
- func GetSiteStatistics() component.Response
- func GetUnreadCount(req component.BetterRequest[GetUnreadCountReq]) component.Response
- func GetUserArticles(req component.BetterRequest[GetUserArticlesRequest]) component.Response
- func GetUserInfo(req GetUserInfoReq) component.Response
- func InitialSetup(req component.BetterRequest[InitialSetupReq]) component.Response
- func Invitation(req component.BetterRequest[null]) component.Response
- func Login(r LoginReq) component.Response
- func LoginHandler(c *gin.Context)
- func LoginPage(c *gin.Context)
- func Logout(c *gin.Context)
- func MarkAllAsRead(req component.BetterRequest[MarkAllAsReadReq]) component.Response
- func MarkAsRead(req component.BetterRequest[MarkAsReadReq]) component.Response
- func NotFound(c *gin.Context)
- func OptRecordPage(req component.BetterRequest[OptRecordPageReq]) component.Response
- func Register(r RegReq) component.Response
- func RegisterHandle(c *gin.Context)
- func RenderArticleDetail(c *gin.Context)
- func RenderArticlesPage(c *gin.Context)
- func RenderIndex(c *gin.Context)
- func RenderRobotsTxt(c *gin.Context)
- func RenderRssV2(c *gin.Context)
- func RenderSitemapXml(c *gin.Context)
- func RoleDel(req component.BetterRequest[RoleSaveDel]) component.Response
- func RoleList(req component.BetterRequest[RoleListReq]) component.Response
- func RoleSave(req component.BetterRequest[RoleSaveReq]) component.Response
- func SaveCategory(req component.BetterRequest[CategorySaveReq]) component.Response
- func SaveFileByGinContext(c *gin.Context)
- func SendAEmail4User(userEntity *users.Entity) error
- func Sponsors(c *gin.Context)
- func TakeUpTo64Chars(s string) string
- func UploadAvatar(c *gin.Context)
- func UserInfo(req component.BetterRequest[null]) component.Response
- func UserList(req component.BetterRequest[UserListReq]) component.Response
- func UserProfile(c *gin.Context)
- func VerifyCaptcha(captchaId, captchaCode string) bool
- func WriteArticles(req component.BetterRequest[WriteArticleReq]) component.Response
- func WriteArticlesOrigin(req component.BetterRequest[WriteArticlesOriginReq]) component.Response
- type ApplyShowReq
- type ApplyTopReq
- type ArticleReplyId
- type ArticlesInfoDto
- type ArticlesListReq
- type ArticlesSimpleDto
- type CDATA
- type Cache
- type CategoryItem
- type CategoryListReq
- type CategorySaveReq
- type ChangePasswordReq
- type Channel
- type DeleteNotificationReq
- type DeleteReplyId
- type EditArticleReq
- type EditUserInfoReq
- type EditUserReq
- type GetAllRoleItemReq
- type GetArticlesDetailRequest
- type GetArticlesPageRequest
- type GetNotificationListReq
- type GetNotificationTypesReq
- type GetUnreadCountReq
- type GetUserArticlesRequest
- type GetUserInfoReq
- type InitialSetupReq
- type Item
- type LoginHandlerReq
- type LoginReq
- type MarkAllAsReadReq
- type MarkAsReadReq
- type OptRecordPageReq
- type PermissionItem
- type PermissionListReq
- type RSS
- type RegReq
- type ReplyDto
- type RoleItem
- type RoleListReq
- type RoleSaveDel
- type RoleSaveReq
- type SetupStatusReq
- type SiteStats
- type UserInfoShow
- type UserItem
- type UserListReq
- type WriteArticleReq
- type WriteArticlesOriginReq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyShow ¶
func ApplyShow(req component.BetterRequest[ApplyShowReq]) component.Response
ApplyShow 申请展示,是侧边栏
func ApplyTop ¶
func ApplyTop(req component.BetterRequest[ApplyTopReq]) component.Response
ApplyTop 置顶申请,考虑滚动
func ArticleReply ¶
func ArticleReply(req component.BetterRequest[ArticleReplyId]) component.Response
func ArticlesList ¶
func ArticlesList(req component.BetterRequest[ArticlesListReq]) component.Response
func ChangePassword ¶
func ChangePassword(req component.BetterRequest[ChangePasswordReq]) component.Response
添加修改密码的处理函数
func DeleteCategory ¶
func DeleteCategory(req component.BetterRequest[struct { Id uint64 `json:"id"` }]) component.Response
DeleteCategory 删除分类
func DeleteNotification ¶
func DeleteNotification(req component.BetterRequest[DeleteNotificationReq]) component.Response
DeleteNotification 删除通知
func DeleteReply ¶
func DeleteReply(req component.BetterRequest[DeleteReplyId]) component.Response
func EditArticle ¶
func EditArticle(req component.BetterRequest[EditArticleReq]) component.Response
EditArticle 文章状态管理
func EditUser ¶
func EditUser(req component.BetterRequest[EditUserReq]) component.Response
func EditUserInfo ¶
func EditUserInfo(req component.BetterRequest[EditUserInfoReq]) component.Response
EditUserInfo 编辑用户
func GenerateRSS ¶
GenerateRSS 生成符合RSS 2.0规范的XML字符串
func GetAllRoleItem ¶
func GetAllRoleItem(req component.BetterRequest[GetAllRoleItemReq]) component.Response
func GetArticlesCategory ¶
func GetArticlesEnum ¶
func GetArticlesPage ¶
func GetArticlesPage(param GetArticlesPageRequest) component.Response
GetArticlesPage 文章列表
func GetCaptcha ¶
func GetCategoryList ¶
func GetCategoryList(req component.BetterRequest[CategoryListReq]) component.Response
GetCategoryList 获取分类列表
func GetFileByFileName ¶
func GetNotificationList ¶
func GetNotificationList(req component.BetterRequest[GetNotificationListReq]) component.Response
GetNotificationList 获取通知列表
func GetNotificationTypes ¶
func GetNotificationTypes(req component.BetterRequest[GetNotificationTypesReq]) component.Response
GetNotificationTypes 获取所有通知类型
func GetPermissionList ¶
func GetPermissionList(req component.BetterRequest[PermissionListReq]) component.Response
func GetSetupStatus ¶
func GetSetupStatus(req component.BetterRequest[SetupStatusReq]) component.Response
GetSetupStatus 获取安装状态
func GetSiteStatistics ¶
func GetUnreadCount ¶
func GetUnreadCount(req component.BetterRequest[GetUnreadCountReq]) component.Response
GetUnreadCount 获取未读通知数量
func GetUserArticles ¶
func GetUserArticles(req component.BetterRequest[GetUserArticlesRequest]) component.Response
GetUserArticles 获取用户文章列表
func InitialSetup ¶
func InitialSetup(req component.BetterRequest[InitialSetupReq]) component.Response
InitialSetup 执行初始化设置
func Invitation ¶
func Invitation(req component.BetterRequest[null]) component.Response
func MarkAllAsRead ¶
func MarkAllAsRead(req component.BetterRequest[MarkAllAsReadReq]) component.Response
MarkAllAsRead 标记所有通知为已读
func MarkAsRead ¶
func MarkAsRead(req component.BetterRequest[MarkAsReadReq]) component.Response
MarkAsRead 标记通知为已读
func OptRecordPage ¶
func OptRecordPage(req component.BetterRequest[OptRecordPageReq]) component.Response
func RenderIndex ¶
func RenderRssV2 ¶
func RoleDel ¶
func RoleDel(req component.BetterRequest[RoleSaveDel]) component.Response
func RoleList ¶
func RoleList(req component.BetterRequest[RoleListReq]) component.Response
func RoleSave ¶
func RoleSave(req component.BetterRequest[RoleSaveReq]) component.Response
func SaveCategory ¶
func SaveCategory(req component.BetterRequest[CategorySaveReq]) component.Response
SaveCategory 保存分类
func SaveFileByGinContext ¶
func SendAEmail4User ¶
func UserInfo ¶
func UserInfo(req component.BetterRequest[null]) component.Response
UserInfo 获取登录用户信息
func UserList ¶
func UserList(req component.BetterRequest[UserListReq]) component.Response
func UserProfile ¶
func WriteArticles ¶
func WriteArticles(req component.BetterRequest[WriteArticleReq]) component.Response
WriteArticles 写文章
func WriteArticlesOrigin ¶
func WriteArticlesOrigin(req component.BetterRequest[WriteArticlesOriginReq]) component.Response
WriteArticlesOrigin 写文章
Types ¶
type ApplyShowReq ¶
type ApplyTopReq ¶
type ApplyTopReq struct {
ArticleId uint64 `json:"articleId"`
}
type ArticleReplyId ¶
type ArticlesInfoDto ¶
type ArticlesInfoDto struct {
Id uint64 `json:"id"`
Title string `json:"title"`
Type int8 `json:"type"` // 文章类型:0 博文,1教程,2问答,3分享
UserId uint64 `json:"userId"` //
Username string `json:"username"`
ArticleStatus int8 `json:"articleStatus"` // 文章状态:0 草稿 1 发布
ProcessStatus int8 `json:"processStatus"` // 管理状态:0 正常 1 封禁
CreatedAt string `json:"createdAt"` // 改为 string 类型
UpdatedAt string `json:"updatedAt"` // 改为 string 类型
}
type ArticlesListReq ¶
type ArticlesSimpleDto ¶
type ArticlesSimpleDto struct {
Id uint64 `json:"id"`
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
CreateTime string `json:"createTime,omitempty"`
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
Username string `json:"username,omitempty"`
ViewCount uint64 `json:"viewCount,omitempty"`
CommentCount uint64 `json:"commentCount,omitempty"`
Type int8 `json:"type,omitempty"`
TypeStr string `json:"typeStr,omitempty"`
Category string `json:"category,omitempty"`
Categories []string `json:"categories,omitempty"`
CategoriesId []uint64 `json:"categoriesId,omitempty"`
Tags []string `json:"tags,omitempty"`
AvatarUrl string `json:"avatarUrl,omitempty"`
}
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
type CategoryItem ¶
type CategoryListReq ¶
type CategorySaveReq ¶
type ChangePasswordReq ¶
type ChangePasswordReq struct {
OldPassword string `json:"oldPassword" validate:"required"`
NewPassword string `json:"newPassword" validate:"required"`
}
添加新的请求结构体
type DeleteNotificationReq ¶
type DeleteNotificationReq struct {
NotificationId uint64 `json:"notificationId" validate:"required"`
}
DeleteNotificationReq 删除通知请求
type DeleteReplyId ¶
type DeleteReplyId struct {
ReplyId uint64 `json:"repoId"`
}
type EditArticleReq ¶
type EditUserInfoReq ¶
type EditUserReq ¶
type GetAllRoleItemReq ¶
type GetAllRoleItemReq struct {
}
type GetArticlesPageRequest ¶
type GetNotificationListReq ¶
type GetNotificationListReq struct {
Page int `json:"page" validate:"required,min=1"`
PageSize int `json:"pageSize" validate:"required,min=1,max=100"`
UnreadOnly bool `json:"unreadOnly"`
}
GetNotificationListReq 获取通知列表请求
type GetNotificationTypesReq ¶
type GetNotificationTypesReq struct{}
GetNotificationTypesReq 获取通知类型请求
type GetUserArticlesRequest ¶
添加新的请求结构体
type GetUserInfoReq ¶
type GetUserInfoReq struct {
UserId uint64 `json:"userId"`
}
type InitialSetupReq ¶
type InitialSetupReq struct {
SiteName string `json:"siteName" validate:"required"`
SiteDesc string `json:"siteDesc"`
// 数据库配置
DBType string `json:"dbType" validate:"required"`
SqlitePath string `json:"sqlitePath" validate:"required"`
DBHost string `json:"dbHost" validate:"required"`
DBPort string `json:"dbPort" validate:"required"`
DBName string `json:"dbName" validate:"required"`
DBUser string `json:"dbUser" validate:"required"`
DBPassword string `json:"dbPassword" validate:"required"`
// 管理员账号配置
AdminUsername string `json:"adminUsername" validate:"required"`
AdminPassword string `json:"adminPassword" validate:"required"`
AdminEmail string `json:"adminEmail" validate:"required,email"`
}
type LoginHandlerReq ¶
type MarkAsReadReq ¶
type MarkAsReadReq struct {
NotificationId uint64 `json:"notificationId" validate:"required"`
}
MarkAsReadReq 标记通知已读请求
type OptRecordPageReq ¶
type OptRecordPageReq struct {
}
type PermissionItem ¶
type PermissionListReq ¶
type PermissionListReq struct {
}
type RSS ¶
type RSS struct {
XMLName xml.Name `xml:"rss"`
Version string `xml:"version,attr"`
Channel Channel `xml:"channel"`
}
RSS 2.0规范核心结构体
type RegReq ¶
type RegReq struct {
Email string `json:"email" validate:"required"`
Username string `json:"userName" validate:"required"`
Password string `json:"passWord" validate:"required"`
InvitationCode string `json:"invitationCode,omitempty"`
CaptchaId string `json:"captchaId" validate:"required"`
CaptchaCode string `json:"captchaCode" validate:"required"`
}
type ReplyDto ¶
type ReplyDto struct {
Id uint64 `json:"id"`
ArticleId uint64 `json:"articleId"`
UserId uint64 `json:"userId"`
Username string `json:"username"`
Content string `json:"content"`
CreateTime string `json:"createTime"`
ReplyToId uint64 `json:"replyToId,omitempty"`
ReplyToUsername string `json:"replyToUsername,omitempty"`
}
type RoleItem ¶
type RoleItem struct {
RoleId uint64 `json:"roleId"`
RoleName string `json:"roleName"`
Effective int `json:"effective"`
Permissions []PermissionItem `json:"permissions"`
CreateTime string `json:"createTime"`
}
type RoleListReq ¶
type RoleListReq struct {
}
type RoleSaveDel ¶
type RoleSaveDel struct {
Id uint `json:"id"`
}
type RoleSaveReq ¶
type SetupStatusReq ¶
type SetupStatusReq struct{}
type SiteStats ¶
type SiteStats struct {
UserCount int64 `json:"userCount"`
ArticleCount int64 `json:"articleCount"`
Reply int64 `json:"reply"`
}
func GetSiteStatisticsData ¶
func GetSiteStatisticsData() SiteStats
type UserInfoShow ¶
type UserInfoShow struct {
UserId uint64 `json:"userId,omitempty"`
Username string `json:"username"`
Prestige int64 `json:"prestige"`
AvatarUrl string `json:"avatarUrl"`
UserPoint int64 `json:"userPoint"`
CreateTime time.Time `json:"createTime"`
}
func GetLoginUser ¶
func GetLoginUser(c *gin.Context) UserInfoShow
func GetUserShowByUserId ¶
func GetUserShowByUserId(userId uint64) UserInfoShow
type UserItem ¶
type UserItem struct {
UserId uint64 `json:"userId"`
Username string `json:"username"`
Email string `json:"email"`
Status int8 `json:"status"`
Validate int8 `json:"validate"`
Prestige int64 `json:"prestige"`
RoleList []datastruct.Option[string, uint64] `json:"roleList"`
CreateTime string `json:"createTime"`
}
type UserListReq ¶
type WriteArticleReq ¶
type WriteArticlesOriginReq ¶
type WriteArticlesOriginReq struct {
Id int64 `json:"id"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.