Documentation ¶
Index ¶
- Constants
- Variables
- func AddFriend(user *core.User, param *AddFriendReq) error
- func BuyPostAttachment(post *core.Post, user *core.User) error
- func ChangeUserAvatar(user *core.User, avatar string) (err *errcode.Error)
- func CheckPassword(password string) error
- func CheckPhoneCaptcha(phone, captcha string) *errcode.Error
- func CheckPhoneExist(uid int64, phone string) bool
- func CheckPostAttachmentIsPaid(postID, userID int64) bool
- func CheckStatus(user *core.User) bool
- func CreateAttachment(attachment *core.Attachment) (*core.Attachment, error)
- func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *core.PostFormated, err error)
- func CreatePostCollection(postID, userID int64) (*core.PostCollection, error)
- func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) (comment *core.Comment, err error)
- func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, userID, atUserID int64) (*core.CommentReply, error)
- func CreatePostStar(postID, userID int64) (*core.PostStar, error)
- func CreateRecharge(userID, amount int64) (*core.WalletRecharge, error)
- func CreateWhisper(c *gin.Context, msg *core.Message) (*core.Message, error)
- func DeleteFriend(user *core.User, param *DeleteFriendReq) error
- func DeletePost(user *core.User, id int64) *errcode.Error
- func DeletePostCollection(collection *core.PostCollection) error
- func DeletePostComment(comment *core.Comment) error
- func DeletePostCommentReply(reply *core.CommentReply) error
- func DeletePostStar(star *core.PostStar) error
- func DeleteSearchPost(post *core.Post) error
- func DoLogin(ctx *gin.Context, param *AuthRequest) (*core.User, error)
- func EncryptPasswordAndSalt(password string) (string, string)
- func FinishRecharge(ctx *gin.Context, id int64, tradeNo string) error
- func GetContacts(user *core.User, offset int, limit int) (*core.ContactList, error)
- func GetIndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error)
- func GetMessages(userID int64, offset, limit int) ([]*core.MessageFormated, int64, error)
- func GetParamSign(param map[string]any, secretKey string) string
- func GetPost(id int64) (*core.PostFormated, error)
- func GetPostCollection(postID, userID int64) (*core.PostCollection, error)
- func GetPostComment(id int64) (*core.Comment, error)
- func GetPostCommentReply(id int64) (*core.CommentReply, error)
- func GetPostComments(postID int64, sort string, offset, limit int) ([]*core.CommentFormated, int64, error)
- func GetPostContentByID(id int64) (*core.PostContent, error)
- func GetPostCount(conditions *core.ConditionsT) (int64, error)
- func GetPostList(req *PostListReq) ([]*core.Post, []*core.PostFormated, error)
- func GetPostListFromSearch(user *core.User, q *core.QueryReq, offset, limit int) ([]*core.PostFormated, int64, error)
- func GetPostListFromSearchByQuery(user *core.User, query string, offset, limit int) ([]*core.PostFormated, int64, error)
- func GetPostStar(postID, userID int64) (*core.PostStar, error)
- func GetPostTags(param *PostTagsReq) ([]*core.TagFormated, error)
- func GetRandomAvatar() string
- func GetRechargeByID(id int64) (*core.WalletRecharge, error)
- func GetSuggestTags(keyword string) ([]string, error)
- func GetSuggestUsers(keyword string) ([]string, error)
- func GetUnreadCount(userID int64) (int64, error)
- func GetUserByID(id int64) (*core.User, error)
- func GetUserCollections(userID int64, offset, limit int) ([]*core.PostFormated, int64, error)
- func GetUserInfo(param *AuthRequest) (*core.User, error)
- func GetUserStars(userID int64, offset, limit int) ([]*core.PostFormated, int64, error)
- func GetUserWalletBills(userID int64, offset, limit int) ([]*core.WalletStatement, int64, error)
- func Initialize()
- func IsFriend(userId, friendId int64) bool
- func LockPost(id int64) error
- func PushPostToSearch(post *core.Post)
- func PushPostsToSearch(c *gin.Context)
- func ReadMessage(id, userID int64) error
- func Register(username, password string) (*core.User, error)
- func RejectFriend(user *core.User, param *RejectFriendReq) error
- func RequestingFriend(user *core.User, param *RequestingFriendReq) error
- func SendPhoneCaptcha(ctx *gin.Context, phone string) error
- func StickPost(id int64) error
- func UpdateUserInfo(user *core.User) *errcode.Error
- func ValidPassword(dbPassword, password, salt string) bool
- func ValidUsername(username string) error
- func VisiblePost(user *core.User, postId int64, visibility core.PostVisibleT) *errcode.Error
- type AddFriendReq
- type AuthRequest
- type ChangeAvatarReq
- type ChangeNicknameReq
- type ChangePasswordReq
- type ChangeUserStatusReq
- type CommentCreationReq
- type CommentDelReq
- type CommentReplyCreationReq
- type DeleteFriendReq
- type PhoneCaptchaReq
- type PostCollectionReq
- type PostContentItem
- type PostCreationReq
- type PostDelReq
- type PostListReq
- type PostLockReq
- type PostStarReq
- type PostStickReq
- type PostTagsReq
- type PostVisibilityReq
- type ReadMessageReq
- type RechargeReq
- type RegisterRequest
- type RejectFriendReq
- type ReplyDelReq
- type RequestingFriendReq
- type TagType
- type UserPhoneBindReq
- type UserProfileResp
- type WhisperReq
Constants ¶
View Source
const MAX_WHISPER_NUM_DAILY = 20
MAX_WHISPER_NUM_DAILY 当日单用户私信总数限制(TODO 配置化、积分兑换等)
Variables ¶
View Source
var (
DisablePhoneVerify bool
)
Functions ¶
func AddFriend ¶
func AddFriend(user *core.User, param *AddFriendReq) error
func CheckPhoneCaptcha ¶
CheckPhoneCaptcha 验证手机验证码
func CreateAttachment ¶
func CreateAttachment(attachment *core.Attachment) (*core.Attachment, error)
func CreatePost ¶
func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *core.PostFormated, err error)
CreatePost 创建文章 TODO: 推文+推文内容需要在一个事务中添加,后续优化
func CreatePostCollection ¶
func CreatePostCollection(postID, userID int64) (*core.PostCollection, error)
func CreatePostComment ¶
func CreatePostCommentReply ¶
func CreateRecharge ¶
func CreateRecharge(userID, amount int64) (*core.WalletRecharge, error)
func CreateWhisper ¶
CreateWhisper 创建私信
func DeleteFriend ¶
func DeleteFriend(user *core.User, param *DeleteFriendReq) error
func DeletePostCollection ¶
func DeletePostCollection(collection *core.PostCollection) error
func DeletePostCommentReply ¶
func DeletePostCommentReply(reply *core.CommentReply) error
func EncryptPasswordAndSalt ¶
EncryptPasswordAndSalt 密码加密&生成salt
func GetContacts ¶
func GetIndexPosts ¶
func GetMessages ¶
func GetPost ¶
func GetPost(id int64) (*core.PostFormated, error)
func GetPostCollection ¶
func GetPostCollection(postID, userID int64) (*core.PostCollection, error)
func GetPostCommentReply ¶
func GetPostCommentReply(id int64) (*core.CommentReply, error)
func GetPostComments ¶
func GetPostContentByID ¶
func GetPostContentByID(id int64) (*core.PostContent, error)
func GetPostCount ¶
func GetPostCount(conditions *core.ConditionsT) (int64, error)
func GetPostList ¶
func GetPostList(req *PostListReq) ([]*core.Post, []*core.PostFormated, error)
func GetPostListFromSearch ¶
func GetPostListFromSearchByQuery ¶
func GetPostTags ¶
func GetPostTags(param *PostTagsReq) ([]*core.TagFormated, error)
func GetRechargeByID ¶
func GetRechargeByID(id int64) (*core.WalletRecharge, error)
func GetSuggestTags ¶
GetSuggestTags 根据关键词获取标签推荐
func GetSuggestUsers ¶
GetSuggestUsers 根据关键词获取用户推荐
func GetUserCollections ¶
GetUserCollections 获取用户收藏列表
func GetUserStars ¶
GetUserStars 获取用户点赞列表
func GetUserWalletBills ¶
GetUserWalletBills 获取用户账单列表
func Initialize ¶
func Initialize()
func RejectFriend ¶
func RejectFriend(user *core.User, param *RejectFriendReq) error
func RequestingFriend ¶
func RequestingFriend(user *core.User, param *RequestingFriendReq) error
func SendPhoneCaptcha ¶
SendPhoneCaptcha 发送短信验证码
func ValidPassword ¶
ValidPassword 检查密码是否一致
Types ¶
type AuthRequest ¶
type ChangeAvatarReq ¶
type ChangeAvatarReq struct {
Avatar string `json:"avatar" form:"avatar" binding:"required"`
}
type ChangeNicknameReq ¶
type ChangeNicknameReq struct {
Nickname string `json:"nickname" form:"nickname" binding:"required"`
}
type ChangePasswordReq ¶
type ChangeUserStatusReq ¶
type CommentCreationReq ¶
type CommentCreationReq struct { PostID int64 `json:"post_id" binding:"required"` Contents []*PostContentItem `json:"contents" binding:"required"` Users []string `json:"users" binding:"required"` }
type CommentReplyCreationReq ¶
type PhoneCaptchaReq ¶
type PostContentItem ¶
type PostContentItem struct { Content string `json:"content" binding:"required"` Type core.PostContentT `json:"type" binding:"required"` Sort int64 `json:"sort" binding:"required"` }
type PostCreationReq ¶
type PostCreationReq struct { Contents []*PostContentItem `json:"contents" binding:"required"` Tags []string `json:"tags" binding:"required"` Users []string `json:"users" binding:"required"` AttachmentPrice int64 `json:"attachment_price"` Visibility core.PostVisibleT `json:"visibility"` }
type PostListReq ¶
type PostListReq struct { Conditions *core.ConditionsT Offset int Limit int }
type PostTagsReq ¶
type PostVisibilityReq ¶
type PostVisibilityReq struct { ID int64 `json:"id" binding:"required"` Visibility core.PostVisibleT `json:"visibility"` }
type RechargeReq ¶
type RechargeReq struct {
Amount int64 `json:"amount" form:"amount" binding:"required"`
}
type RegisterRequest ¶
type RejectFriendReq ¶
type RejectFriendReq struct {
UserId int64 `json:"user_id" binding:"required"`
}
type RequestingFriendReq ¶
type TagType ¶
type TagType string
const TagTypeHot TagType = "hot"
const TagTypeNew TagType = "new"
type UserPhoneBindReq ¶
Click to show internal directories.
Click to hide internal directories.