add JRZQ09J8、FLXGDEA8、FLXGDEA9、JRZQ1D09

add external_services log
This commit is contained in:
2025-08-25 15:44:06 +08:00
parent 365a2a8886
commit 267ff92998
80 changed files with 5555 additions and 1254 deletions

View File

@@ -176,7 +176,11 @@ func (s *ApiApplicationServiceImpl) CallApi(ctx context.Context, cmd *commands.A
callContext := &processors.CallContext{
ContractCode: contractCode,
}
response, err := s.apiRequestService.PreprocessRequestApi(txCtx, cmd.ApiName, requestParams, &cmd.Options, callContext)
// 将transactionId放入ctx中供外部服务使用
ctxWithTransactionId := context.WithValue(txCtx, "transaction_id", transactionId)
response, err := s.apiRequestService.PreprocessRequestApi(ctxWithTransactionId, cmd.ApiName, requestParams, &cmd.Options, callContext)
if err != nil {
if errors.Is(err, processors.ErrDatasource) {
s.logger.Error("调用API失败", zap.Error(err))

View File

@@ -104,6 +104,29 @@ func (s *ProductApplicationServiceImpl) DeleteProduct(ctx context.Context, cmd *
func (s *ProductApplicationServiceImpl) ListProducts(ctx context.Context, filters map[string]interface{}, options interfaces.ListOptions) (*responses.ProductListResponse, error) {
// 检查是否有用户ID如果有则使用带订阅状态的方法
if userID, ok := filters["user_id"].(string); ok && userID != "" {
// 测试日志系统 - 主动记录错误信息
s.logger.Error("测试错误日志记录",
zap.String("method", "ListProducts"),
zap.String("error_type", "test_error"),
zap.String("error_message", "这是一个测试错误,用于验证日志系统"),
zap.Int("products_count", 0),
zap.Int64("total", 0),
zap.String("test_scenario", "主动错误记录测试"),
)
// 测试日志系统 - 记录一些信息
s.logger.Info("准备测试日志系统",
zap.String("method", "ListProducts"),
zap.Int("products_count", 0),
zap.Int64("total", 0),
)
// 测试日志系统 - 模拟空指针异常
s.logger.Warn("即将触发空指针异常进行测试")
// // 模拟空指针异常,用于测试
// var testPtr *int
// _ = *testPtr // 这里会触发空指针异常
return s.ListProductsWithSubscriptionStatus(ctx, filters, options)
}