This commit is contained in:
Mrx
2026-04-23 17:59:23 +08:00
parent d6b78a5d6d
commit a1024ed4b2
3 changed files with 13 additions and 14 deletions

View File

@@ -47,8 +47,6 @@ func ProcessJRZQO7L1Request(ctx context.Context, params []byte, deps *processors
"city": null,
}
// 使用 WithSkipCode201Check 不跳过 201 错误检查,当 Code == "201" 时返回错误
// ctx = zhicha.WithSkipCode201Check(ctx)
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI080", reqData)
if err != nil {
if errors.Is(err, zhicha.ErrDatasource) {

View File

@@ -22,22 +22,22 @@ func ProcessQYGL5S1IRequest(ctx context.Context, params []byte, deps *processors
return nil, errors.Join(processors.ErrInvalidParam, err)
}
encryptedEntName, err := deps.ZhichaService.Encrypt(paramsDto.EntName)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
encryptedEntCode, err := deps.ZhichaService.Encrypt(paramsDto.EntCode)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
// encryptedEntName, err := deps.ZhichaService.Encrypt(paramsDto.EntName)
// if err != nil {
// return nil, errors.Join(processors.ErrSystem, err)
// }
// encryptedEntCode, err := deps.ZhichaService.Encrypt(paramsDto.EntCode)
// if err != nil {
// return nil, errors.Join(processors.ErrSystem, err)
// }
// 按企业名称时传 enterpriseNo加密名按统一信用代码时传 enterpriseName加密代码
reqData := map[string]interface{}{}
if paramsDto.EntName != "" {
reqData["enterpriseName"] = encryptedEntName
reqData["enterpriseName"] = paramsDto.EntName
}
if paramsDto.EntCode != "" {
reqData["enterpriseNo"] = encryptedEntCode
reqData["enterpriseNo"] = paramsDto.EntCode
}
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI088", reqData)

View File

@@ -212,11 +212,12 @@ func (z *ZhichaService) CallAPI(ctx context.Context, proID string, params map[st
// 201 表示查询为空兼容其它情况如果data也为空则返回空对象
if zhichaResp.Code == "201" {
// 先做类型断言
dataMap, ok := zhichaResp.Data.(map[string]interface{})
if ok && len(dataMap) > 0 {
if ok {
// 即使是 {},也原样返回
return dataMap, nil
}
// 兜底:防止解密异常
return map[string]interface{}{}, nil
}