Documentation ¶
Index ¶
- Constants
- Variables
- func CreatePost(c *gin.Context, param *models.CreatePostReq) error
- func GetCommunityDetail(c *gin.Context, id int64) (*mysql.Community, error)
- func GetCommunityList(c *gin.Context) ([]mysql.Community, error)
- func GetPosts(c *gin.Context, param *models.PostsReq) ([]mysql.Post, error)
- func Signup(param *models.SignupReq) error
- func VoteForPost(c *gin.Context, userId int64, param *models.VoteReq) error
- type PostDetail
- type TokenResp
Constants ¶
View Source
const ( OneWeekInSeconds = 7 * 86400 ScorePerVote = 432 )
View Source
const (
PasswordSalt = "20210407160200"
)
Variables ¶
View Source
var ( ErrorUserExist = errors.New("用户已存在") ErrorUserNotExist = errors.New("用户不存在") ErrorInvalidPassword = errors.New("密码错误") ErrorGenerateTokenFail = errors.New("token 生成失败") )
View Source
var ( ErrVoteTimeExpire = errors.New("投票时间已过") ErrVoted = errors.New("请勿重复投票") )
Functions ¶
func CreatePost ¶
func CreatePost(c *gin.Context, param *models.CreatePostReq) error
CreatePost 创建帖子
func GetCommunityDetail ¶
GetCommunityDetail 获取社区详情
func GetCommunityList ¶
GetCommunityList 获取社区列表
Types ¶
type PostDetail ¶
type PostDetail struct { AuthorName string `json:"author_name"` VoteNum int64 `json:"vote_num"` mysql.Post Community mysql.Community `json:"community"` }
func GetPostDetail ¶
func GetPostDetail(c *gin.Context, postId int64) (*PostDetail, error)
GetPostDetail 获取帖子详情
Click to show internal directories.
Click to hide internal directories.