f
This commit is contained in:
@@ -47,8 +47,6 @@ func ProcessJRZQO7L1Request(ctx context.Context, params []byte, deps *processors
|
|||||||
"city": null,
|
"city": null,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用 WithSkipCode201Check 不跳过 201 错误检查,当 Code == "201" 时返回错误
|
|
||||||
// ctx = zhicha.WithSkipCode201Check(ctx)
|
|
||||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI080", reqData)
|
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI080", reqData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, zhicha.ErrDatasource) {
|
if errors.Is(err, zhicha.ErrDatasource) {
|
||||||
|
|||||||
@@ -22,22 +22,22 @@ func ProcessQYGL5S1IRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
encryptedEntName, err := deps.ZhichaService.Encrypt(paramsDto.EntName)
|
// encryptedEntName, err := deps.ZhichaService.Encrypt(paramsDto.EntName)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, errors.Join(processors.ErrSystem, err)
|
// return nil, errors.Join(processors.ErrSystem, err)
|
||||||
}
|
// }
|
||||||
encryptedEntCode, err := deps.ZhichaService.Encrypt(paramsDto.EntCode)
|
// encryptedEntCode, err := deps.ZhichaService.Encrypt(paramsDto.EntCode)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, errors.Join(processors.ErrSystem, err)
|
// return nil, errors.Join(processors.ErrSystem, err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 按企业名称时传 enterpriseNo(加密名),按统一信用代码时传 enterpriseName(加密代码)
|
// 按企业名称时传 enterpriseNo(加密名),按统一信用代码时传 enterpriseName(加密代码)
|
||||||
reqData := map[string]interface{}{}
|
reqData := map[string]interface{}{}
|
||||||
if paramsDto.EntName != "" {
|
if paramsDto.EntName != "" {
|
||||||
reqData["enterpriseName"] = encryptedEntName
|
reqData["enterpriseName"] = paramsDto.EntName
|
||||||
}
|
}
|
||||||
if paramsDto.EntCode != "" {
|
if paramsDto.EntCode != "" {
|
||||||
reqData["enterpriseNo"] = encryptedEntCode
|
reqData["enterpriseNo"] = paramsDto.EntCode
|
||||||
}
|
}
|
||||||
|
|
||||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI088", reqData)
|
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI088", reqData)
|
||||||
|
|||||||
@@ -212,11 +212,12 @@ func (z *ZhichaService) CallAPI(ctx context.Context, proID string, params map[st
|
|||||||
|
|
||||||
// 201 表示查询为空,兼容其它情况如果data也为空,则返回空对象
|
// 201 表示查询为空,兼容其它情况如果data也为空,则返回空对象
|
||||||
if zhichaResp.Code == "201" {
|
if zhichaResp.Code == "201" {
|
||||||
// 先做类型断言
|
|
||||||
dataMap, ok := zhichaResp.Data.(map[string]interface{})
|
dataMap, ok := zhichaResp.Data.(map[string]interface{})
|
||||||
if ok && len(dataMap) > 0 {
|
if ok {
|
||||||
|
// 即使是 {},也原样返回
|
||||||
return dataMap, nil
|
return dataMap, nil
|
||||||
}
|
}
|
||||||
|
// 兜底:防止解密异常
|
||||||
return map[string]interface{}{}, nil
|
return map[string]interface{}{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user