service

package
v0.0.0-...-32bdbe6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

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

func (*Asset) Create

func (a *Asset) Create(uuid, cosPath string) (asset *model.Asset)

func (*Asset) QueryByUuid

func (a *Asset) QueryByUuid(uuid string) (asset *model.Asset)

type AssetService

type AssetService interface {
	Create(uuid, cosPath string) (asset *model.Asset)
	QueryByUuid(uuid string) (asset *model.Asset)
}

func NewAsset

func NewAsset(xorm *xorm.Engine) AssetService

type GoogleMail

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

func (*GoogleMail) SendVerificationCode

func (m *GoogleMail) SendVerificationCode(mailTo, code string, expired uint) bool

type Group

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

func (*Group) AddUser

func (g *Group) AddUser(group *model.Group, userID string) bool

func (*Group) Create

func (g *Group) Create(name, description, userID, logo, bgLogo string, isPrivate bool) (group *model.Group)

func (*Group) FindByGroupID

func (g *Group) FindByGroupID(groupID string) *model.Group

func (*Group) HasUser

func (g *Group) HasUser(group *model.Group, userID string) bool

func (*Group) QueryGroupByName

func (g *Group) QueryGroupByName(name string) (group *model.Group)

func (*Group) QueryUserGroups

func (g *Group) QueryUserGroups(user *model.User) (groups []*model.Group)

type GroupService

type GroupService interface {
	FindByGroupID(groupID string) (group *model.Group)
	HasUser(group *model.Group, userID string) bool
	Create(name, description, userID, logo, bgLogo string, isPrivate bool) (group *model.Group)
	QueryGroupByName(name string) (group *model.Group)
	AddUser(group *model.Group, userID string) bool
	QueryUserGroups(user *model.User) (groups []*model.Group)
}

func NewGroup

func NewGroup(xorm *xorm.Engine) GroupService

type MailService

type MailService interface {
	SendVerificationCode(mailTo, code string, expired uint) bool
}

func NewGoogleMail

func NewGoogleMail() MailService

type Point

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

func (*Point) AddPoints

func (p *Point) AddPoints(userId, invitedBy string, bonusPoints uint64) (isValidInvite bool)

func (*Point) DeletePoints

func (p *Point) DeletePoints(userId string)

func (*Point) ExchangePoints

func (p *Point) ExchangePoints(privateKey, userId string, bonusPoints uint64) bool

func (*Point) GetUserLeaderboard

func (p *Point) GetUserLeaderboard() []*model.Point

func (*Point) GetUserPoints

func (p *Point) GetUserPoints(userId string) *model.Point

func (*Point) UpdatePoints

func (p *Point) UpdatePoints(userId string, bonusPoints uint64)

type PointService

type PointService interface {
	AddPoints(userId, invitedBy string, bonusPoints uint64) bool
	UpdatePoints(userId string, bonusPoints uint64)
	DeletePoints(userId string)
	GetUserPoints(userId string) *model.Point
	// 获取用户排行榜,按积分降序排列
	GetUserLeaderboard() []*model.Point
	ExchangePoints(privateKey, userId string, bonusPoints uint64) bool
}

func NewPoint

func NewPoint(xorm *xorm.Engine) PointService

type Post

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

func (*Post) Comment

func (p *Post) Comment(post *model.Post, content, creator string) (comment *model.Comment)

Comment reply post

func (*Post) CommentLike

func (p *Post) CommentLike(comment *model.Comment, user *model.User)

func (*Post) Create

func (p *Post) Create(title, content, creator string, images, topics []string, group *model.Group) (post *model.Post)

func (*Post) Edit

func (p *Post) Edit(post *model.Post, title, content string, images, topics []string)

func (*Post) IsCommentLiked

func (p *Post) IsCommentLiked(comment *model.Comment, user *model.User) bool

func (*Post) IsLiked

func (p *Post) IsLiked(post *model.Post, user *model.User) bool

func (*Post) IsShared

func (p *Post) IsShared(post *model.Post, user *model.User) bool

func (*Post) Like

func (p *Post) Like(post *model.Post, user *model.User)

func (*Post) Posts

func (p *Post) Posts(userID string, cond builder.Cond, orderBy string, size int) (posts []*model.Post, nextID string)

func (*Post) QueryCommentByUuid

func (p *Post) QueryCommentByUuid(uuid string) (comment *model.Comment)

func (*Post) QueryComments

func (p *Post) QueryComments(post *model.Post, currentComment *model.Comment, size int) (comments []*model.Comment, nextID string)

func (*Post) QueryPostByUuid

func (p *Post) QueryPostByUuid(uuid string) (post *model.Post)

func (*Post) QueryPostGroupMap

func (p *Post) QueryPostGroupMap(posts []*model.Post) (groups map[string]*model.Group)

func (*Post) QueryReplies

func (p *Post) QueryReplies(post *model.Post, comments []*model.Comment) (replies map[string][]*model.Comment)

填充每个评论的子评论

func (*Post) QueryUserCommentLikes

func (p *Post) QueryUserCommentLikes(user *model.User, commentIDList []string) (likes map[string]bool)

func (*Post) QueryUserPostLikes

func (p *Post) QueryUserPostLikes(user *model.User, postUuidList []string) (likes map[string]bool)

查询帖子列表中,当前用户点赞的情况

func (*Post) QueryUserPostShares

func (p *Post) QueryUserPostShares(user *model.User, postUuidList []string) (shares map[string]bool)

func (*Post) Reply

func (p *Post) Reply(post *model.Post, parentComment *model.Comment, content, creator string) (comment *model.Comment)

Reply reply comment only support 2-level commenting and do not support multi-level nested comments.

func (*Post) Share

func (p *Post) Share(post *model.Post, user *model.User)

func (*Post) View

func (p *Post) View(post *model.Post)

type PostService

type PostService interface {
	Create(title, content, creator string, images, topics []string, group *model.Group) (post *model.Post)
	Edit(post *model.Post, title, content string, images, topics []string)
	QueryPostByUuid(uuid string) (post *model.Post)
	QueryCommentByUuid(uuid string) (comment *model.Comment)
	Comment(post *model.Post, content, creator string) (comment *model.Comment)
	Reply(post *model.Post, parentComment *model.Comment, content, creator string) (comment *model.Comment)
	Posts(userID string, cond builder.Cond, orderBy string, size int) (posts []*model.Post, nextID string)
	QueryComments(post *model.Post, currentComment *model.Comment, size int) (comments []*model.Comment, nextID string)
	QueryReplies(post *model.Post, comments []*model.Comment) (replies map[string][]*model.Comment)
	QueryPostGroupMap(posts []*model.Post) (groups map[string]*model.Group)
	Like(post *model.Post, user *model.User)
	View(post *model.Post)
	Share(post *model.Post, user *model.User)
	IsLiked(post *model.Post, user *model.User) bool
	IsShared(post *model.Post, user *model.User) bool
	QueryUserPostLikes(user *model.User, postUuidList []string) map[string]bool
	QueryUserPostShares(user *model.User, postUuidList []string) map[string]bool
	QueryUserCommentLikes(user *model.User, commentIDList []string) (likes map[string]bool)
	CommentLike(comment *model.Comment, user *model.User)
	IsCommentLiked(comment *model.Comment, user *model.User) bool
}

func NewPost

func NewPost(xorm *xorm.Engine) PostService

type SigNonce

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

func (*SigNonce) CreateNonce

func (s *SigNonce) CreateNonce(ethAddress string) (nonce string, err error)

func (*SigNonce) FindSigNonceByEthAddress

func (s *SigNonce) FindSigNonceByEthAddress(ethAddress string) *model.SigNonce

func (*SigNonce) ReGenerate

func (s *SigNonce) ReGenerate(sigNonce *model.SigNonce) string

func (*SigNonce) UseNonce

func (s *SigNonce) UseNonce(sigNonce *model.SigNonce) bool

type SigNonceService

type SigNonceService interface {
	CreateNonce(ethAddress string) (nonce string, err error)
	FindSigNonceByEthAddress(ethAddress string) *model.SigNonce
	ReGenerate(sigNonce *model.SigNonce) string
	UseNonce(sigNonce *model.SigNonce) bool
}

func NewNonce

func NewNonce(xorm *xorm.Engine) SigNonceService

type Topic

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

func (*Topic) Create

func (t *Topic) Create(name string) (topic *model.Topic)

type TopicService

type TopicService interface {
	Create(name string) *model.Topic
}

func NewTopic

func NewTopic(xorm *xorm.Engine) TopicService

type User

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

func (*User) EditUser

func (u *User) EditUser(user *model.User) bool

func (*User) FindUserByEmail

func (u *User) FindUserByEmail(email string) (user *model.User)

func (*User) FindUserByEthAddress

func (u *User) FindUserByEthAddress(ethAddress string) (user *model.User)

func (*User) FindUserByUuid

func (u *User) FindUserByUuid(uuid string) (user *model.User)

func (*User) FindUsersByUuid

func (u *User) FindUsersByUuid(uuids []string) (users []*model.User)

func (*User) FollowUser

func (u *User) FollowUser(user *model.User, follower *model.User) bool

FollowUser 关注用户

func (*User) IsFollowed

func (u *User) IsFollowed(user, queryUser *model.User) bool

func (*User) IsFollower

func (u *User) IsFollower(user, queryUser *model.User) bool

func (*User) QueryFollowedUsers

func (u *User) QueryFollowedUsers(uuid string) (users []*model.User)

QueryFollowedUsers 被关注列表

func (*User) QueryFollowerUsers

func (u *User) QueryFollowerUsers(uuid string) (users []*model.User)

QueryFollowerUsers 关注列表

func (*User) QueryUserMap

func (u *User) QueryUserMap(uuids []string) (result map[string]*model.User)

func (*User) Register

func (u *User) Register(user model.User) bool

type UserService

type UserService interface {
	FindUserByEmail(email string) (user *model.User)
	FindUserByEthAddress(ethAddress string) (user *model.User)
	FindUserByUuid(uuid string) (user *model.User)
	FindUsersByUuid(uuids []string) (users []*model.User)
	Register(user model.User) bool
	QueryFollowerUsers(uuid string) (users []*model.User)
	QueryFollowedUsers(uuid string) (users []*model.User)
	FollowUser(user *model.User, follower *model.User) bool
	QueryUserMap(uuids []string) (result map[string]*model.User)
	IsFollower(user, queryUser *model.User) bool
	IsFollowed(user, queryUser *model.User) bool
	EditUser(user *model.User) bool
}

func NewUser

func NewUser(xorm *xorm.Engine) UserService

type VerificationCode

type VerificationCode struct {
	Mail  MailService
	Redis *redis.Client
	// contains filtered or unexported fields
}

func (*VerificationCode) Run

func (v *VerificationCode) Run() error

func (*VerificationCode) SendLoginVerificationCode

func (v *VerificationCode) SendLoginVerificationCode(to string)

This function is used to send a login verification code to the user's email address.

func (*VerificationCode) VerifyEmailCode

func (v *VerificationCode) VerifyEmailCode(to string, code string) bool

type VerificationCodeService

type VerificationCodeService interface {
	SendLoginVerificationCode(to string)
	VerifyEmailCode(to string, code string) bool
	Run() error
}

func NewVerificationCode

func NewVerificationCode() VerificationCodeService

type VerificationMail

type VerificationMail struct {
	To            string
	Code          string
	ExpiredMinute uint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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