You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.1 KiB
Go

1 month ago
package modules
import (
"cls/internal/domain/article"
"cls/internal/domain/column"
"cls/internal/domain/coupon"
1 month ago
"cls/internal/domain/free_trial"
"cls/internal/domain/order"
"cls/internal/domain/payment"
"cls/internal/domain/price"
1 month ago
"cls/internal/domain/purchase"
"cls/internal/domain/run_log"
1 month ago
"cls/internal/domain/user"
"cls/pkg/logger"
"cls/pkg/xorm_engine"
"go.uber.org/fx"
)
var Module = fx.Module("cls",
fx.Options(
AuthModule,
UserModule,
ArticleModule, //文章模块
PurchaseModule, //购买模块
FreeTrialModule,
PriceModule,
ColumnModule,
OrderModule,
CouponModule,
1 month ago
),
fx.Options(),
fx.Invoke(registerModels),
)
func registerModels(engine *xorm_engine.Engine, logger logger.New) {
log := logger("cls:modules:Module")
//财联社表
if err := engine.Cls.Sync2(
&article.LianV1Article{},
); err != nil {
log.Error(err)
}
//路诚内建表
if err := engine.Sync2(
&user.User{},
&free_trial.FreeTrial{},
&purchase.Purchase{},
&price.Price{},
&column.Column{},
&order.Order{},
&payment.Payment{},
&coupon.Coupon{},
&run_log.RunLog{},
1 month ago
); err != nil {
log.Error(err)
}
}