object

package
v0.0.0-...-e56195f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPageNum             = 20
	DefaultHomePageNum         = 50
	DefaultTopicPageReplyNum   = 50
	DefaultNotificationPageNum = 10
	DefaultBalancePageNum      = 25
	DefaultFilePageNum         = 25
	DefaultMemberAdminPageNum  = 100
	UserNamingRestrictions     = true
	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
	UseOAuthProxy              = false
	DefaultUploadFileQuota     = 50
	Domain                     = "forum.casbin.com" // domain

	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:    "expireValidateCode",
			JobId: "expireData",
			State: "active",
		},
		{
			Id:    "expireTopTopic",
			JobId: "expireData",
			State: "active",
		},
		{
			Id:    "expireOnlineMember",
			JobId: "expireData",
			State: "active",
		},
	}
)

Functions

func AddBalance

func AddBalance(balance *ConsumptionRecord) bool

func AddBrowseRecordNum

func AddBrowseRecordNum(record *BrowseRecord) bool

func AddFavorites

func AddFavorites(favorite *Favorites) bool

func AddFileRecord

func AddFileRecord(record *UploadFileRecord) (bool, int)

func AddFileViewsNum

func AddFileViewsNum(id int) bool

func AddMember

func AddMember(member *Member) bool

func AddNewResetRecord

func AddNewResetRecord(resetInformation, memberId string, recordType int) (int, string)

AddValidateCode: return validate code

func AddNode

func AddNode(node *Node) bool

func AddNodeModerators

func AddNodeModerators(memberId, nodeId string) bool

func AddNotification

func AddNotification(notification *Notification) bool

func AddPlane

func AddPlane(plane *Plane) bool

func AddReply

func AddReply(reply *Reply) (bool, int)

AddReply returns add reply result and reply id.

func AddReplyNotification

func AddReplyNotification(senderId, content string, objectId, topicId int)

func AddReplyThanksNum

func AddReplyThanksNum(id int) bool

AddReplyThanksNum updates reply's thanks num.

func AddSensitiveWord

func AddSensitiveWord(word string)

func AddTab

func AddTab(tab *Tab) bool

func AddTopic

func AddTopic(topic *Topic) (bool, int)

AddTopic return add topic result and topic id

func AddTopicHitCount

func AddTopicHitCount(topicId int) bool

func AddTopicNotification

func AddTopicNotification(objectId int, author, content string)

func ChangeExpiredDataStatus

func ChangeExpiredDataStatus(recordType int, date string) int

func ChangeMemberEmailReminder

func ChangeMemberEmailReminder(id, status string) bool

ChangeMemberEmailReminder change member's email reminder status

func ChangeTopicFavoriteCount

func ChangeTopicFavoriteCount(topicId int, num int) bool

func ChangeTopicLastReplyUser

func ChangeTopicLastReplyUser(topicId int, memberId string, updateTime string) bool

func ChangeTopicReplyCount

func ChangeTopicReplyCount(topicId int, num int) bool

func ChangeTopicTopExpiredTime

func ChangeTopicTopExpiredTime(id int, date, topType string) bool

ChangeTopicTopExpiredTime changes topic's top expired time. topType: tab, node or homePage.

func CheckMemberLogin

func CheckMemberLogin(information, password string) (string, string)

CheckMemberLogin needs password, and information, which could be username, phone number or email.

func CheckMemberSignup

func CheckMemberSignup(member string, password string) string

func CheckMemberSignupWithEmail

func CheckMemberSignupWithEmail(member string, email string) string

func CheckMemberSignupWithPhone

func CheckMemberSignupWithPhone(member string, phoneNumber string) string

func CheckMemberSignupWithQQ

func CheckMemberSignupWithQQ(member string, qqOpenId string) string

func CheckMemberSignupWithWeChat

func CheckMemberSignupWithWeChat(member string, wechatOpenId string) string

func CheckModIdentity

func CheckModIdentity(memberId string) bool

func CheckNodeModerator

func CheckNodeModerator(memberId, nodeId string) bool

func CheckResetCodeExpired

func CheckResetCodeExpired(id string) bool

func CheckValidateCodeExpired

func CheckValidateCodeExpired(id string) bool

CheckValidateCodeExpired checks whether the verification code has expired.

func ContainsSensitiveWord

func ContainsSensitiveWord(str string) bool

func CreateReplyConsumption

func CreateReplyConsumption(consumerId string, id int) bool

func CreateTopicConsumption

func CreateTopicConsumption(consumerId string, id int) bool

func DeleteFavorites

func DeleteFavorites(memberId string, objectId string, favoritesType int) bool

func DeleteFileRecord

func DeleteFileRecord(id int) bool

func DeleteMember

func DeleteMember(id string) bool

DeleteMember change this function to update member status.

func DeleteNode

func DeleteNode(id string) bool

func DeleteNodeModerators

func DeleteNodeModerators(memberId, nodeId string) bool

func DeleteNotification

func DeleteNotification(id string) bool

func DeletePlane

func DeletePlane(id string) bool

func DeleteReply

func DeleteReply(id int) bool

DeleteReply soft delete reply.

func DeleteSensitiveWord

func DeleteSensitiveWord(word string)

func DeleteTab

func DeleteTab(id string) bool

func DeleteTopic

func DeleteTopic(id int) bool

func DeletedExpiredData

func DeletedExpiredData(recordType int, date string) bool

func ExpireResetRecord

func ExpireResetRecord(date string) int

func ExpireTopTopic

func ExpireTopTopic() int

ExpireTopTopic searches and expires expired top topic.

func ExpireValidateCode

func ExpireValidateCode(date string) int

ExpireValidateCode expires validate code according to date, return effects num.

func ExpiredMemberOnlineStatus

func ExpiredMemberOnlineStatus(date string) int

func FileEditable

func FileEditable(memberId, author string) bool

func GetBrowseRecordNum

func GetBrowseRecordNum(recordType int, objectId string) int

func GetCaptcha

func GetCaptcha() (string, []byte)

func GetConsumptionRecordCount

func GetConsumptionRecordCount() int

func GetCreatedTopicsNum

func GetCreatedTopicsNum(memberId string) int

func GetDefaultTab

func GetDefaultTab() string

func GetFavoritesCount

func GetFavoritesCount() int

func GetFavoritesNum

func GetFavoritesNum(favoritesType int, memberId string) int

func GetFavoritesStatus

func GetFavoritesStatus(memberId string, objectId string, favoritesType int) bool

func GetFilesNum

func GetFilesNum(memberId string) int

func GetFollowingNum

func GetFollowingNum(id string) int

func GetForumVersion

func GetForumVersion() string

func GetHighestOnlineNum

func GetHighestOnlineNum() int

func GetLastRecordId

func GetLastRecordId() int

func GetLatestSyncedRecordId

func GetLatestSyncedRecordId() int

func GetMemberAvatar

func GetMemberAvatar(id string) string

func GetMemberBalance

func GetMemberBalance(id string) int

func GetMemberCheckinDate

func GetMemberCheckinDate(id string) string

func GetMemberConsumptionRecordNum

func GetMemberConsumptionRecordNum(memberId string) int

func GetMemberEditorType

func GetMemberEditorType(id string) string

func GetMemberEmailReminder

func GetMemberEmailReminder(id string) (bool, string)

GetMemberEmailReminder return member's email reminder status, and his email adress.

func GetMemberFileQuota

func GetMemberFileQuota(memberId string) int

func GetMemberLanguage

func GetMemberLanguage(id string) string

func GetMemberMail

func GetMemberMail(id string) string

GetMemberMail return member's email.

func GetMemberNum

func GetMemberNum() int

func GetMemberOnlineNum

func GetMemberOnlineNum() int

func GetMemberRepliesNum

func GetMemberRepliesNum(memberId string) int

GetMemberRepliesNum returns member's all replies num.

func GetMemberResetFrequency

func GetMemberResetFrequency(memberId, date string) int

func GetMemberStatus

func GetMemberStatus(id string) int

GetMemberStatus returns member's account status, default 3(forbidden).

func GetNewValidateCode

func GetNewValidateCode(information string) (string, string)

AddValidateCode: return validate code and validate code ID

func GetNodeFavoritesNum

func GetNodeFavoritesNum(id string) int

func GetNodeModerators

func GetNodeModerators(id string) []string

func GetNodeTopicNum

func GetNodeTopicNum(id string) int

func GetNodesNum

func GetNodesNum() int

func GetNotificationCount

func GetNotificationCount() int

func GetNotificationNum

func GetNotificationNum(memberId string) int

func GetOnlineMemberNum

func GetOnlineMemberNum() int

GetOnlineMemberNum returns online member num.

func GetPlaneNodesNum

func GetPlaneNodesNum(id string) int

func GetReplyAuthor

func GetReplyAuthor(id int) string

GetReplyAuthor only returns reply's topic author.

func GetReplyBonus

func GetReplyBonus(author, consumerId string, id int)

func GetReplyCount

func GetReplyCount() int

GetReplyCount returns all replies num so far, both deleted and not deleted.

func GetReplyEditableStatus

func GetReplyEditableStatus(member, author, createdTime string) bool

GetReplyEditableStatus checks whether the reply can be edited.

func GetReplyTopicTitle

func GetReplyTopicTitle(id int) string

GetReplyTopicTitle only returns reply's topic title.

func GetSensitiveWords

func GetSensitiveWords() []string

func GetThanksStatus

func GetThanksStatus(memberId string, id, recordType int) bool

func GetTopicAuthor

func GetTopicAuthor(id int) string

func GetTopicCount

func GetTopicCount() int

func GetTopicEditableStatus

func GetTopicEditableStatus(member, author, nodeId, createdTime string) bool

func GetTopicNodeId

func GetTopicNodeId(id int) string

func GetTopicNum

func GetTopicNum() int

func GetTopicReplyNum

func GetTopicReplyNum(topicId int) int

GetTopicReplyNum returns topic's reply num.

func GetTopicTitle

func GetTopicTitle(id int) string

func GetUnreadNotificationNum

func GetUnreadNotificationNum(memberId string) int

func HasGithubAccount

func HasGithubAccount(githubAccount string) string

func HasGoogleAccount

func HasGoogleAccount(googleAccount string) string

func HasMail

func HasMail(email string) string

func HasMember

func HasMember(memberId string) bool

func HasNode

func HasNode(id string) bool

func HasPhone

func HasPhone(phoneNumber string) string

func HasPlane

func HasPlane(id string) bool

func HasQQAccount

func HasQQAccount(qqOpenId string) string

func HasTab

func HasTab(id string) bool

func HasWeChatAccount

func HasWeChatAccount(wechatOpenId string) string

func InitAdapter

func InitAdapter()

func InitForumBasicInfo

func InitForumBasicInfo()

func InitTimer

func InitTimer()

InitTimer initializes scheduled tasks.

func IsForbidden

func IsForbidden(id string) bool

IsForbidden check member whether is forbidden.

func IsMuted

func IsMuted(id string) bool

IsMuted check member whether is muted.

func IsPasswordCorrect

func IsPasswordCorrect(memberId string, password string) bool

func IsSensitiveWord

func IsSensitiveWord(word string) bool

func LinkMemberAccount

func LinkMemberAccount(memberId, field, value string) bool

func MemberPasswordLogin

func MemberPasswordLogin(information, password string) string

MemberPasswordLogin needs information and password to check member login. Information could be phone member, email or username. If success, return username.

func ReplyDeletable

func ReplyDeletable(date, memberId, author string) bool

ReplyDeletable checks whether the reply can be deleted.

func TopTopicConsumption

func TopTopicConsumption(consumerId string, id int) bool

func UpdateFileDescribe

func UpdateFileDescribe(id int, fileName, desc string) bool

func UpdateHighestOnlineNum

func UpdateHighestOnlineNum(num int) bool

func UpdateHotNode

func UpdateHotNode(last int) int

func UpdateHotTopic

func UpdateHotTopic(last int) int

func UpdateLatestSyncedRecordId

func UpdateLatestSyncedRecordId(id int) bool

func UpdateMember

func UpdateMember(id string, member *Member) bool

UpdateMember could update member's file quota and account status.

func UpdateMemberAvatar

func UpdateMemberAvatar(id string, avatar string) bool

func UpdateMemberBalances

func UpdateMemberBalances(id string, amount int) bool

func UpdateMemberCheckinDate

func UpdateMemberCheckinDate(id, date string) bool

func UpdateMemberEditorType

func UpdateMemberEditorType(id string, editorType string) bool

func UpdateMemberInfo

func UpdateMemberInfo(id string, member *Member) bool

func UpdateMemberLanguage

func UpdateMemberLanguage(id string, language string) bool

func UpdateMemberOnlineStatus

func UpdateMemberOnlineStatus(id string, onlineStatus bool, lastActionDate string) bool

UpdateMemberOnlineStatus updates member's online information.

func UpdateMemberPassword

func UpdateMemberPassword(id, password string) bool

func UpdateNode

func UpdateNode(id string, node *Node) bool

func UpdateNodeHotInfo

func UpdateNodeHotInfo(nodeId string, hot int) bool

func UpdateOnlineMemberNum

func UpdateOnlineMemberNum()

UpdateOnlineMemberNum updates online member num and updates highest online member num at the same time.

func UpdatePlane

func UpdatePlane(id string, plane *Plane) bool

func UpdateReadStatus

func UpdateReadStatus(id string) bool

func UpdateReply

func UpdateReply(id int, reply *Reply) bool

UpdateReply updates reply's all field.

func UpdateReplyWithLimitCols

func UpdateReplyWithLimitCols(id int, reply *Reply) bool

UpdateReplyWithLimitCols updates reply's not null field.

func UpdateTab

func UpdateTab(id string, tab *Tab) bool

func UpdateTopic

func UpdateTopic(id int, topic *Topic) bool

func UpdateTopicHotInfo

func UpdateTopicHotInfo(topicId string, hot int) bool

func UpdateTopicWithLimitCols

func UpdateTopicWithLimitCols(id int, topic *Topic) bool

func VerifyCaptcha

func VerifyCaptcha(id, digits string) bool

func VerifyResetInformation

func VerifyResetInformation(id, validateCode, memberId string, recordType int) bool

func VerifyValidateCode

func VerifyValidateCode(id, validateCode, information string) bool

VerifyValidateCode verifies validate code.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter represents the MySQL adapter for policy storage.

func NewAdapter

func NewAdapter(driverName string, dataSourceName string) *Adapter

NewAdapter is the constructor for Adapter.

type AdminMemberInfo

type AdminMemberInfo struct {
	Member
	FileQuota     int    `json:"fileQuota"`
	FileUploadNum int    `json:"fileUploadNum"`
	Status        int    `json:"status"`
	TopicNum      int    `json:"topicNum"`
	ReplyNum      int    `json:"replyNum"`
	LatestLogin   string `json:"latestLogin"`
}

func GetMemberAdmin

func GetMemberAdmin(id string) *AdminMemberInfo

func GetMembersAdmin

func GetMembersAdmin(cs, us, un string, limit int, offset int) ([]*AdminMemberInfo, int)

GetMembersAdmin cs, us: 1 means Asc, 2 means Desc, 0 means no effect.

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

type AdminTopicInfo struct {
	Topic
	Deleted bool `json:"deleted"`
}

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 BasicInfo

type BasicInfo struct {
	Id    string `xorm:"varchar(100) notnull pk"`
	Value string `xorm:"mediumtext"`
}

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 CasbinSensitiveWord

type CasbinSensitiveWord struct {
	Word string `xorm:"varchar(64) notnull"`
	Id   int64
}

type CommunityHealth

type CommunityHealth struct {
	Member int `json:"member"`
	Topic  int `json:"topic"`
	Reply  int `json:"reply"`
}

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

func GetJobs

func GetJobs() []*CronJob

type Favorites

type Favorites struct {
	Id            int    `xorm:"int notnull pk autoincr" json:"id"`
	FavoritesType int    `xorm:"int 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"`
}

Favorites using figure 1-3 to choose type, 1 means topic, 2 means people, 3 means node.

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"`
}

func GetLatestReplies

func GetLatestReplies(author string, limit int, offset int) []*LatestReply

GetLatestReplies returns member's latest replies.

type Member

type Member struct {
	Id                 string `xorm:"varchar(100) notnull pk" json:"id"`
	Password           string `xorm:"varchar(100) notnull" json:"-"`
	No                 int    `json:"no"`
	IsModerator        bool   `xorm:"bool" json:"isModerator"`
	CreatedTime        string `xorm:"varchar(40)" json:"createdTime"`
	Phone              string `xorm:"varchar(100)" json:"phone"`
	AreaCode           string `xorm:"varchar(10)" json:"areaCode"` // phone area code
	PhoneVerifiedTime  string `xorm:"varchar(40)" json:"phoneVerifiedTime"`
	Avatar             string `xorm:"varchar(150)" json:"avatar"`
	Email              string `xorm:"varchar(100)" json:"email"`
	EmailVerifiedTime  string `xorm:"varchar(40)" json:"emailVerifiedTime"`
	Tagline            string `xorm:"varchar(100)" json:"tagline"`
	Company            string `xorm:"varchar(100)" json:"company"`
	CompanyTitle       string `xorm:"varchar(100)" json:"companyTitle"`
	Ranking            int    `json:"ranking"`
	ScoreCount         int    `json:"scoreCount"`
	Bio                string `xorm:"varchar(100)" json:"bio"`
	Website            string `xorm:"varchar(100)" json:"website"`
	Location           string `xorm:"varchar(100)" json:"location"`
	Language           string `xorm:"varchar(10)"  json:"language"`
	EditorType         string `xorm:"varchar(10)"  json:"editorType"`
	FileQuota          int    `xorm:"int" json:"fileQuota"`
	GoogleAccount      string `xorm:"varchar(100)" json:"googleAccount"`
	GithubAccount      string `xorm:"varchar(100)" json:"githubAccount"`
	WechatAccount      string `xorm:"varchar(100)" json:"weChatAccount"`
	WechatOpenId       string `xorm:"varchar(100)" json:"-"`
	WechatVerifiedTime string `xorm:"varchar(40)" json:"WechatVerifiedTime"`
	QQAccount          string `xorm:"qq_account varchar(100)" json:"qqAccount"`
	QQOpenId           string `xorm:"qq_open_id varchar(100)" json:"-"`
	QQVerifiedTime     string `xorm:"qq_verified_time varchar(40)" json:"qqVerifiedTime"`
	EmailReminder      bool   `xorm:"bool" json:"emailReminder"`
	CheckinDate        string `xorm:"varchar(20)" json:"-"`
	OnlineStatus       bool   `xorm:"bool" json:"onlineStatus"`
	LastActionDate     string `xorm:"varchar(40)" json:"-"`
	Status             int    `xorm:"int" json:"-"`
}

Member using figure 1-3 to show member's account status, 1 means normal, 2 means mute(couldn't reply or post new topic), 3 means forbidden(couldn't login).

func GetGithubAccount

func GetGithubAccount(githubAccount string) *Member

func GetGoogleAccount

func GetGoogleAccount(googleAccount string) *Member

func GetMail

func GetMail(email string) *Member

func GetMember

func GetMember(id string) *Member

func GetMembers

func GetMembers() []*Member

func GetPhoneNumber

func GetPhoneNumber(phoneNumber string) *Member

func GetQQAccount

func GetQQAccount(qqOpenId string) *Member

func GetRankingRich

func GetRankingRich() []*Member

func GetWechatAccount

func GetWechatAccount(wechatOpenId string) *Member

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:"varchar(500)" json:"desc"`
	Image            string   `xorm:"varchar(200)" json:"image"`
	BackgroundImage  string   `xorm:"varchar(200)" json:"backgroundImage"`
	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      `xorm:"int" json:"sorter"`
	Hot              int      `xorm:"int" json:"hot"`
	Moderators       []string `xorm:"varchar(200)" json:"moderators"`
}

func GetHotNode

func GetHotNode(limit int) []*Node

func GetLatestNode

func GetLatestNode(limit int) []*Node

func GetNode

func GetNode(id string) *Node

func GetNodeFromPlane

func GetNodeFromPlane(plane string) []*Node

func GetNodeFromTab

func GetNodeFromTab(tab string) []*Node

func GetNodes

func GetNodes() []*Node

func GetNodesByTab

func GetNodesByTab(id string) []*Node

type NodeFavoritesRes

type NodeFavoritesRes struct {
	NodeInfo *Node `json:"nodeInfo"`
	TopicNum int   `json:"topicNum"`
}

func GetNodesFromFavorites

func GetNodesFromFavorites(memberId string, limit int, offset int) []*NodeFavoritesRes

type NodeNavigationResponse

type NodeNavigationResponse struct {
	*Tab
	Nodes []*Node `json:"nodes"`
}

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 NodeTopic struct {
	Topic         `xorm:"extends"`
	Avatar        string `json:"avatar"`
	ThanksStatus  bool   `json:"thanksStatus"`
	Editable      bool   `json:"editable"`
	NodeModerator bool   `json:"nodeModerator"`
	ContentLength int    `json:"contentLength"`
}

func GetTopicsWithNode

func GetTopicsWithNode(nodeId string, limit int, offset int) []*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:"-"`
}

func GetPlane

func GetPlane(id string) *Plane

func GetPlanes

func GetPlanes() []*Plane

type PlaneWithNodes

type PlaneWithNodes struct {
	*Plane
	Nodes []*Node `json:"nodes"`
}

func GetPlaneList

func GetPlaneList() []*PlaneWithNodes

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"`
	CreatedTime string `xorm:"varchar(40)" json:"createdTime"`
	Deleted     bool   `xorm:"bool" json:"-"`
	ThanksNum   int    `xorm:"int" json:"thanksNum"`
	EditorType  string `xorm:"varchar(40)" json:"editorType"`
	Content     string `xorm:"mediumtext" json:"content"`
}

func GetLatestReplyInfo

func GetLatestReplyInfo(topicId int) *Reply

GetLatestReplyInfo returns topic's latest reply information.

func GetReply

func GetReply(id int) *Reply

GetReply returns a single reply.

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"`
}

func GetReplies

func GetReplies(topicId int, memberId string, limit int, offset int) []*ReplyWithAvatar

GetReplies returns more information about reply of a topic.

func GetReplyWithDetails

func GetReplyWithDetails(memberId string, id int) *ReplyWithAvatar

GetReplyWithDetails returns more information about reply, including avatar, thanks status, deletable and editable.

type ResetRecord

type ResetRecord struct {
	Id               int    `xorm:"int notnull pk autoincr" json:"id"`
	MemberId         string `xorm:"varchar(100) index" json:"memberId"`
	RecordType       int    `xorm:"int" json:"recordType"`
	ResetInformation string `xorm:"varchar(100)" json:"resetInformation"`
	CreatedTime      string `xorm:"varchar(40)" json:"createdTime"`
	Expired          bool   `xorm:"bool" json:"expired"`
	ValidateCode     string `xorm:"varchar(100)" json:"validateCode"`
}

RecordType: 1 means phone, 2 means email, resetInformation means phone number or email.

type Session

type Session struct {
	SessionKey    string  `xorm:"char(64) notnull pk"`
	SessionData   []uint8 `xorm:"blob"`
	SessionExpiry int     `xorm:"notnull"`
}

type Tab

type Tab struct {
	Id          string `xorm:"varchar(100) notnull pk" json:"id"`
	Name        string `xorm:"varchar(100)" json:"name"`
	Sorter      int    `xorm:"int" json:"-"`
	CreatedTime string `xorm:"varchar(40)" json:"-"`
	DefaultNode string `xorm:"varchar(100)" json:"defaultNode"`
	HomePage    bool   `xorm:"bool" json:"-"`
}

func GetAllTabs

func GetAllTabs() []*Tab

func GetHomePageTabs

func GetHomePageTabs() []*Tab

func GetTab

func GetTab(id string) *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"`
	Title           string   `xorm:"varchar(100)" json:"title"`
	CreatedTime     string   `xorm:"varchar(40)" json:"createdTime"`
	Tags            []string `xorm:"varchar(200)" json:"tags"`
	LastReplyUser   string   `xorm:"varchar(100)" json:"lastReplyUser"`
	LastReplyTime   string   `xorm:"varchar(40)" json:"lastReplyTime"`
	ReplyCount      int      `json:"replyCount"`
	UpCount         int      `json:"upCount"`
	HitCount        int      `json:"hitCount"`
	Hot             int      `json:"hot"`
	FavoriteCount   int      `json:"favoriteCount"`
	HomePageTopTime string   `xorm:"varchar(40)" json:"homePageTopTime"`
	TabTopTime      string   `xorm:"varchar(40)" json:"tabTopTime"`
	NodeTopTime     string   `xorm:"varchar(40)" json:"nodeTopTime"`
	Deleted         bool     `xorm:"bool" json:"-"`
	EditorType      string   `xorm:"varchar(40)" json:"editorType"`
	Content         string   `xorm:"mediumtext" json:"content"`
}

func GetAllCreatedTopics

func GetAllCreatedTopics(author string, tab string, limit int, offset int) []*Topic

func GetTopic

func GetTopic(id int) *Topic

func GetTopicBasicInfo

func GetTopicBasicInfo(id int) *Topic

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 GetTopicWithAvatar

func GetTopicWithAvatar(id int, memberId string) *TopicWithAvatar

func GetTopics

func GetTopics(limit int, offset int) []*TopicWithAvatar

func GetTopicsFromFavorites

func GetTopicsFromFavorites(memberId string, limit int, offset int) []*TopicWithAvatar

func GetTopicsWithTab

func GetTopicsWithTab(tab string, limit, offset int) []*TopicWithAvatar

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 GetUpdateJob(id string) *UpdateJob

func GetUpdateJobs

func GetUpdateJobs(jobId string) []*UpdateJob

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

type ValidateCode

type ValidateCode struct {
	Id          string `xorm:"varchar(100) notnull pk" json:"id"`
	Code        string `xorm:"varchar(100)" json:"code"`
	Information string `xorm:"varchar(100)" json:"information"`
	CreatedTime string `xorm:"varchar(40)" json:"createdTime"`
	Expired     bool   `xorm:"bool" json:"expired"`
}

ValidateCode table records validate code, for sign up, sign in or reset password using phone or email.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL