Documentation
¶
Index ¶
- Variables
- type APIController
- type APIRouter
- func (ar *APIRouter) Auth(c *gin.Context, authType AuthenticationType) (int64, error)
- func (ar *APIRouter) CheckIfBanned(c *gin.Context, as service.AccountService, uin int64) bool
- func (ar *APIRouter) Fail(c *gin.Context, code int, msg string)
- func (ar *APIRouter) GetBearerToken(c *gin.Context) (string, error)
- func (ar *APIRouter) GetUin(c *gin.Context) (int64, error)
- func (ar *APIRouter) StatusCode(c *gin.Context, code int, msg string)
- func (ar *APIRouter) Success(c *gin.Context, data interface{})
- type AccountBanBody
- type AccountChangePasswordBody
- type AccountCreateBody
- type AccountLoginBody
- type AccountRouter
- func (ar *AccountRouter) BanAccount(c *gin.Context)
- func (ar *AccountRouter) ChangePassword(c *gin.Context)
- func (ar *AccountRouter) ChangeUserGroup(c *gin.Context)
- func (ar *AccountRouter) CheckToken(c *gin.Context)
- func (ar *AccountRouter) CreateAccount(c *gin.Context)
- func (ar *AccountRouter) GetAccountList(c *gin.Context)
- func (ar *AccountRouter) GetBanList(c *gin.Context)
- func (ar *AccountRouter) LoginAccount(c *gin.Context)
- func (ar *AccountRouter) ResetPassword(c *gin.Context)
- func (ar *AccountRouter) UnbanAccount(c *gin.Context)
- type AccountUnbanBody
- type AdminRouter
- type AuthenticationType
- type ChangeUserGroupBody
- type GetAccountsBody
- type GetBanListBody
- type GetPostsBody
- type GetSelfPostsBody
- type InitBody
- type MiscRouter
- type OAuth2AppCreateBody
- type OAuth2AuthorizeBody
- type OAuth2GetAccessTokenBody
- type OAuth2Router
- type PostInfo
- type PostLogBody
- type PostNewBody
- type PostReviewBody
- type PostRouter
- func (pr *PostRouter) DownloadImage(c *gin.Context)
- func (pr *PostRouter) GetPostInfo(c *gin.Context)
- func (pr *PostRouter) GetPostLog(c *gin.Context)
- func (pr *PostRouter) GetPosts(c *gin.Context)
- func (pr *PostRouter) GetSelfPosts(c *gin.Context)
- func (pr *PostRouter) PostNew(c *gin.Context)
- func (pr *PostRouter) PostPostLog(c *gin.Context)
- func (pr *PostRouter) ReviewPost(c *gin.Context)
- func (pr *PostRouter) SubmitPostVerbose(c *gin.Context)
- func (pr *PostRouter) UploadImage(c *gin.Context)
- func (pr *PostRouter) UserCancelPost(c *gin.Context)
- type PostVerboseBody
- type SaveMetadataBody
- type SetMetadataBody
- type UserCancelPostBody
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAccountBanned = errors.New("账户已被封禁")
Functions ¶
This section is empty.
Types ¶
type APIController ¶
func NewApiController ¶
func NewApiController( as service.AccountService, ps service.PostService, ms service.MiscService, ads service.AdminService, oas service.OAuth2Service, ) *APIController
type APIRouter ¶
type APIRouter struct { }
func (*APIRouter) CheckIfBanned ¶
检查当前用户是否被封禁
func (*APIRouter) GetBearerToken ¶
func (*APIRouter) StatusCode ¶
type AccountBanBody ¶
type AccountChangePasswordBody ¶
type AccountChangePasswordBody struct { // 新密码 NewPasswd string `json:"new_passwd" binding:"required"` }
type AccountCreateBody ¶
type AccountCreateBody struct { // Uin 账户的uin 必须 Uin int64 `json:"uin" binding:"required"` }
type AccountLoginBody ¶
type AccountRouter ¶
type AccountRouter struct { APIRouter AccountService service.AccountService }
func NewAccountRouter ¶
func NewAccountRouter(rg *gin.RouterGroup, as service.AccountService) *AccountRouter
func (*AccountRouter) ChangeUserGroup ¶
func (ar *AccountRouter) ChangeUserGroup(c *gin.Context)
更改用户组
func (*AccountRouter) GetAccountList ¶
func (ar *AccountRouter) GetAccountList(c *gin.Context)
获取账号列表
type AccountUnbanBody ¶
type AccountUnbanBody struct { // 被封禁的uin Uin int64 `json:"uin" binding:"required"` }
type AdminRouter ¶
type AdminRouter struct { APIRouter AdminService service.AdminService AccountService service.AccountService }
func NewAdminRouter ¶
func NewAdminRouter(rg *gin.RouterGroup, as service.AdminService, acs service.AccountService) *AdminRouter
func (*AdminRouter) DeleteOAuth2App ¶
func (ar *AdminRouter) DeleteOAuth2App(c *gin.Context)
删除一个OAuth2应用
func (*AdminRouter) GetOAuth2AppList ¶
func (ar *AdminRouter) GetOAuth2AppList(c *gin.Context)
获取 OAuth2 应用列表
type AuthenticationType ¶
type AuthenticationType int
const ( UserOnly AuthenticationType = 1 ServiceOnly AuthenticationType = 2 Both AuthenticationType = 3 )
type ChangeUserGroupBody ¶
type GetAccountsBody ¶
type GetAccountsBody struct { // uin Uin int64 `json:"uin" binding:"required"` // 用户组 UserGroup database.UserGroup `json:"user_group" binding:"required"` // time_order TimeOrder *int `json:"time_order" binding:"required"` // page Page *int `json:"page" binding:"required"` // page_size PageSize *int `json:"page_size" binding:"required"` }
type GetBanListBody ¶
type GetBanListBody struct { // uin Uin int64 `json:"uin" binding:"required"` // 仅有效的 OnlyValid *bool `json:"only_valid" binding:"required"` // 页码 Page *int `json:"page" binding:"required"` // 每页数量 PageSize *int `json:"page_size" binding:"required"` // 时间排序 TimeOrder *int `json:"time_order" binding:"required"` }
type GetPostsBody ¶
type GetPostsBody struct { // uin Uin int64 `json:"uin" binding:"required"` GetSelfPostsBody }
type GetSelfPostsBody ¶
type GetSelfPostsBody struct { // 状态 Status database.PostStatus `json:"status" binding:"required"` // 时间排序 TimeOrder *int `json:"time_order" binding:"required"` // 页码 Page *int `json:"page" binding:"required"` // 每页数量 PageSize *int `json:"page_size" binding:"required"` }
type MiscRouter ¶
type MiscRouter struct { APIRouter MiscService service.MiscService }
func NewMiscRouter ¶
func NewMiscRouter(rg *gin.RouterGroup, ms service.MiscService) *MiscRouter
type OAuth2AppCreateBody ¶
type OAuth2AuthorizeBody ¶
type OAuth2AuthorizeBody struct { // 应用id ClientID string `json:"client_id" binding:"required"` }
type OAuth2Router ¶
type OAuth2Router struct { APIRouter OAuth2Service service.OAuth2Service }
func NewOAuth2Router ¶
func NewOAuth2Router(rg *gin.RouterGroup, oas service.OAuth2Service) *OAuth2Router
func (*OAuth2Router) Authorize ¶
func (oar *OAuth2Router) Authorize(c *gin.Context)
func (*OAuth2Router) GetAccessToken ¶
func (oar *OAuth2Router) GetAccessToken(c *gin.Context)
func (*OAuth2Router) GetOAuth2AppInfo ¶
func (oar *OAuth2Router) GetOAuth2AppInfo(c *gin.Context)
func (*OAuth2Router) GetUserInfo ¶
func (oar *OAuth2Router) GetUserInfo(c *gin.Context)
type PostInfo ¶
type PostInfo struct { database.PostPO TimeStamp int64 `json:"time_stamp" bson:"time_stamp"` // 时间戳 }
稿件信息响应
type PostLogBody ¶
type PostLogBody struct { PostID int `json:"post_id" bson:"post_id"` // 稿件ID Op int64 `json:"op" bson:"op"` // 操作者ID -1表示系统 OldStat database.PostStatus `json:"old_stat" bson:"old_stat"` // 旧状态 NewStat database.PostStatus `json:"new_stat" bson:"new_stat"` // 新状态 Comment string `json:"comment" bson:"comment"` // 备注 }
type PostNewBody ¶
type PostReviewBody ¶
type PostReviewBody struct { // 稿件id PostID int `json:"post_id" binding:"required"` // 审核选项 Option database.ReviewOption `json:"option" binding:"required"` // 审核意见 Comment *string `json:"comment" binding:"required"` }
稿件审核
type PostRouter ¶
type PostRouter struct { APIRouter PostService service.PostService AccountService service.AccountService }
func NewPostRouter ¶
func NewPostRouter(rg *gin.RouterGroup, ps service.PostService, as service.AccountService) *PostRouter
func (*PostRouter) GetPostInfo ¶
func (pr *PostRouter) GetPostInfo(c *gin.Context)
func (*PostRouter) SubmitPostVerbose ¶
func (pr *PostRouter) SubmitPostVerbose(c *gin.Context)
提交稿件发布详细信息
type PostVerboseBody ¶
type SaveMetadataBody ¶
type SetMetadataBody ¶
type UserCancelPostBody ¶
type UserCancelPostBody struct {
PostID *int `json:"post_id" binding:"required"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.