feat: udpate

This commit is contained in:
yanghao05
2025-04-14 21:24:57 +08:00
parent d75fd7906f
commit 45a0b6848a
3 changed files with 17 additions and 3 deletions

View File

@@ -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()

View File

@@ -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

View File

@@ -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
}