feat: update provider
This commit is contained in:
@@ -41,10 +41,12 @@ func Provide(opts ...opt.Option) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := container.Container.Provide(func(
|
if err := container.Container.Provide(func(
|
||||||
|
job *job.Job,
|
||||||
oss *ali.OSSClient,
|
oss *ali.OSSClient,
|
||||||
wepay *wepay.Client,
|
wepay *wepay.Client,
|
||||||
) (*posts, error) {
|
) (*posts, error) {
|
||||||
obj := &posts{
|
obj := &posts{
|
||||||
|
job: job,
|
||||||
oss: oss,
|
oss: oss,
|
||||||
wepay: wepay,
|
wepay: wepay,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Provide(opts ...opt.Option) error {
|
func Provide(opts ...opt.Option) error {
|
||||||
|
if err := container.Container.Provide(func(
|
||||||
|
__job *job.Job,
|
||||||
|
) (contracts.Initial, error) {
|
||||||
|
obj := &BalancePayNotifyWorker{}
|
||||||
|
if err := river.AddWorkerSafely(__job.Workers, obj); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj, nil
|
||||||
|
}, atom.GroupInitial); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := container.Container.Provide(func(
|
if err := container.Container.Provide(func(
|
||||||
__job *job.Job,
|
__job *job.Job,
|
||||||
) (contracts.Initial, error) {
|
) (contracts.Initial, error) {
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ func (m *usersModel) RevokePosts(ctx context.Context, userID, postID int64) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetBalance
|
// SetBalance
|
||||||
func (m *usersModel) SetBalance(ctx context.Context, id int64, balance int64) error {
|
func (m *usersModel) SetBalance(ctx context.Context, id, balance int64) error {
|
||||||
tbl := table.Users
|
tbl := table.Users
|
||||||
stmt := tbl.
|
stmt := tbl.
|
||||||
UPDATE(tbl.Balance).
|
UPDATE(tbl.Balance).
|
||||||
@@ -494,7 +494,7 @@ func (m *usersModel) SetBalance(ctx context.Context, id int64, balance int64) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddBalance adds the given amount to the user's balance
|
// AddBalance adds the given amount to the user's balance
|
||||||
func (m *usersModel) AddBalance(ctx context.Context, id int64, amount int64) error {
|
func (m *usersModel) AddBalance(ctx context.Context, id, amount int64) error {
|
||||||
tbl := table.Users
|
tbl := table.Users
|
||||||
stmt := tbl.
|
stmt := tbl.
|
||||||
UPDATE(tbl.Balance).
|
UPDATE(tbl.Balance).
|
||||||
|
|||||||
Reference in New Issue
Block a user