Documentation
¶
Index ¶
- func ChangePassword(user *models.User, userdto dto.UserInfoDto) error
- func ChangePasswordWithOld(user *models.User, old string, new string) error
- func CreateMessage(message *models.Message) error
- func DeleteMessage(id uint, userID uint) error
- func DeleteMessageByAdmin(id uint) error
- func FormatContentForCustomHttp(content string, images []string) string
- func FormatContentForFeishu(content string, images []string) string
- func FormatContentForTelegram(content string, images []string, format string) string
- func FormatContentForTwitter(content string, images []string) string
- func FormatContentForWebhook(content string, images []string) string
- func FormatContentForWework(content string, images []string) string
- func GenerateRSS(c *gin.Context) (string, error)
- func GetAllMessages(showPrivate bool) ([]models.Message, error)
- func GetFrontendConfig() (map[string]interface{}, error)
- func GetMessageByID(id uint, showPrivate bool) (*models.Message, error)
- func GetMessagePage(id uint) (*models.Message, error)
- func GetMessagesByPage(page, pageSize int, userID *uint, isAdmin bool, authorID *uint, ...) (dto.PageQueryResult, error)
- func GetMessagesGroupByDate() ([]struct{ ... }, error)
- func GetStatus() (models.Status, error)
- func GetUserByID(userID uint) (*models.User, error)
- func GetUserByUsername(username string) (*models.User, error)
- func GetUserToken(userID uint) (string, error)
- func IncrementLikeCount(messageID uint) (int, error)
- func IsUserAdmin(userID uint) (bool, error)
- func Login(userdto dto.LoginDto) (*models.User, error)
- func ProcessMarkdownWithImages(content string, additionalImages []string) string
- func RegenerateUserToken(userID uint) (string, error)
- func Register(userdto dto.RegisterDto) error
- func RenderMarkdownPreview(content string) string
- func SearchMessages(keyword string, page, pageSize int, showPrivate bool, authorID *uint, ...) (dto.PageQueryResult, error)
- func SeedDefaultData() error
- func StartInfoFeedAutoRefresh()
- func ToggleLike(messageID uint, userID *uint, sessionID string) (bool, int, error)
- func UpdateFrontendSetting(userID uint, settingMap map[string]interface{}) error
- func UpdateMessage(messageID uint, content *string, private *bool) (*models.Message, error)
- func UpdateMessagePinned(messageID uint, pinned bool) error
- func UpdateUser(user *models.User, userdto dto.UserInfoDto) error
- func UpdateUserAdmin(userID uint, currentUserID uint) error
- func UploadImage(c *gin.Context) dto.Result[string]
- type InfoFeedItem
- type InfoFeedSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangePassword ¶
func ChangePassword(user *models.User, userdto dto.UserInfoDto) error
func ChangePasswordWithOld ¶
ChangePasswordWithOld 验证旧密码后更新为新密码(兼容历史明文/MD5/bcrypt)
func CreateMessage ¶
CreateMessage 发布一条笔记 允许所有注册登陆用户发布信息
func DeleteMessageByAdmin ¶
DeleteMessageByAdmin 管理员删除笔记(无需验证作者)
func FormatContentForCustomHttp ¶
FormatContentForCustomHttp 格式化内容以适应自定义HTTP
func FormatContentForFeishu ¶
FormatContentForFeishu 格式化内容以适应飞书
func FormatContentForTelegram ¶
FormatContentForTelegram 格式化内容以适应 Telegram
func FormatContentForTwitter ¶
FormatContentForTwitter 格式化内容以适应 Twitter
func FormatContentForWebhook ¶
FormatContentForWebhook 格式化内容以适应 Webhook
func FormatContentForWework ¶
FormatContentForWework 格式化内容以适应企业微信
func GetAllMessages ¶
GetAllMessages 封装业务逻辑,获取所有笔记
func GetFrontendConfig ¶
GetFrontendConfig 获取前端配置
func GetMessageByID ¶
GetMessageByID 根据 ID 获取笔记
func GetMessagesByPage ¶
func GetMessagesByPage(page, pageSize int, userID *uint, isAdmin bool, authorID *uint, username *string) (dto.PageQueryResult, error)
GetMessagesByPage 分页获取笔记(支持作者筛选;管理员查看全部;普通用户可查看公开和自己的私密)
func GetMessagesGroupByDate ¶
func GetUserToken ¶
func IncrementLikeCount ¶
IncrementLikeCount 点赞计数加一
func IsUserAdmin ¶
func ProcessMarkdownWithImages ¶
ProcessMarkdownWithImages 处理 Markdown 内容并将图片链接转换为 HTML 图片标签
func RegenerateUserToken ¶
func Register ¶
func Register(userdto dto.RegisterDto) error
func RenderMarkdownPreview ¶
RenderMarkdownPreview 将 Markdown 内容转换为预览状态
func SearchMessages ¶
func StartInfoFeedAutoRefresh ¶
func StartInfoFeedAutoRefresh()
StartInfoFeedAutoRefresh 启动/重建信息流后台定时刷新任务。
func ToggleLike ¶
ToggleLike 根据 session 或用户切换点赞状态
func UpdateFrontendSetting ¶
UpdateSetting 更新站点配置
func UpdateMessage ¶
UpdateMessage 更新消息字段
func UpdateMessagePinned ¶
UpdateMessagePinned 更新消息置顶状态
func UpdateUser ¶
func UpdateUser(user *models.User, userdto dto.UserInfoDto) error
func UpdateUserAdmin ¶
Types ¶
type InfoFeedItem ¶
type InfoFeedItem struct {
Title string `json:"title"`
Link string `json:"link"`
Content string `json:"content"`
Summary string `json:"summary"`
ImageURL string `json:"imageURL"`
Source string `json:"source"`
Type string `json:"type"`
Author string `json:"author"`
AvatarURL string `json:"avatarURL"`
PublishedAt string `json:"publishedAt"`
Timestamp int64 `json:"timestamp"`
}
func LoadInfoFeedItems ¶
func LoadInfoFeedItems(limit int) ([]InfoFeedItem, error)
type InfoFeedSource ¶
type InfoFeedSource struct {
Type string `json:"type"`
Group string `json:"group"`
Name string `json:"name"`
URL string `json:"url"`
Enabled bool `json:"enabled"`
Visible bool `json:"visible"`
}
func GetInfoFeedConfig ¶
func GetInfoFeedConfig() (bool, int, []InfoFeedSource, error)