feat: update provider

This commit is contained in:
Rogee
2025-05-13 14:31:44 +08:00
parent 2cf3b858b7
commit bd9e4df231
3 changed files with 16 additions and 2 deletions

View File

@@ -41,10 +41,12 @@ func Provide(opts ...opt.Option) error {
return err
}
if err := container.Container.Provide(func(
job *job.Job,
oss *ali.OSSClient,
wepay *wepay.Client,
) (*posts, error) {
obj := &posts{
job: job,
oss: oss,
wepay: wepay,
}

View File

@@ -13,6 +13,18 @@ import (
)
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(
__job *job.Job,
) (contracts.Initial, error) {

View File

@@ -476,7 +476,7 @@ func (m *usersModel) RevokePosts(ctx context.Context, userID, postID int64) erro
}
// 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
stmt := tbl.
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
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
stmt := tbl.
UPDATE(tbl.Balance).