fix
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"tyc-server/common/ctxdata"
|
||||
"tyc-server/pkg/core/payment"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
)
|
||||
|
||||
@@ -22,13 +23,14 @@ type PayService struct {
|
||||
productModel model.ProductModel
|
||||
userAuthModel model.UserAuthModel
|
||||
userModel model.UserModel
|
||||
asyncService *AsynqService
|
||||
alipayService *payment.AliPayService
|
||||
wechatService *payment.WechatPayService
|
||||
appleService *payment.ApplePayService
|
||||
}
|
||||
|
||||
// NewPayService 创建支付服务
|
||||
func NewPayService(c config.Config, orderModel model.OrderModel, orderRefundModel model.OrderRefundModel, productModel model.ProductModel, userAuthModel model.UserAuthModel, userModel model.UserModel) *PayService {
|
||||
func NewPayService(c config.Config, orderModel model.OrderModel, orderRefundModel model.OrderRefundModel, productModel model.ProductModel, userAuthModel model.UserAuthModel, userModel model.UserModel, asyncService *AsynqService) *PayService {
|
||||
ps := &PayService{
|
||||
config: c,
|
||||
orderModel: orderModel,
|
||||
@@ -36,6 +38,7 @@ func NewPayService(c config.Config, orderModel model.OrderModel, orderRefundMode
|
||||
productModel: productModel,
|
||||
userAuthModel: userAuthModel,
|
||||
userModel: userModel,
|
||||
asyncService: asyncService,
|
||||
}
|
||||
|
||||
// 根据配置选择性初始化支付服务
|
||||
@@ -265,6 +268,10 @@ func (p *PayService) HandlePaymentCallback(ctx context.Context, payType string,
|
||||
if err != nil {
|
||||
return fmt.Errorf("更新订单状态失败: %v", err)
|
||||
}
|
||||
if asyncErr := p.asyncService.SendQueryTask(order.Id); asyncErr != nil {
|
||||
logx.Errorf("异步任务调度失败: %v", asyncErr)
|
||||
return asyncErr
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user