feat: add callback
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"quyun/database/schemas/public/model"
|
||||
"quyun/providers/wepay"
|
||||
|
||||
"github.com/go-pay/gopay/wechat/v3"
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/gofiber/fiber/v3/log"
|
||||
"github.com/pkg/errors"
|
||||
@@ -50,7 +51,7 @@ func (ctl *posts) Mine(ctx fiber.Ctx, pagination *requests.Pagination, query *Li
|
||||
// Buy
|
||||
// @Router /buy/:id [get]
|
||||
// @Bind id path
|
||||
func (ctl *posts) Buy(ctx fiber.Ctx, id int64) (*wepay.PrepayData, error) {
|
||||
func (ctl *posts) Buy(ctx fiber.Ctx, id int64) (*wechat.JSAPIPayParams, error) {
|
||||
var userId int64 = 1
|
||||
|
||||
user, err := models.Users.GetByID(ctx.Context(), userId)
|
||||
@@ -80,5 +81,6 @@ func (ctl *posts) Buy(ctx fiber.Ctx, id int64) (*wepay.PrepayData, error) {
|
||||
log.Errorf("wepay.V3TransactionJsapi err: %v", err)
|
||||
return nil, errors.Wrap(err, "微信支付失败")
|
||||
}
|
||||
return prePayResp, nil
|
||||
|
||||
return prePayResp.PaySignOfJSAPI()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user