This commit is contained in:
2026-03-02 12:46:26 +08:00
parent 9fe6a88670
commit 6db59f1dea
61 changed files with 5432 additions and 1706 deletions

View File

@@ -34,6 +34,11 @@ type ServiceContext struct {
FeatureModel model.FeatureModel
ProductFeatureModel model.ProductFeatureModel
// 白名单相关模型
UserFeatureWhitelistModel model.UserFeatureWhitelistModel
WhitelistOrderModel model.WhitelistOrderModel
WhitelistOrderItemModel model.WhitelistOrderItemModel
// 订单相关模型
OrderModel model.OrderModel
OrderRefundModel model.OrderRefundModel
@@ -77,11 +82,15 @@ type ServiceContext struct {
GlobalNotificationsModel model.GlobalNotificationsModel
AuthorizationDocumentModel model.AuthorizationDocumentModel
// 第三方服务
TianyuanapiCallLogService *service.TianyuanapiCallLogService
// 服务
AlipayService *service.AliPayService
WechatPayService *service.WechatPayService
ApplePayService *service.ApplePayService
ApiRequestService *service.ApiRequestService
WhitelistService *service.WhitelistService
AsynqServer *asynq.Server
AsynqService *service.AsynqService
VerificationService *service.VerificationService
@@ -152,10 +161,16 @@ func NewServiceContext(c config.Config) *ServiceContext {
adminDictDataModel := model.NewAdminDictDataModel(db, cacheConf)
adminDictTypeModel := model.NewAdminDictTypeModel(db, cacheConf)
// ============================== 白名单相关模型 ==============================
userFeatureWhitelistModel := model.NewUserFeatureWhitelistModel(db, cacheConf)
whitelistOrderModel := model.NewWhitelistOrderModel(db, cacheConf)
whitelistOrderItemModel := model.NewWhitelistOrderItemModel(db, cacheConf)
// ============================== 其他模型 ==============================
exampleModel := model.NewExampleModel(db, cacheConf)
globalNotificationsModel := model.NewGlobalNotificationsModel(db, cacheConf)
authorizationDocumentModel := model.NewAuthorizationDocumentModel(db, cacheConf)
tianyuanapiCallLogModel := model.NewTianyuanapiCallLogModel(db, cacheConf)
// ============================== 第三方服务初始化 ==============================
tianyuanapi, err := tianyuanapi.NewClient(tianyuanapi.Config{
@@ -172,7 +187,9 @@ func NewServiceContext(c config.Config) *ServiceContext {
alipayService := service.NewAliPayService(c)
wechatPayService := service.NewWechatPayService(c, userAuthModel, service.InitTypeWxPayPubKey)
applePayService := service.NewApplePayService(c)
apiRequestService := service.NewApiRequestService(c, featureModel, productFeatureModel, tianyuanapi)
tianyuanapiCallLogService := service.NewTianyuanapiCallLogService(tianyuanapiCallLogModel, featureModel)
whitelistService := service.NewWhitelistService(c, userFeatureWhitelistModel, whitelistOrderModel, whitelistOrderItemModel, queryModel, featureModel)
apiRequestService := service.NewApiRequestService(c, featureModel, productFeatureModel, userFeatureWhitelistModel, tianyuanapi, tianyuanapiCallLogService, whitelistService)
verificationService := service.NewVerificationService(c, tianyuanapi, apiRequestService)
asynqService := service.NewAsynqService(c)
agentService := service.NewAgentService(c, orderModel, agentModel, agentWalletModel,
@@ -214,6 +231,11 @@ func NewServiceContext(c config.Config) *ServiceContext {
FeatureModel: featureModel,
ProductFeatureModel: productFeatureModel,
// 白名单相关模型
UserFeatureWhitelistModel: userFeatureWhitelistModel,
WhitelistOrderModel: whitelistOrderModel,
WhitelistOrderItemModel: whitelistOrderItemModel,
// 订单相关模型
OrderModel: orderModel,
QueryModel: queryModel,
@@ -257,11 +279,15 @@ func NewServiceContext(c config.Config) *ServiceContext {
GlobalNotificationsModel: globalNotificationsModel,
AuthorizationDocumentModel: authorizationDocumentModel,
// 第三方服务
TianyuanapiCallLogService: tianyuanapiCallLogService,
// 服务
AlipayService: alipayService,
WechatPayService: wechatPayService,
ApplePayService: applePayService,
ApiRequestService: apiRequestService,
WhitelistService: whitelistService,
AsynqServer: asynqServer,
AsynqService: asynqService,
VerificationService: verificationService,