39 lines
831 B
Go
39 lines
831 B
Go
package biz
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
"voucher/internal/pkg/lock"
|
|
)
|
|
|
|
func (v *VoucherBiz) OrderConsume(ctx context.Context, orderNo string) (err error) {
|
|
|
|
err = lock.NewMutex(v.rdb.Rdb, time.Second*30).Lock(ctx, fmt.Sprintf("order_consume_%s", orderNo), func(ctx context.Context) error {
|
|
|
|
return nil
|
|
})
|
|
|
|
return
|
|
}
|
|
|
|
func (v *VoucherBiz) QueryConsume(ctx context.Context, orderNo string) (err error) {
|
|
|
|
err = lock.NewMutex(v.rdb.Rdb, time.Second*30).Lock(ctx, fmt.Sprintf("query_consume_%s", orderNo), func(ctx context.Context) error {
|
|
|
|
return nil
|
|
})
|
|
|
|
return
|
|
}
|
|
|
|
func (v *VoucherBiz) NotifyConsume(ctx context.Context, orderNo string) (err error) {
|
|
|
|
err = lock.NewMutex(v.rdb.Rdb, time.Second*30).Lock(ctx, fmt.Sprintf("notify_consume_%s", orderNo), func(ctx context.Context) error {
|
|
|
|
return nil
|
|
})
|
|
|
|
return
|
|
}
|