feat: add wxshare
This commit is contained in:
@@ -29,10 +29,11 @@ type posts struct {
|
||||
}
|
||||
|
||||
// List posts
|
||||
// @Router /posts [get]
|
||||
// @Bind pagination query
|
||||
// @Bind query query
|
||||
// @Bind user local
|
||||
//
|
||||
// @Router /posts [get]
|
||||
// @Bind pagination query
|
||||
// @Bind query query
|
||||
// @Bind user local
|
||||
func (ctl *posts) List(ctx fiber.Ctx, pagination *requests.Pagination, query *ListQuery, user *model.Users) (*requests.Pager, error) {
|
||||
log.Infof("ok", pagination, query.Keyword, user.ID)
|
||||
|
||||
@@ -99,9 +100,10 @@ type PostItem struct {
|
||||
}
|
||||
|
||||
// Show
|
||||
// @Router /posts/:id/show [get]
|
||||
// @Bind id path
|
||||
// @Bind user local
|
||||
//
|
||||
// @Router /posts/:id/show [get]
|
||||
// @Bind id path
|
||||
// @Bind user local
|
||||
func (ctl *posts) Show(ctx fiber.Ctx, id int64, user *model.Users) (*PostItem, error) {
|
||||
log.Infof("Fetching post with ID: %d", id)
|
||||
post, err := models.Posts.GetByID(ctx.Context(), id)
|
||||
@@ -148,9 +150,10 @@ type PlayUrl struct {
|
||||
}
|
||||
|
||||
// Play
|
||||
// @Router /posts/:id/play [get]
|
||||
// @Bind id path
|
||||
// @Bind user local
|
||||
//
|
||||
// @Router /posts/:id/play [get]
|
||||
// @Bind id path
|
||||
// @Bind user local
|
||||
func (ctl *posts) Play(ctx fiber.Ctx, id int64, user *model.Users) (*PlayUrl, error) {
|
||||
log.Infof("Fetching play URL for post ID: %d", id)
|
||||
post, err := models.Posts.GetByID(ctx.Context(), id)
|
||||
@@ -181,10 +184,11 @@ func (ctl *posts) Play(ctx fiber.Ctx, id int64, user *model.Users) (*PlayUrl, er
|
||||
}
|
||||
|
||||
// Mine posts
|
||||
// @Router /posts/mine [get]
|
||||
// @Bind pagination query
|
||||
// @Bind query query
|
||||
// @Bind user local
|
||||
//
|
||||
// @Router /posts/mine [get]
|
||||
// @Bind pagination query
|
||||
// @Bind query query
|
||||
// @Bind user local
|
||||
func (ctl *posts) Mine(ctx fiber.Ctx, pagination *requests.Pagination, query *ListQuery, user *model.Users) (*requests.Pager, error) {
|
||||
log.Infof("Fetching posts for user with pagination: %+v and keyword: %v", pagination, query.Keyword)
|
||||
|
||||
@@ -236,9 +240,10 @@ func (ctl *posts) Mine(ctx fiber.Ctx, pagination *requests.Pagination, query *Li
|
||||
}
|
||||
|
||||
// Buy
|
||||
// @Router /posts/:id/buy [get]
|
||||
// @Bind id path
|
||||
// @Bind user local
|
||||
//
|
||||
// @Router /posts/:id/buy [get]
|
||||
// @Bind id path
|
||||
// @Bind user local
|
||||
func (ctl *posts) Buy(ctx fiber.Ctx, id int64, user *model.Users) (*wechat.JSAPIPayParams, error) {
|
||||
post, err := models.Posts.GetByID(ctx.Context(), id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user