feat: add codes

This commit is contained in:
Rogee
2024-12-21 15:13:38 +08:00
parent 9ef5707ca2
commit 549b18daf0
2 changed files with 1 additions and 42 deletions

View File

@@ -87,7 +87,7 @@ func (c *Controller) GetChargeCodes(ctx fiber.Ctx) error {
Code string `json:"code"`
}
amount := []int64{1, 5, 10, 20, 50, 100}
amount := []int64{10, 20, 50, 100, 200, 300, 500, 1000, 2000}
codes := []generateCode{}
for _, a := range amount {
code, err := c.svc.GenerateChargeCode(ctx.Context(), claim.TenantID, a*100)

View File

@@ -1,41 +0,0 @@
package uuid
import (
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/utils/opt"
"github.com/gofrs/uuid"
)
func DefaultProvider() container.ProviderContainer {
return container.ProviderContainer{
Provider: Provide,
Options: []opt.Option{},
}
}
type Generator struct {
generator uuid.Generator
}
func Provide(opts ...opt.Option) error {
o := opt.New(opts...)
return container.Container.Provide(func() (*Generator, error) {
return &Generator{
generator: uuid.DefaultGenerator,
}, nil
}, o.DiOptions()...)
}
func (u *Generator) MustGenerate() string {
uuid, _ := u.Generate()
return uuid
}
func (u *Generator) Generate() (string, error) {
uuid, err := u.generator.NewV4()
if err != nil {
return "", err
}
return uuid.String(), err
}