diff --git a/backend/app/http/pays.go b/backend/app/http/pays.go index 79449e6..32a3476 100644 --- a/backend/app/http/pays.go +++ b/backend/app/http/pays.go @@ -21,8 +21,9 @@ type pays struct { } // Callback -// @Router /pay/callback [get] -func (ctl *pays) Callback(ctx fiber.Ctx) error { +// @Router /pay/callback/:channel [get] +// @Bind channel path +func (ctl *pays) Callback(ctx fiber.Ctx, channel string) error { log := log.WithField("method", "pays.Callback") body := ctx.Body() diff --git a/backend/app/http/routes.gen.go b/backend/app/http/routes.gen.go index 19089fa..0207fde 100644 --- a/backend/app/http/routes.gen.go +++ b/backend/app/http/routes.gen.go @@ -29,8 +29,9 @@ func (r *Routes) Name() string { func (r *Routes) Register(router fiber.Router) { // 注册路由组: pays - router.Get("/pay/callback", Func0( + router.Get("/pay/callback/:channel", Func1( r.pays.Callback, + PathParam[string]("channel"), )) // 注册路由组: posts diff --git a/backend/app/jobs/provider.gen.go b/backend/app/jobs/provider.gen.go index b7d50bc..77ba79f 100755 --- a/backend/app/jobs/provider.gen.go +++ b/backend/app/jobs/provider.gen.go @@ -37,5 +37,17 @@ func Provide(opts ...opt.Option) error { }, atom.GroupInitial); err != nil { return err } + if err := container.Container.Provide(func( + __job *job.Job, + ) (contracts.Initial, error) { + obj := &WechatCallbackWorker{} + if err := river.AddWorkerSafely(__job.Workers, obj); err != nil { + return nil, err + } + + return obj, nil + }, atom.GroupInitial); err != nil { + return err + } return nil }