feat: update go module, add recharge wechat
Some checks failed
build quyun / Build (push) Failing after 12m45s
Some checks failed
build quyun / Build (push) Failing after 12m45s
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"quyun/app/requests"
|
||||
"quyun/database/fields"
|
||||
"quyun/providers/ali"
|
||||
"quyun/providers/app"
|
||||
"quyun/providers/job"
|
||||
"quyun/providers/wepay"
|
||||
|
||||
@@ -29,6 +30,7 @@ type posts struct {
|
||||
wepay *wepay.Client
|
||||
oss *ali.OSSClient
|
||||
job *job.Job
|
||||
app *app.Config
|
||||
}
|
||||
|
||||
// List posts
|
||||
@@ -81,16 +83,17 @@ func (ctl *posts) List(
|
||||
_, bought := userBoughtIds[item.ID]
|
||||
|
||||
return PostItem{
|
||||
ID: item.ID,
|
||||
Title: item.Title,
|
||||
Description: item.Description,
|
||||
Price: item.Price,
|
||||
Discount: item.Discount,
|
||||
Views: item.Views,
|
||||
Likes: item.Likes,
|
||||
Tags: item.Tags.Data,
|
||||
HeadImages: mediaUrls,
|
||||
Bought: bought,
|
||||
ID: item.ID,
|
||||
Title: item.Title,
|
||||
Description: item.Description,
|
||||
Price: item.Price,
|
||||
Discount: item.Discount,
|
||||
Views: item.Views,
|
||||
Likes: item.Likes,
|
||||
Tags: item.Tags.Data,
|
||||
HeadImages: mediaUrls,
|
||||
Bought: bought,
|
||||
RechargeWechat: ctl.app.RechargeWechat,
|
||||
}, true
|
||||
})
|
||||
|
||||
@@ -101,17 +104,18 @@ func (ctl *posts) List(
|
||||
}
|
||||
|
||||
type PostItem struct {
|
||||
ID int64 `json:"id"`
|
||||
Bought bool `json:"bought"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Content string `json:"content"`
|
||||
Price int64 `json:"price"`
|
||||
Discount int16 `json:"discount"`
|
||||
Views int64 `json:"views"`
|
||||
Likes int64 `json:"likes"`
|
||||
Tags []string `json:"tags"`
|
||||
HeadImages []string `json:"head_images"`
|
||||
ID int64 `json:"id"`
|
||||
Bought bool `json:"bought"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Content string `json:"content"`
|
||||
Price int64 `json:"price"`
|
||||
Discount int16 `json:"discount"`
|
||||
Views int64 `json:"views"`
|
||||
Likes int64 `json:"likes"`
|
||||
Tags []string `json:"tags"`
|
||||
HeadImages []string `json:"head_images"`
|
||||
RechargeWechat string `json:"recharge_wechat,omitempty"`
|
||||
}
|
||||
|
||||
// Show
|
||||
@@ -148,17 +152,18 @@ func (ctl *posts) Show(ctx fiber.Ctx, id int64, user *model.Users) (*PostItem, e
|
||||
})
|
||||
|
||||
return &PostItem{
|
||||
ID: post.ID,
|
||||
Title: post.Title,
|
||||
Description: post.Description,
|
||||
Content: post.Content,
|
||||
Price: post.Price,
|
||||
Discount: post.Discount,
|
||||
Views: post.Views,
|
||||
Likes: post.Likes,
|
||||
Tags: post.Tags.Data,
|
||||
HeadImages: mediaUrls,
|
||||
Bought: bought,
|
||||
ID: post.ID,
|
||||
Title: post.Title,
|
||||
Description: post.Description,
|
||||
Content: post.Content,
|
||||
Price: post.Price,
|
||||
Discount: post.Discount,
|
||||
Views: post.Views,
|
||||
Likes: post.Likes,
|
||||
Tags: post.Tags.Data,
|
||||
HeadImages: mediaUrls,
|
||||
Bought: bought,
|
||||
RechargeWechat: ctl.app.RechargeWechat,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -262,15 +267,16 @@ func (ctl *posts) Mine(
|
||||
})
|
||||
|
||||
return PostItem{
|
||||
ID: item.ID,
|
||||
Title: item.Title,
|
||||
Description: item.Description,
|
||||
Price: item.Price,
|
||||
Discount: item.Discount,
|
||||
Views: item.Views,
|
||||
Likes: item.Likes,
|
||||
Tags: item.Tags.Data,
|
||||
HeadImages: mediaUrls,
|
||||
ID: item.ID,
|
||||
Title: item.Title,
|
||||
Description: item.Description,
|
||||
Price: item.Price,
|
||||
Discount: item.Discount,
|
||||
Views: item.Views,
|
||||
Likes: item.Likes,
|
||||
Tags: item.Tags.Data,
|
||||
HeadImages: mediaUrls,
|
||||
RechargeWechat: ctl.app.RechargeWechat,
|
||||
}, true
|
||||
})
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package http
|
||||
|
||||
import (
|
||||
"quyun/providers/ali"
|
||||
"quyun/providers/app"
|
||||
"quyun/providers/job"
|
||||
"quyun/providers/jwt"
|
||||
"quyun/providers/wechat"
|
||||
@@ -44,11 +45,13 @@ func Provide(opts ...opt.Option) error {
|
||||
job *job.Job,
|
||||
oss *ali.OSSClient,
|
||||
wepay *wepay.Client,
|
||||
appConfig *app.Config,
|
||||
) (*posts, error) {
|
||||
obj := &posts{
|
||||
job: job,
|
||||
oss: oss,
|
||||
wepay: wepay,
|
||||
app: appConfig,
|
||||
}
|
||||
|
||||
return obj, nil
|
||||
|
||||
Reference in New Issue
Block a user