feat: add callback

This commit is contained in:
yanghao05
2025-04-14 21:15:24 +08:00
parent ea867f7261
commit 6e822e1a1b
7 changed files with 95 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
package http
import (
"quyun/providers/wepay"
"go.ipao.vip/atom"
"go.ipao.vip/atom/container"
"go.ipao.vip/atom/contracts"
@@ -8,17 +10,23 @@ import (
)
func Provide(opts ...opt.Option) error {
if err := container.Container.Provide(func() (*posts, error) {
obj := &posts{}
if err := container.Container.Provide(func(
wepay *wepay.Client,
) (*posts, error) {
obj := &posts{
wepay: wepay,
}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func(
pays *pays,
posts *posts,
) (contracts.HttpRoute, error) {
obj := &Routes{
pays: pays,
posts: posts,
}
if err := obj.Prepare(); err != nil {