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 // Callback
// @Router /pay/callback [get] // @Router /pay/callback/:channel [get]
func (ctl *pays) Callback(ctx fiber.Ctx) error { // @Bind channel path
func (ctl *pays) Callback(ctx fiber.Ctx, channel string) error {
log := log.WithField("method", "pays.Callback") log := log.WithField("method", "pays.Callback")
body := ctx.Body() body := ctx.Body()

View File

@@ -29,8 +29,9 @@ func (r *Routes) Name() string {
func (r *Routes) Register(router fiber.Router) { func (r *Routes) Register(router fiber.Router) {
// 注册路由组: pays // 注册路由组: pays
router.Get("/pay/callback", Func0( router.Get("/pay/callback/:channel", Func1(
r.pays.Callback, r.pays.Callback,
PathParam[string]("channel"),
)) ))
// 注册路由组: posts // 注册路由组: posts

View File

@@ -37,5 +37,17 @@ func Provide(opts ...opt.Option) error {
}, atom.GroupInitial); err != nil { }, atom.GroupInitial); err != nil {
return err 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 return nil
} }