All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m6s
30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
package payment
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hibiken/asynq"
|
|
|
|
agentrecharge "github.com/break/junhong_cmp_fiber/internal/application/agentrecharge"
|
|
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
|
)
|
|
|
|
// AgentRechargeRecoveryTaskHandler 执行代理在线充值支付恢复任务。
|
|
type AgentRechargeRecoveryTaskHandler struct {
|
|
service *agentrecharge.RecoverOnlinePaymentService
|
|
}
|
|
|
|
// NewAgentRechargeRecoveryTaskHandler 创建代理在线充值支付恢复任务 Handler。
|
|
func NewAgentRechargeRecoveryTaskHandler(service *agentrecharge.RecoverOnlinePaymentService) *AgentRechargeRecoveryTaskHandler {
|
|
return &AgentRechargeRecoveryTaskHandler{service: service}
|
|
}
|
|
|
|
// Handle 扫描长期待支付记录并复用原支付单号收敛渠道状态。
|
|
func (h *AgentRechargeRecoveryTaskHandler) Handle(ctx context.Context, _ *asynq.Task) error {
|
|
if h == nil || h.service == nil {
|
|
return errors.New(errors.CodeServiceUnavailable, "代理在线充值支付恢复任务未配置")
|
|
}
|
|
_, err := h.service.ProcessBatch(ctx)
|
|
return err
|
|
}
|