Documentation ¶
Index ¶
- func RegisterRoutes() *gin.Engine
- type ArticleHandler
- func (a *ArticleHandler) Detail(ctx *gin.Context, usr ijwt.UserClaims) (ginx.Result, error)
- func (h *ArticleHandler) Edit(ctx *gin.Context)
- func (a *ArticleHandler) Like(ctx *gin.Context, req LikeReq, uc ijwt.UserClaims) (ginx.Result, error)
- func (h *ArticleHandler) List(ctx *gin.Context, req ListReq, uc ijwt.UserClaims) (ginx.Result, error)
- func (a *ArticleHandler) PubDetail(ctx *gin.Context)
- func (h *ArticleHandler) Publish(ctx *gin.Context)
- func (h *ArticleHandler) RegisterRoutes(server *gin.Engine)
- func (h *ArticleHandler) Withdraw(ctx *gin.Context)
- type ArticleReq
- type ArticleVO
- type LikeReq
- type ListReq
- type OAuth2WechatHandler
- type Result
- type StateClaims
- type UserHandler
- func (c *UserHandler) Edit(ctx *gin.Context)
- func (c *UserHandler) Login(ctx *gin.Context)
- func (c *UserHandler) LoginJWT(ctx *gin.Context)
- func (c *UserHandler) LoginSMS(ctx *gin.Context)
- func (u *UserHandler) LogoutJWT(ctx *gin.Context)
- func (c *UserHandler) Profile(ctx *gin.Context)
- func (c *UserHandler) ProfileJWT(ctx *gin.Context)
- func (u *UserHandler) RefreshToken(ctx *gin.Context)
- func (c *UserHandler) RegisterRoutes(server *gin.Engine)
- func (c *UserHandler) SendSMSLoginCode(ctx *gin.Context)
- func (c *UserHandler) SignUp(ctx *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
Types ¶
type ArticleHandler ¶
type ArticleHandler struct {
// contains filtered or unexported fields
}
func NewArticleHandler ¶
func NewArticleHandler(svc service.ArticleService, l logger.LoggerV1) *ArticleHandler
func (*ArticleHandler) Detail ¶
func (a *ArticleHandler) Detail(ctx *gin.Context, usr ijwt.UserClaims) (ginx.Result, error)
func (*ArticleHandler) Edit ¶
func (h *ArticleHandler) Edit(ctx *gin.Context)
func (*ArticleHandler) Like ¶
func (a *ArticleHandler) Like(ctx *gin.Context, req LikeReq, uc ijwt.UserClaims) (ginx.Result, error)
func (*ArticleHandler) List ¶
func (h *ArticleHandler) List(ctx *gin.Context, req ListReq, uc ijwt.UserClaims) (ginx.Result, error)
func (*ArticleHandler) PubDetail ¶
func (a *ArticleHandler) PubDetail(ctx *gin.Context)
func (*ArticleHandler) Publish ¶
func (h *ArticleHandler) Publish(ctx *gin.Context)
func (*ArticleHandler) RegisterRoutes ¶
func (h *ArticleHandler) RegisterRoutes(server *gin.Engine)
func (*ArticleHandler) Withdraw ¶
func (h *ArticleHandler) Withdraw(ctx *gin.Context)
type ArticleReq ¶
type ArticleVO ¶
type ArticleVO struct { Id int64 `json:"id"` Title string `json:"title"` // 摘要 Abstract string `json:"abstract"` // 内容 Content string `json:"content"` // 注意一点,状态这个东西,可以是前端来处理,也可以是后端处理 // 0 -> unknown -> 未知状态 // 1 -> 未发表,手机 APP 这种涉及到发版的问题,那么后端来处理 // 涉及到国际化,也是后端来处理 Status uint8 `json:"status"` Author string `json:"author"` // 计数 ReadCnt int64 `json:"read_cnt"` LikeCnt int64 `json:"like_cnt"` CollectCnt int64 `json:"collect_cnt"` // 我个人有没有收藏,有没有点赞 Liked bool `json:"liked"` Collected bool `json:"collected"` Ctime string `json:"ctime"` Utime string `json:"utime"` }
type OAuth2WechatHandler ¶
func NewOAuth2WechatHandler ¶
func NewOAuth2WechatHandler(svc wechat.Service, userSvc service.UserService, jwtHdl ijwt.Handler) *OAuth2WechatHandler
func (*OAuth2WechatHandler) AuthURL ¶
func (h *OAuth2WechatHandler) AuthURL(ctx *gin.Context)
func (*OAuth2WechatHandler) Callback ¶
func (h *OAuth2WechatHandler) Callback(ctx *gin.Context)
func (*OAuth2WechatHandler) RegisterRoutes ¶
func (h *OAuth2WechatHandler) RegisterRoutes(server *gin.Engine)
type StateClaims ¶
type StateClaims struct { State string jwt.RegisteredClaims }
type UserHandler ¶
type UserHandler struct { // 只有在使用 JWT 的时候才有用 ijwt.Handler // contains filtered or unexported fields }
func NewUserHandler ¶
func NewUserHandler(svc service.UserService, codeSvc service.CodeService, jwtHdl ijwt.Handler) *UserHandler
func (*UserHandler) LoginJWT ¶
func (c *UserHandler) LoginJWT(ctx *gin.Context)
LoginJWT 用户登录接口,使用的是 JWT,如果你想要测试 JWT,就启用这个
func (*UserHandler) LoginSMS ¶
func (c *UserHandler) LoginSMS(ctx *gin.Context)
func (*UserHandler) LogoutJWT ¶
func (u *UserHandler) LogoutJWT(ctx *gin.Context)
func (*UserHandler) ProfileJWT ¶
func (c *UserHandler) ProfileJWT(ctx *gin.Context)
ProfileJWT 用户详情, JWT 版本
func (*UserHandler) RefreshToken ¶
func (u *UserHandler) RefreshToken(ctx *gin.Context)
RefreshToken 可以同时刷新长短 token,用 redis 来记录是否有效,即 refresh_token 是一次性的 参考登录校验部分,比较 User-Agent 来增强安全性
func (*UserHandler) RegisterRoutes ¶
func (c *UserHandler) RegisterRoutes(server *gin.Engine)
func (*UserHandler) SendSMSLoginCode ¶
func (c *UserHandler) SendSMSLoginCode(ctx *gin.Context)
SendSMSLoginCode 发送短信验证码
Source Files ¶
Click to show internal directories.
Click to hide internal directories.