Documentation ¶
Index ¶
- Constants
- Variables
- func AddBalance(balance *ConsumptionRecord) bool
- func AddBrowseRecordNum(record *BrowseRecord) bool
- func AddFavorites(favorite *Favorites) bool
- func AddFileRecord(record *UploadFileRecord) (bool, int)
- func AddFileViewsNum(id int) bool
- func AddMemberByNameAndEmailIfNotExist(username, email string) (*auth.User, error)
- func AddMemberFavorites(memberId string, favoritesType string, objectId string) bool
- func AddNode(node *Node) bool
- func AddNodeModerators(memberId, nodeId string) bool
- func AddNodes(nodes []*Node) bool
- func AddNotification(notification *Notification) bool
- func AddPlane(plane *Plane) bool
- func AddPoster(poster Poster) bool
- func AddReplies(replies []*Reply) bool
- func AddRepliesInBatch(relies []*Reply) bool
- func AddReply(reply *Reply) (bool, int)
- func AddReplyNotification(senderId, content string, objectId, topicId int)
- func AddReplyThanksNum(id int) bool
- func AddSensitiveWord(word string)
- func AddTab(tab *Tab) bool
- func AddTabs(tabs []*Tab) bool
- func AddTopic(topic *Topic) (bool, int)
- func AddTopicHitCount(topicId int) bool
- func AddTopicNotification(objectId int, author, content string)
- func AddTopics(topics []*Topic) bool
- func AddTopicsInBatch(topics []*Topic) bool
- func AddTranslator(translator Translator) bool
- func AutoSyncGoogleGroup()
- func ChangeExpiredDataStatus(recordType int, date string) int
- func ChangeTopicFavoriteCount(topicId int, num int) bool
- func ChangeTopicLastReplyUser(topicId int, memberId string, updateTime string) bool
- func ChangeTopicReplyCount(topicId int, num int) bool
- func ChangeTopicSubscribeCount(topicId int, num int) bool
- func ChangeTopicTopExpiredTime(id int, date, topType string) bool
- func CheckIsAdmin(user *auth.User) bool
- func CheckNodeModerator(user *auth.User, nodeId string) bool
- func ContainsSensitiveWord(str string) bool
- func CreateReplyConsumption(user *auth.User, id int) bool
- func CreateTopicConsumption(user *auth.User, id int) bool
- func DelTranslator(id string) bool
- func DeleteFavorites(memberId string, objectId string, favoritesType string) bool
- func DeleteFileRecord(id int) bool
- func DeleteFilesByMember(memberId string) bool
- func DeleteNode(id string) bool
- func DeleteNodeModerators(memberId, nodeId string) bool
- func DeleteNotification(id string) bool
- func DeletePlane(id string) bool
- func DeleteRepliesHardByTopicId(topicId int) bool
- func DeleteReply(id int) bool
- func DeleteSensitiveWord(word string)
- func DeleteTab(id string) bool
- func DeleteTopic(id int) bool
- func DeleteTopicHard(id int) bool
- func DeletedExpiredData(recordType int, date string) bool
- func ExpireTopTopic() int
- func FileEditable(user *auth.User, author string) bool
- func FilterUnsafeHTML(content string) string
- func GetBrowseRecordNum(recordType int, objectId string) int
- func GetCreatedTopicsNum(memberId string) int
- func GetDefaultTab() string
- func GetFavoritesCount() int
- func GetFavoritesNum(favoritesType string, memberId string) int
- func GetFavoritesStatus(memberId string, objectId string, favoritesType string) bool
- func GetFilesNum(memberId string) int
- func GetFollowingNum(id string) int
- func GetForumVersion() string
- func GetHighestOnlineNum() int
- func GetLastRecordId() int
- func GetLatestSyncedRecordId() int
- func GetMemberBalance(user *auth.User) int
- func GetMemberCheckinDate(user *auth.User) string
- func GetMemberConsumptionRecordNum(memberId string) int
- func GetMemberEditorType(user *auth.User) string
- func GetMemberEmailReminder(id string) (bool, string)
- func GetMemberFileQuota(user *auth.User) int
- func GetMemberLanguage(user *auth.User) string
- func GetMemberNum() int
- func GetMemberRepliesNum(memberId string) int
- func GetMembersFromFavorites(objectId string, favoritesType string) []*auth.User
- func GetNodeFavoritesNum(id string) int
- func GetNodeModerators(id string) []string
- func GetNodeTopicNum(id string) int
- func GetNodesNum() int
- func GetNotificationCount() int
- func GetNotificationNum(memberId string) int
- func GetOnlineMemberNum() int
- func GetOnlineUserCount() int
- func GetPlaneNodesNum(id string) int
- func GetRankingPlayer() ([]*auth.User, error)
- func GetRankingRich() ([]*auth.User, error)
- func GetReplyAuthor(id int) *auth.User
- func GetReplyBonus(author *auth.User, consumer *auth.User, id int)
- func GetReplyCount() int
- func GetReplyEditableStatus(member, author, createdTime string) bool
- func GetReplyTopicTitle(id int) string
- func GetSensitiveWords() []string
- func GetThanksStatus(memberId string, id, recordType int) bool
- func GetTopicAuthor(id int) *auth.User
- func GetTopicCount() int
- func GetTopicEditableStatus(user *auth.User, author, nodeId, createdTime string) bool
- func GetTopicNodeId(id int) string
- func GetTopicNum() int
- func GetTopicReplyNum(topicId int) int
- func GetTopicTitle(id int) string
- func GetTranslator(id string) *[]Translator
- func GetUnreadNotificationNum(memberId string) int
- func GetUser(id string) *auth.User
- func GetUserByEmail(email string) *auth.User
- func GetUserField(user *auth.User, field string) string
- func GetUserFieldInt(user *auth.User, field string) int
- func GetUserName(user *auth.User) string
- func GetUsers() []*auth.User
- func HasNode(id string) bool
- func HasPlane(id string) bool
- func HasTab(id string) bool
- func InitAdapter()
- func InitConfig()
- func InitForumBasicInfo()
- func InitFrontConf()
- func InitHttpClient()
- func InitTimer()
- func IsFavoritesExist(Type string) bool
- func IsForbidden(user *auth.User) bool
- func IsSensitiveWord(word string) bool
- func RemoveHtmlTags(text string) string
- func ReplyDeletable(date, memberId, author string) bool
- func SetUserField(user *auth.User, field string, value string)
- func SetUserFieldInt(user *auth.User, field string, value int)
- func SyncAllNodeFromGoogleGroup()
- func TopTopicConsumption(user *auth.User, id int) bool
- func UpdateFileDescribe(id int, fileName, desc string) bool
- func UpdateFrontConf(confs []*FrontConf) bool
- func UpdateHighestOnlineNum(num int) bool
- func UpdateHotNode(last int) int
- func UpdateHotTopic(last int) int
- func UpdateLatestSyncedRecordId(id int) bool
- func UpdateMemberBalance(user *auth.User, amount int) (bool, error)
- func UpdateMemberCheckinDate(user *auth.User, checkinDate string) (bool, error)
- func UpdateMemberConsumptionSum(user *auth.User, amount int) (bool, error)
- func UpdateMemberEditorType(user *auth.User, editorType string) (bool, error)
- func UpdateMemberLanguage(user *auth.User, language string) (bool, error)
- func UpdateMemberOnlineStatus(user *auth.User, isOnline bool, lastActionDate string) (bool, error)
- func UpdateNode(id string, node *Node) bool
- func UpdateNodeHotInfo(nodeId string, hot int) bool
- func UpdateOnlineMemberNum()
- func UpdatePlane(id string, plane *Plane) bool
- func UpdatePoster(id string, poster Poster) bool
- func UpdateReadStatus(id string) bool
- func UpdateReply(id int, reply *Reply) bool
- func UpdateReplyWithLimitCols(id int, reply *Reply) bool
- func UpdateTab(id string, tab *Tab) bool
- func UpdateTopic(id int, topic *Topic) bool
- func UpdateTopicHotInfo(topicId string, hot int) bool
- func UpdateTopicWithLimitCols(id int, topic *Topic) bool
- func UpdateTranslator(translator Translator) bool
- type Adapter
- type AdminMemberInfo
- type AdminPlaneInfo
- type AdminTabInfo
- type AdminTopicInfo
- type BalanceResponse
- type BasicInfo
- type BrowseRecord
- type CommunityHealth
- type ConsumptionRecord
- type CronJob
- type Favorites
- type FrontConf
- type GoogleTranslationResult
- type LatestReply
- type Node
- type NodeFavoritesRes
- type NodeNavigationResponse
- type NodeRelation
- type NodeTopic
- type Notification
- type NotificationResponse
- type Plane
- type PlaneWithNodes
- type Poster
- type Reply
- type ReplyWithAvatar
- type SensitiveWord
- type Session
- type Tab
- type Topic
- func GetAllCreatedTopics(author string, tab string, limit int, offset int) []*Topic
- func GetAllTopics() []*Topic
- func GetTopic(id int) *Topic
- func GetTopicBasicInfo(id int) *Topic
- func GetTopicByUrlPathAndTitle(urlPath, title, nodeId string) *Topic
- func GetTopicsByTitleAndAuthor(title string, author string) []*Topic
- type TopicWithAvatar
- func GetFollowingNewAction(memberId string, limit int, offset int) []*TopicWithAvatar
- func GetHotTopic(limit int) []*TopicWithAvatar
- func GetSortedTopics(lastReplySort, hotSort, favCountSort, createdTimeSort string, limit int, ...) []*TopicWithAvatar
- func GetTopicWithAvatar(id int, user *auth.User) *TopicWithAvatar
- func GetTopics(limit int, offset int) []*TopicWithAvatar
- func GetTopicsFromFavorites(memberId string, limit int, offset int, favoritesType string) []*TopicWithAvatar
- func GetTopicsWithTab(tab string, limit, offset int) []*TopicWithAvatar
- func SearchTopics(keyword string) []*TopicWithAvatar
- type TranslateData
- type Translator
- type UpdateJob
- type UpdateListItem
- type UploadFileRecord
Constants ¶
const ( FavorTopic = "favor_topic" FollowUser = "follow_user" FavorNode = "favor_node" SubscribeTopic = "subscribe_topic" SubscribeReply = "subscribe_reply" )
Variables ¶
var ( DefaultPageNum = 20 DefaultHomePageNum = 50 DefaultNotificationPageNum = 10 DefaultBalancePageNum = 25 DefaultFilePageNum = 25 DefaultMemberAdminPageNum = 100 DefaultRenameQuota = 3 UserNamingRestrictions = false HomePageNodeNum = 8 TopicThanksCost = 15 ReplyThanksCost = 10 CreateTopicCost = 20 CreateReplyCost = 5 TopTopicCost = 200 ReceiveReplyBonus = 5 MaxDailyCheckinBonus = 20 LatestNodeNum = 20 HotNodeNum = 15 HotTopicNum = 10 TopicEditableTime = 10.0 // minutes ReplyEditableTime = 10.0 // minutes ReplyDeletableTime = 5.0 // minutes NodeHitRecordExpiredTime = 1 // month TopicHitRecordExpiredTime = 1 // day ValidateCodeExpiredTime = 20 // minutes DefaultTopTopicTime = 10 // minutes OnlineMemberExpiedTime = 10 // minutes DefaultUploadFileQuota = 50 Domain = beego.AppConfig.String("domain") // domain AutoSyncPeriodSecond = -1 // auto sync is disabled if < 30 DefaultCronJobs = []*CronJob{ { Id: "updateExpiredData", BumpTime: "0:0", State: "active", }, { Id: "updateHotInfo", BumpTime: "*/1:*", State: "active", }, { Id: "expireData", BumpTime: "*/1:*", State: "active", }, } DefaultCronUpdates = []*UpdateJob{ { Id: "expireData", JobId: "updateExpiredData", State: "active", }, { Id: "hotInfo", JobId: "updateHotInfo", State: "active", }, { Id: "expireTopTopic", JobId: "expireData", State: "active", }, { Id: "expireOnlineMember", JobId: "expireData", State: "active", }, } )
var CasdoorApplication string
var CasdoorOrganization string
var CasdoorStorageEndpoint = beego.AppConfig.String("casdoorStorageEndpoint")
var (
Confs = []*FrontConf{
{Id: "forumName", Value: "Casnode", Field: "visualConf"},
{Id: "logoImage", Value: "https://cdn.casbin.com/forum/static/img/logo.png", Field: "visualConf"},
{Id: "footerLogoImage", Value: "https://cdn.casbin.com/forum/static/img/logo-footer.png", Field: "visualConf"},
{Id: "footerLogoUrl", Value: "https://www.digitalocean.com/", Field: "visualConf"},
{Id: "signinBoxStrong", Value: "Casbin = way to authorization", Field: "visualConf"},
{Id: "signinBoxSpan", Value: "A place for Casbin developers and users", Field: "visualConf"},
{Id: "footerDeclaration", Value: "World is powered by code", Field: "visualConf"},
{Id: "footerAdvise", Value: "♥ Do have faith in what you're doing.", Field: "visualConf"},
}
)
Functions ¶
func AddBalance ¶
func AddBalance(balance *ConsumptionRecord) bool
func AddBrowseRecordNum ¶
func AddBrowseRecordNum(record *BrowseRecord) bool
func AddFavorites ¶
func AddFileRecord ¶
func AddFileRecord(record *UploadFileRecord) (bool, int)
func AddFileViewsNum ¶
func AddMemberFavorites ¶
func AddNodeModerators ¶
func AddNotification ¶
func AddNotification(notification *Notification) bool
func AddReplies ¶
func AddRepliesInBatch ¶
func AddReplyNotification ¶
func AddReplyThanksNum ¶
AddReplyThanksNum updates reply's thanks num.
func AddSensitiveWord ¶
func AddSensitiveWord(word string)
func AddTopicHitCount ¶
func AddTopicNotification ¶
func AddTopicsInBatch ¶
func AddTranslator ¶
func AddTranslator(translator Translator) bool
func AutoSyncGoogleGroup ¶
func AutoSyncGoogleGroup()
func ChangeExpiredDataStatus ¶
func ChangeTopicReplyCount ¶
func ChangeTopicTopExpiredTime ¶
ChangeTopicTopExpiredTime changes topic's top expired time. topType: tab, node or homePage.
func CheckIsAdmin ¶
func ContainsSensitiveWord ¶
func DelTranslator ¶
func DeleteFavorites ¶
func DeleteFileRecord ¶
func DeleteFilesByMember ¶
func DeleteNode ¶
func DeleteNodeModerators ¶
func DeleteNotification ¶
func DeletePlane ¶
func DeleteSensitiveWord ¶
func DeleteSensitiveWord(word string)
func DeleteTopic ¶
func DeleteTopicHard ¶
func DeletedExpiredData ¶
func ExpireTopTopic ¶
func ExpireTopTopic() int
ExpireTopTopic searches and expires expired top topic.
func FilterUnsafeHTML ¶
func GetBrowseRecordNum ¶
func GetCreatedTopicsNum ¶
func GetDefaultTab ¶
func GetDefaultTab() string
func GetFavoritesCount ¶
func GetFavoritesCount() int
func GetFavoritesNum ¶
func GetFavoritesStatus ¶
func GetFilesNum ¶
func GetFollowingNum ¶
func GetForumVersion ¶
func GetForumVersion() string
func GetHighestOnlineNum ¶
func GetHighestOnlineNum() int
func GetLastRecordId ¶
func GetLastRecordId() int
func GetLatestSyncedRecordId ¶
func GetLatestSyncedRecordId() int
func GetMemberBalance ¶
func GetMemberCheckinDate ¶
func GetMemberEditorType ¶
func GetMemberEmailReminder ¶
GetMemberEmailReminder return member's email reminder status, and his email address.
func GetMemberFileQuota ¶
func GetMemberLanguage ¶
func GetMemberNum ¶
func GetMemberNum() int
func GetMemberRepliesNum ¶
GetMemberRepliesNum returns member's all replies num.
func GetMembersFromFavorites ¶
func GetNodeFavoritesNum ¶
func GetNodeModerators ¶
func GetNodeTopicNum ¶
func GetNodesNum ¶
func GetNodesNum() int
func GetNotificationCount ¶
func GetNotificationCount() int
func GetNotificationNum ¶
func GetOnlineMemberNum ¶
func GetOnlineMemberNum() int
GetOnlineMemberNum returns online member num.
func GetOnlineUserCount ¶
func GetOnlineUserCount() int
func GetPlaneNodesNum ¶
func GetRankingPlayer ¶
func GetRankingRich ¶
func GetReplyAuthor ¶
GetReplyAuthor only returns reply's topic author.
func GetReplyCount ¶
func GetReplyCount() int
GetReplyCount returns all replies num so far, both deleted and not deleted.
func GetReplyEditableStatus ¶
GetReplyEditableStatus checks whether the reply can be edited.
func GetReplyTopicTitle ¶
GetReplyTopicTitle only returns reply's topic title.
func GetSensitiveWords ¶
func GetSensitiveWords() []string
func GetThanksStatus ¶
func GetTopicAuthor ¶
func GetTopicCount ¶
func GetTopicCount() int
func GetTopicEditableStatus ¶
func GetTopicNodeId ¶
func GetTopicNum ¶
func GetTopicNum() int
func GetTopicReplyNum ¶
GetTopicReplyNum returns topic's reply num.
func GetTopicTitle ¶
func GetTranslator ¶
func GetTranslator(id string) *[]Translator
func GetUserByEmail ¶
func GetUserName ¶
func InitAdapter ¶
func InitAdapter()
func InitConfig ¶
func InitConfig()
func InitForumBasicInfo ¶
func InitForumBasicInfo()
func InitFrontConf ¶
func InitFrontConf()
func InitHttpClient ¶
func InitHttpClient()
func IsFavoritesExist ¶
func IsForbidden ¶
IsForbidden check member whether is forbidden.
func IsSensitiveWord ¶
func RemoveHtmlTags ¶
func ReplyDeletable ¶
ReplyDeletable checks whether the reply can be deleted.
func SyncAllNodeFromGoogleGroup ¶
func SyncAllNodeFromGoogleGroup()
func UpdateFileDescribe ¶
func UpdateFrontConf ¶
func UpdateHighestOnlineNum ¶
func UpdateHotNode ¶
func UpdateHotTopic ¶
func UpdateMemberCheckinDate ¶
func UpdateMemberEditorType ¶
func UpdateMemberLanguage ¶
func UpdateMemberOnlineStatus ¶
UpdateMemberOnlineStatus updates member's online information.
func UpdateNode ¶
func UpdateNodeHotInfo ¶
func UpdateOnlineMemberNum ¶
func UpdateOnlineMemberNum()
UpdateOnlineMemberNum updates online member num and updates highest online member num at the same time.
func UpdatePlane ¶
func UpdatePoster ¶
func UpdateReadStatus ¶
func UpdateReply ¶
UpdateReply updates reply's all field.
func UpdateReplyWithLimitCols ¶
UpdateReplyWithLimitCols updates reply's not null field.
func UpdateTopic ¶
func UpdateTopicHotInfo ¶
func UpdateTranslator ¶
func UpdateTranslator(translator Translator) bool
Types ¶
type AdminMemberInfo ¶
type AdminPlaneInfo ¶
type AdminPlaneInfo struct { Plane Sorter int `json:"sorter"` Visible bool `json:"visible"` NodesNum int `json:"nodesNum"` Nodes []*Node `json:"nodes"` }
func GetAllPlanes ¶
func GetAllPlanes() []*AdminPlaneInfo
func GetPlaneAdmin ¶
func GetPlaneAdmin(id string) *AdminPlaneInfo
type AdminTabInfo ¶
type AdminTabInfo struct { Id string `json:"id"` Name string `json:"name"` Sorter int `json:"sorter"` CreatedTime string `json:"createdTime"` DefaultNode string `json:"defaultNode"` HomePage bool `json:"homePage"` NodesNum int `json:"nodesNum"` TopicsNum int `json:"topicsNum"` }
func GetAllTabsAdmin ¶
func GetAllTabsAdmin() []*AdminTabInfo
func GetTabAdmin ¶
func GetTabAdmin(id string) *AdminTabInfo
GetTabAdmin returns more tab information for admin.
type AdminTopicInfo ¶
func GetTopicAdmin ¶
func GetTopicAdmin(id int) *AdminTopicInfo
func GetTopicsAdmin ¶
func GetTopicsAdmin(usernameSearchKw, titleSearchKw, contentSearchKw, showDeletedTopic, createdTimeSort, lastReplySort, usernameSort, replyCountSort, hotSort, favCountSort string, limit int, offset int) ([]*AdminTopicInfo, int)
GetTopicsAdmin *sort: 1 means Asc, 2 means Desc, 0 means no effect.
type BalanceResponse ¶
type BalanceResponse struct { Amount int `json:"amount"` Title string `json:"title"` Length int `json:"length"` Balance int `json:"balance"` ObjectId int `json:"objectId"` ReceiverId string `json:"receiverId"` ConsumerId string `json:"consumerId"` CreatedTime string `json:"createdTime"` ConsumptionType int `json:"consumptionType"` }
func GetMemberConsumptionRecord ¶
func GetMemberConsumptionRecord(id string, limit, offset int) []*BalanceResponse
type BrowseRecord ¶
type BrowseRecord struct { Id int `xorm:"int notnull pk autoincr" json:"id"` MemberId string `xorm:"varchar(100)" json:"memberId"` RecordType int `xorm:"int" json:"recordType"` ObjectId string `xorm:"varchar(100) index" json:"objectId"` CreatedTime string `xorm:"varchar(40) index" json:"createdTime"` Expired bool `xorm:"bool" json:"expired"` }
RecordType: 1 means node hit record
type CommunityHealth ¶
type ConsumptionRecord ¶
type ConsumptionRecord struct { Id int `xorm:"int notnull pk autoincr" json:"id"` Amount int `xorm:"int" json:"amount"` Balance int `xorm:"int" json:"balance"` ConsumerId string `xorm:"varchar(100) index" json:"consumerId"` ObjectId int `xorm:"int index" json:"objectId"` ReceiverId string `xorm:"varchar(100) index" json:"receiverId"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` ConsumptionType int `xorm:"int" json:"consumptionType"` }
ConsumptionType 1-9 means: login bonus, receive thanks(topic), receive thanks(reply), thanks(topic) thanks(reply), new reply, receive reply bonus, new topic, top topic.
func GetBalances ¶
func GetBalances() []*ConsumptionRecord
func GetMemberBalances ¶
func GetMemberBalances(id string, limit, offset int) []*ConsumptionRecord
type CronJob ¶
type CronJob struct { Id string `json:"id"` BumpTime string `json:"bumpTime"` State string `json:"state"` }
func GetCronJobs ¶
func GetCronJobs() []*CronJob
type Favorites ¶
type Favorites struct { Id int `xorm:"int notnull pk autoincr" json:"id"` FavoritesType string `xorm:"varchar(100) index" json:"favoritesType"` ObjectId string `xorm:"varchar(100) index" json:"objectId"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` MemberId string `xorm:"varchar(100) index" json:"memberId"` }
type FrontConf ¶
type FrontConf struct { Id string `xorm:"varchar(100) notnull pk"` Value string `xorm:"mediumtext"` Field string `xorm:"varchar(100)` }
func GetFrontConfByField ¶
func GetFrontConfById ¶
func GetFrontConfs ¶
func GetFrontConfs() []*FrontConf
type GoogleTranslationResult ¶
type GoogleTranslationResult struct { Data struct { Translations []struct { TranslatedText string `json:"translatedText"` DetectedSourceLanguage string `json:"detectedSourceLanguage"` } `json:"translations"` } `json:"data"` Error struct { Code int `json:"code"` Message string `json:"message"` Errors []struct { Message string `json:"message"` Domain string `json:"domain"` Reason string `json:"reason"` } `json:"errors"` } `json:"error"` }
type LatestReply ¶
type LatestReply struct { TopicId int `xorm:"id" json:"topicId"` NodeId string `json:"nodeId"` NodeName string `json:"nodeName"` Author string `json:"author"` ReplyContent string `xorm:"content" json:"replyContent"` TopicTitle string `xorm:"title" json:"topicTitle"` ReplyTime string `xorm:"created_time" json:"replyTime"` TopicAuthor string `xorm:"author" json:"topicAuthor"` }
func GetLatestReplies ¶
func GetLatestReplies(author string, limit int, offset int) []*LatestReply
GetLatestReplies returns member's latest replies.
type Node ¶
type Node struct { Id string `xorm:"varchar(100) notnull pk" json:"id"` Name string `xorm:"varchar(100)" json:"name"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` Desc string `xorm:"mediumtext" json:"desc"` Extra string `xorm:"mediumtext" json:"extra"` Image string `xorm:"varchar(200)" json:"image"` BackgroundImage string `xorm:"varchar(200)" json:"backgroundImage"` HeaderImage string `xorm:"varchar(200)" json:"headerImage"` BackgroundColor string `xorm:"varchar(20)" json:"backgroundColor"` BackgroundRepeat string `xorm:"varchar(20)" json:"backgroundRepeat"` TabId string `xorm:"varchar(100)" json:"tab"` ParentNode string `xorm:"varchar(200)" json:"parentNode"` PlaneId string `xorm:"varchar(50)" json:"planeId"` Sorter int `json:"sorter"` Ranking int `json:"ranking"` Hot int `json:"hot"` Moderators []string `xorm:"varchar(200)" json:"moderators"` MailingList string `xorm:"varchar(100)" json:"mailingList"` GoogleGroupCookie string `xorm:"varchar(1500)" json:"googleGroupCookie"` IsHidden bool `xorm:"bool" json:"isHidden"` }
func GetHotNode ¶
func GetLatestNode ¶
func GetNodeFromPlane ¶
func GetNodeFromTab ¶
func GetNodesByTab ¶
func (Node) AddTopicToMailingList ¶
func (Node) GetAllTopicTitlesOfNode ¶
func (Node) SyncFromGoogleGroup ¶
func (n Node) SyncFromGoogleGroup()
type NodeFavoritesRes ¶
func GetNodesFromFavorites ¶
func GetNodesFromFavorites(memberId string, limit int, offset int) []*NodeFavoritesRes
type NodeNavigationResponse ¶
type NodeNavigationResponse struct {}
func GetNodeNavigation ¶
func GetNodeNavigation() []*NodeNavigationResponse
type NodeRelation ¶
type NodeRelation struct { ParentNode *Node `json:"parentNode"` RelatedNode []*Node `json:"relatedNode"` ChildNode []*Node `json:"childNode"` }
func GetNodeRelation ¶
func GetNodeRelation(id string) *NodeRelation
type NodeTopic ¶
type Notification ¶
type Notification struct { Id int `xorm:"int notnull pk autoincr" json:"id"` NotificationType int `xorm:"int index" json:"notificationType"` ObjectId int `xorm:"int index" json:"objectId"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` SenderId string `xorm:"varchar(100)" json:"senderId"` ReceiverId string `xorm:"varchar(100) index" json:"receiverId"` Status int `xorm:"tinyint" json:"-"` }
NotificationType 1-6 means: reply(topic), mentioned(reply), mentioned(topic), favorite(topic), thanks(topic), thanks(reply) Status 1-3 means: unread, have read, deleted
type NotificationResponse ¶
type NotificationResponse struct { *Notification `xorm:"extends"` Title string `json:"title"` Content string `json:"content"` Avatar string `json:"avatar"` }
func GetNotifications ¶
func GetNotifications(memberId string, limit int, offset int) []*NotificationResponse
type Plane ¶
type Plane struct { Id string `xorm:"varchar(50) notnull pk" json:"id"` Name string `xorm:"varchar(50)" json:"name"` Sorter int `xorm:"int" json:"-"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` Image string `xorm:"varchar(200)" json:"image"` BackgroundColor string `xorm:"varchar(20)" json:"backgroundColor"` Color string `xorm:"varchar(20)" json:"color"` Visible bool `xorm:"bool" json:"-"` }
type PlaneWithNodes ¶
func GetPlaneList ¶
func GetPlaneList() []*PlaneWithNodes
type Poster ¶
type Reply ¶
type Reply struct { Id int `xorm:"int notnull pk autoincr" json:"id"` Author string `xorm:"varchar(100) index" json:"author"` TopicId int `xorm:"int index" json:"topicId"` ParentId int `xorm:"int" json:"parentId"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` Deleted bool `xorm:"bool" json:"deleted"` IsHidden bool `xorm:"bool" json:"isHidden"` ThanksNum int `xorm:"int" json:"thanksNum"` EditorType string `xorm:"varchar(40)" json:"editorType"` Content string `xorm:"mediumtext" json:"content"` Ip string `xorm:"varchar(100)" json:"ip"` State string `xorm:"varchar(100)" json:"state"` }
func GetLatestReplyInfo ¶
GetLatestReplyInfo returns topic's latest reply information.
func GetRepliesOfTopic ¶
func SearchReplies ¶
func (Reply) AddReplyToMailingList ¶
func (r Reply) AddReplyToMailingList()
type ReplyWithAvatar ¶
type ReplyWithAvatar struct { Reply `xorm:"extends"` Avatar string `json:"avatar"` ThanksStatus bool `json:"thanksStatus"` Deletable bool `json:"deletable"` Editable bool `json:"editable"` ConsumptionAmount int `xorm:"amount" json:"amount"` Child []*ReplyWithAvatar `json:"child"` }
func GetReplies ¶
@Title GetReplies @router /get-replies [get] @Description GetReplies returns more information about reply of a topic. @Tag Reply API
func GetRepliesFromFavorites ¶
func GetRepliesFromFavorites(memberId string, limit int, offset int, favoritesType string) []*ReplyWithAvatar
func GetReplyWithDetails ¶
func GetReplyWithDetails(user *auth.User, id int) *ReplyWithAvatar
GetReplyWithDetails returns more information about reply, including avatar, thanks status, deletable and editable.
type SensitiveWord ¶
type Tab ¶
type Tab struct { Id string `xorm:"varchar(100) notnull pk" json:"id"` Name string `xorm:"varchar(100)" json:"name"` Sorter int `json:"sorter"` Ranking int `json:"ranking"` CreatedTime string `xorm:"varchar(40)" json:"-"` DefaultNode string `xorm:"varchar(100)" json:"defaultNode"` HomePage bool `xorm:"bool" json:"-"` Desc string `xorm:"mediumtext" json:"desc"` Extra string `xorm:"mediumtext" json:"extra"` Moderators []string `xorm:"varchar(200)" json:"moderators"` }
func GetAllTabs ¶
func GetAllTabs() []*Tab
func GetHomePageTabs ¶
func GetHomePageTabs() []*Tab
type Topic ¶
type Topic struct { Id int `xorm:"int notnull pk autoincr" json:"id"` Author string `xorm:"varchar(100) index" json:"author"` NodeId string `xorm:"varchar(100) index" json:"nodeId"` NodeName string `xorm:"varchar(100)" json:"nodeName"` TabId string `xorm:"varchar(100) index" json:"tabId"` Title string `xorm:"varchar(300) index" json:"title"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` Tags []string `xorm:"varchar(200)" json:"tags"` ReplyCount int `json:"replyCount"` UpCount int `json:"upCount"` DownCount int `json:"downCount"` HitCount int `json:"hitCount"` Hot int `xorm:"index" json:"hot"` FavoriteCount int `json:"favoriteCount"` SubscribeCount int `json:"subscribeCount"` HomePageTopTime string `xorm:"varchar(40) index(IDX_topic_htt_lrt)" json:"homePageTopTime"` TabTopTime string `xorm:"varchar(40) index(IDX_topic_ttt_lrt)" json:"tabTopTime"` NodeTopTime string `xorm:"varchar(40) index(IDX_topic_ntt_lrt)" json:"nodeTopTime"` LastReplyUser string `xorm:"varchar(100)" json:"lastReplyUser"` LastReplyTime string `xorm:"varchar(40) index(IDX_topic_htt_lrt) index(IDX_topic_ttt_lrt) index(IDX_topic_ntt_lrt)" json:"lastReplyTime"` Deleted bool `xorm:"bool index" json:"-"` EditorType string `xorm:"varchar(40)" json:"editorType"` Content string `xorm:"mediumtext" json:"content"` UrlPath string `xorm:"varchar(100)" json:"urlPath"` IsHidden bool `xorm:"bool index" json:"isHidden"` Ip string `xorm:"varchar(100)" json:"ip"` State string `xorm:"varchar(100)" json:"state"` }
func GetAllCreatedTopics ¶
func GetAllTopics ¶
func GetAllTopics() []*Topic
func GetTopicBasicInfo ¶
func (Topic) GetAllRepliesOfTopic ¶
type TopicWithAvatar ¶
type TopicWithAvatar struct { Topic `xorm:"extends"` Avatar string `json:"avatar"` ThanksStatus bool `json:"thanksStatus"` Editable bool `json:"editable"` NodeModerator bool `json:"nodeModerator"` }
func GetFollowingNewAction ¶
func GetFollowingNewAction(memberId string, limit int, offset int) []*TopicWithAvatar
func GetHotTopic ¶
func GetHotTopic(limit int) []*TopicWithAvatar
func GetSortedTopics ¶
func GetSortedTopics(lastReplySort, hotSort, favCountSort, createdTimeSort string, limit int, offset int) []*TopicWithAvatar
GetSortedTopics *sort: 1 means Asc, 2 means Desc, 0 means no effect.
func GetTopicWithAvatar ¶
func GetTopicWithAvatar(id int, user *auth.User) *TopicWithAvatar
func GetTopics ¶
func GetTopics(limit int, offset int) []*TopicWithAvatar
func GetTopicsFromFavorites ¶
func GetTopicsFromFavorites(memberId string, limit int, offset int, favoritesType string) []*TopicWithAvatar
func GetTopicsWithTab ¶
func GetTopicsWithTab(tab string, limit, offset int) []*TopicWithAvatar
func SearchTopics ¶
func SearchTopics(keyword string) []*TopicWithAvatar
type TranslateData ¶
type TranslateData struct { SrcLang string `json:"srcLang"` Target string `json:"target"` ErrMsg string `json:"err_msg"` }
func StrTranslate ¶
func StrTranslate(srcStr, targetLang string) *TranslateData
type Translator ¶
type Translator struct { Id string `xorm:"varchar(50) notnull pk" json:"id"` Name string `xorm:"varchar(50)" json:"name"` Translator string `xorm:"varchar(50)" json:"translator"` Key string `xorm:"varchar(200)" json:"key"` Enable bool `xorm:"bool" json:"enable"` Visible bool `xorm:"bool" json:"visible"` }
func GetEnableTranslator ¶
func GetEnableTranslator() *Translator
type UpdateJob ¶
type UpdateJob struct { Id string `json:"id"` JobId string `json:"jobId"` State string `json:"state"` Url string `json:"url"` Content string `json:"content"` }
func GetCronUpdateJobs ¶
func GetCronUpdateJobs() []*UpdateJob
func GetUpdateJob ¶
func GetUpdateJobs ¶
type UpdateListItem ¶
type UploadFileRecord ¶
type UploadFileRecord struct { Id int `xorm:"int notnull pk autoincr" json:"id"` FileName string `xorm:"varchar(100)" json:"fileName"` FilePath string `xorm:"varchar(100)" json:"filePath"` FileUrl string `xorm:"varchar(100)" json:"fileUrl"` FileType string `xorm:"varchar(10)" json:"fileType"` FileExt string `xorm:"varchar(20)" json:"fileExt"` MemberId string `xorm:"varchar(100) index" json:"memberId"` CreatedTime string `xorm:"varchar(40)" json:"createdTime"` Size int `xorm:"int" json:"size"` Views int `xorm:"int" json:"views"` Desc string `xorm:"varchar(500)" json:"desc"` Deleted bool `xorm:"bool" json:"-"` }
func GetFile ¶
func GetFile(id int) *UploadFileRecord
func GetFiles ¶
func GetFiles(memberId string, limit, offset int) []*UploadFileRecord