fix
This commit is contained in:
@@ -218,6 +218,12 @@ func (s *ApiApplicationServiceImpl) validateApiCall(ctx context.Context, cmd *co
|
||||
return nil, ErrFrozenAccount
|
||||
}
|
||||
|
||||
// 验证产品是否启用
|
||||
if !product.IsEnabled {
|
||||
s.logger.Error("产品未启用", zap.String("product_code", product.Code))
|
||||
return nil, ErrProductDisabled
|
||||
}
|
||||
|
||||
// 4. 验证IP白名单(非开发环境)
|
||||
if !s.config.App.IsDevelopment() && !cmd.Options.IsDebug {
|
||||
if !apiUser.IsWhiteListed(cmd.ClientIP) {
|
||||
@@ -589,8 +595,8 @@ func (s *ApiApplicationServiceImpl) GetUserApiCalls(ctx context.Context, userID
|
||||
// 获取用户的API密钥信息
|
||||
apiUser, err := s.apiUserService.LoadApiUserByUserId(ctx, *call.UserId)
|
||||
if err != nil {
|
||||
s.logger.Error("获取用户API信息失败",
|
||||
zap.Error(err),
|
||||
s.logger.Error("获取用户API信息失败",
|
||||
zap.Error(err),
|
||||
zap.String("call_id", call.ID),
|
||||
zap.String("user_id", *call.UserId))
|
||||
// 获取失败时使用原始值
|
||||
@@ -601,8 +607,8 @@ func (s *ApiApplicationServiceImpl) GetUserApiCalls(ctx context.Context, userID
|
||||
SecretKey: apiUser.SecretKey,
|
||||
})
|
||||
if err != nil {
|
||||
s.logger.Error("解密请求参数失败",
|
||||
zap.Error(err),
|
||||
s.logger.Error("解密请求参数失败",
|
||||
zap.Error(err),
|
||||
zap.String("call_id", call.ID),
|
||||
zap.String("user_id", *call.UserId))
|
||||
// 解密失败时使用原始值
|
||||
@@ -611,7 +617,7 @@ func (s *ApiApplicationServiceImpl) GetUserApiCalls(ctx context.Context, userID
|
||||
if jsonBytes, err := json.Marshal(decryptedParams); err == nil {
|
||||
requestParamsStr = string(jsonBytes)
|
||||
} else {
|
||||
s.logger.Error("序列化解密参数失败",
|
||||
s.logger.Error("序列化解密参数失败",
|
||||
zap.Error(err),
|
||||
zap.String("call_id", call.ID))
|
||||
// 序列化失败时使用原始值
|
||||
@@ -693,8 +699,8 @@ func (s *ApiApplicationServiceImpl) GetAdminApiCalls(ctx context.Context, filter
|
||||
// 获取用户的API密钥信息
|
||||
apiUser, err := s.apiUserService.LoadApiUserByUserId(ctx, *call.UserId)
|
||||
if err != nil {
|
||||
s.logger.Error("获取用户API信息失败",
|
||||
zap.Error(err),
|
||||
s.logger.Error("获取用户API信息失败",
|
||||
zap.Error(err),
|
||||
zap.String("call_id", call.ID),
|
||||
zap.String("user_id", *call.UserId))
|
||||
// 获取失败时使用原始值
|
||||
@@ -705,8 +711,8 @@ func (s *ApiApplicationServiceImpl) GetAdminApiCalls(ctx context.Context, filter
|
||||
SecretKey: apiUser.SecretKey,
|
||||
})
|
||||
if err != nil {
|
||||
s.logger.Error("解密请求参数失败",
|
||||
zap.Error(err),
|
||||
s.logger.Error("解密请求参数失败",
|
||||
zap.Error(err),
|
||||
zap.String("call_id", call.ID),
|
||||
zap.String("user_id", *call.UserId))
|
||||
// 解密失败时使用原始值
|
||||
@@ -715,7 +721,7 @@ func (s *ApiApplicationServiceImpl) GetAdminApiCalls(ctx context.Context, filter
|
||||
if jsonBytes, err := json.Marshal(decryptedParams); err == nil {
|
||||
requestParamsStr = string(jsonBytes)
|
||||
} else {
|
||||
s.logger.Error("序列化解密参数失败",
|
||||
s.logger.Error("序列化解密参数失败",
|
||||
zap.Error(err),
|
||||
zap.String("call_id", call.ID))
|
||||
// 序列化失败时使用原始值
|
||||
|
||||
Reference in New Issue
Block a user