重构支付接口,以动态支持多种产品类型,整合长短效套餐的购买支付逻辑;引入 decimal 类型的金额计算;
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/schema"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var g *gen.Generator
|
||||
@@ -23,9 +24,10 @@ func main() {
|
||||
)
|
||||
|
||||
g = gen.NewGenerator(gen.Config{
|
||||
OutPath: "web/queries",
|
||||
ModelPkgPath: "models",
|
||||
Mode: gen.WithDefaultQuery | gen.WithoutContext,
|
||||
OutPath: "web/queries",
|
||||
ModelPkgPath: "models",
|
||||
FieldWithTypeTag: true,
|
||||
Mode: gen.WithDefaultQuery | gen.WithoutContext,
|
||||
})
|
||||
g.UseDB(db)
|
||||
|
||||
@@ -35,6 +37,9 @@ func main() {
|
||||
if field.Type == "time.Time" {
|
||||
field.Type = "orm.LocalDateTime"
|
||||
}
|
||||
if strings.Contains(field.Tags(), "numeric") {
|
||||
field.Type = "decimal.Decimal"
|
||||
}
|
||||
return field
|
||||
}),
|
||||
gen.FieldRename("contact_qq", "ContactQQ"),
|
||||
|
||||
Reference in New Issue
Block a user