新增代理实名认证和授权

This commit is contained in:
2025-05-24 14:26:20 +08:00
parent 16e57387db
commit 2d3ca4c18e
54 changed files with 4069 additions and 435 deletions

View File

@@ -5,6 +5,7 @@ import (
"qnc-server/app/user/cmd/api/internal/middleware"
"qnc-server/app/user/cmd/api/internal/service"
"qnc-server/app/user/model"
"qnc-server/pkg/core/aliyun/cloudauth"
"github.com/hibiken/asynq"
"github.com/zeromicro/go-zero/core/logx"
@@ -41,8 +42,11 @@ type ServiceContext struct {
AgentPlatformDeductionModel model.AgentPlatformDeductionModel
AgentActiveStatModel model.AgentActiveStatModel
AgentWithdrawalModel model.AgentWithdrawalModel
AgentRealNameModel model.AgentRealNameModel
ExampleModel model.ExampleModel
GlobalNotificationsModel model.GlobalNotificationsModel
AuthorizationModel model.AuthorizationModel
AuthorizationFaceModel model.AuthorizationFaceModel
AlipayService *service.AliPayService
WechatPayService *service.WechatPayService
ApplePayService *service.ApplePayService
@@ -54,6 +58,9 @@ type ServiceContext struct {
VerificationService *service.VerificationService
AgentService *service.AgentService
UserService *service.UserService
// core service
CloudAuthService *cloudauth.CloudAuthClient
}
func NewServiceContext(c config.Config) *ServiceContext {
@@ -75,7 +82,17 @@ func NewServiceContext(c config.Config) *ServiceContext {
Concurrency: 10,
},
)
cloudAuthService, err := cloudauth.NewCloudAuthClient(cloudauth.CloudAuthConfig{
AccessKeyId: c.CloudAuth.AccessKeyId,
AccessKeySecret: c.CloudAuth.AccessKeySecret,
Endpoint: c.CloudAuth.Endpoint,
SceneId: c.CloudAuth.SceneId,
ReturnUrl: c.CloudAuth.ReturnUrl,
})
if err != nil {
logx.Errorf("初始化阿里云人脸认证服务失败: %+v", err)
panic(err)
}
westDexService := service.NewWestDexService(c)
yushanService := service.NewYushanService(c)
productFeatureModel := model.NewProductFeatureModel(db, c.CacheRedis)
@@ -104,7 +121,10 @@ func NewServiceContext(c config.Config) *ServiceContext {
agentPlatformDeductionModel := model.NewAgentPlatformDeductionModel(db, c.CacheRedis)
agentActiveStatModel := model.NewAgentActiveStatModel(db, c.CacheRedis)
agentWithdrawalModel := model.NewAgentWithdrawalModel(db, c.CacheRedis)
agentRealNameModel := model.NewAgentRealNameModel(db, c.CacheRedis)
exampleModel := model.NewExampleModel(db, c.CacheRedis)
authorizationModel := model.NewAuthorizationModel(db, c.CacheRedis)
authorizationFaceModel := model.NewAuthorizationFaceModel(db, c.CacheRedis)
alipayService := service.NewAliPayService(c)
wechatPayService := service.NewWechatPayService(c, userAuthModel, service.InitTypePlatformCert)
@@ -117,6 +137,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
agentMembershipConfigModel, agentMembershipRechargeOrderModel, agentMembershipUserConfigModel,
agentProductConfigModel, agentPlatformDeductionModel, agentActiveStatModel, agentWithdrawalModel)
userService := service.NewUserService(userModel, userAuthModel)
return &ServiceContext{
Config: c,
Redis: redis.MustNewRedis(redisConf),
@@ -156,8 +177,12 @@ func NewServiceContext(c config.Config) *ServiceContext {
AgentPlatformDeductionModel: agentPlatformDeductionModel,
AgentActiveStatModel: agentActiveStatModel,
AgentWithdrawalModel: agentWithdrawalModel,
AgentRealNameModel: agentRealNameModel,
ExampleModel: exampleModel,
AuthorizationModel: authorizationModel,
AuthorizationFaceModel: authorizationFaceModel,
UserService: userService,
CloudAuthService: cloudAuthService,
}
}