fix flxg5b2e flxg8a3f
This commit is contained in:
@@ -62,7 +62,7 @@ jwt:
|
|||||||
refresh_expires_in: 168h
|
refresh_expires_in: 168h
|
||||||
|
|
||||||
api:
|
api:
|
||||||
domain: "apitest.tianyuanapi.com"
|
domain: "api.tianyuanapi.com"
|
||||||
|
|
||||||
sms:
|
sms:
|
||||||
access_key_id: "LTAI5tKGB3TVJbMHSoZN3yr9"
|
access_key_id: "LTAI5tKGB3TVJbMHSoZN3yr9"
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ jwt:
|
|||||||
secret: JwT8xR4mN9vP2sL7kH3oB6yC1zA5uF0qE9tW
|
secret: JwT8xR4mN9vP2sL7kH3oB6yC1zA5uF0qE9tW
|
||||||
|
|
||||||
api:
|
api:
|
||||||
domain: "apitest.tianyuanapi.com"
|
domain: "api.tianyuanapi.com"
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# 📁 存储服务配置 - 七牛云
|
# 📁 存储服务配置 - 七牛云
|
||||||
# ===========================================
|
# ===========================================
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ func ProcessFLXG0V4BRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
}
|
}
|
||||||
|
if deps.CallContext.ContractCode == "" {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, errors.New("合同编号不能为空"))
|
||||||
|
}
|
||||||
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
"tyapi-server/internal/domains/api/dto"
|
"tyapi-server/internal/domains/api/dto"
|
||||||
"tyapi-server/internal/domains/api/services/processors"
|
"tyapi-server/internal/domains/api/services/processors"
|
||||||
"tyapi-server/internal/infrastructure/external/westdex"
|
"tyapi-server/internal/infrastructure/external/westdex"
|
||||||
|
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProcessFLXG5B2ERequest FLXG5B2E API处理方法
|
// ProcessFLXG5B2ERequest FLXG5B2E API处理方法
|
||||||
@@ -31,21 +33,56 @@ func ProcessFLXG5B2ERequest(ctx context.Context, params []byte, deps *processors
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
}
|
}
|
||||||
|
if deps.CallContext.ContractCode == "" {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, errors.New("合同编号不能为空"))
|
||||||
|
}
|
||||||
|
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
|
}
|
||||||
reqData := map[string]interface{}{
|
reqData := map[string]interface{}{
|
||||||
"data": map[string]interface{}{
|
"data": map[string]interface{}{
|
||||||
"name": encryptedName,
|
"name": encryptedName,
|
||||||
"idcard": encryptedIDCard,
|
"idcard": encryptedIDCard,
|
||||||
|
"auth_authorizeFileCode": encryptedAuthAuthorizeFileCode,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
respBytes, err := deps.WestDexService.CallAPI("G36SC01", reqData)
|
respBytes, err := deps.WestDexService.CallAPI("G36SC01", reqData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, westdex.ErrDatasource) {
|
if errors.Is(err, westdex.ErrDatasource) {
|
||||||
|
// 如果有返回内容,优先解析返回内容
|
||||||
|
if respBytes != nil {
|
||||||
|
parsed, parseErr := ParseJsonResponse(respBytes)
|
||||||
|
if parseErr == nil {
|
||||||
|
// 通过gjson获取指定路径的数据
|
||||||
|
contentResult := gjson.GetBytes(parsed, "G36SC0101.G36SC0102.content")
|
||||||
|
if contentResult.Exists() {
|
||||||
|
return []byte(contentResult.Raw), fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
return parsed, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
// 解析失败,返回原始内容和系统错误
|
||||||
|
return respBytes, fmt.Errorf("%s: %w", processors.ErrSystem, parseErr)
|
||||||
|
}
|
||||||
|
// 没有返回内容,直接返回数据源错误
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
} else {
|
} else {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return respBytes, nil
|
// 正常返回 - 不管有没有deps.Options.Json都进行ParseJsonResponse
|
||||||
}
|
parsed, parseErr := ParseJsonResponse(respBytes)
|
||||||
|
if parseErr != nil {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, parseErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过gjson获取指定路径的数据
|
||||||
|
contentResult := gjson.GetBytes(parsed, "G36SC0101.G36SC0102.content")
|
||||||
|
if contentResult.Exists() {
|
||||||
|
return []byte(contentResult.Raw), nil
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
"tyapi-server/internal/domains/api/dto"
|
"tyapi-server/internal/domains/api/dto"
|
||||||
"tyapi-server/internal/domains/api/services/processors"
|
"tyapi-server/internal/domains/api/services/processors"
|
||||||
"tyapi-server/internal/infrastructure/external/westdex"
|
"tyapi-server/internal/infrastructure/external/westdex"
|
||||||
|
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProcessFLXG8A3FRequest FLXG8A3F API处理方法
|
// ProcessFLXG8A3FRequest FLXG8A3F API处理方法
|
||||||
@@ -31,22 +33,55 @@ func ProcessFLXG8A3FRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
}
|
}
|
||||||
|
if deps.CallContext.ContractCode == "" {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, errors.New("合同编号不能为空"))
|
||||||
|
}
|
||||||
|
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
|
}
|
||||||
reqData := map[string]interface{}{
|
reqData := map[string]interface{}{
|
||||||
"data": map[string]interface{}{
|
"data": map[string]interface{}{
|
||||||
"name": encryptedName,
|
"name": encryptedName,
|
||||||
"idcard": encryptedIDCard,
|
"idcard": encryptedIDCard,
|
||||||
|
"auth_authorizeFileCode": encryptedAuthAuthorizeFileCode,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
respBytes, err := deps.WestDexService.CallAPI("G37SC01", reqData)
|
respBytes, err := deps.WestDexService.CallAPI("G37SC01", reqData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, westdex.ErrDatasource) {
|
if errors.Is(err, westdex.ErrDatasource) {
|
||||||
|
// 如果有返回内容,优先解析返回内容
|
||||||
|
if respBytes != nil {
|
||||||
|
parsed, parseErr := ParseJsonResponse(respBytes)
|
||||||
|
if parseErr == nil {
|
||||||
|
// 通过gjson获取指定路径的数据
|
||||||
|
contentResult := gjson.GetBytes(parsed, "G37SC0101.G37SC0102.content")
|
||||||
|
if contentResult.Exists() {
|
||||||
|
return []byte(contentResult.Raw), fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
return parsed, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
// 解析失败,返回原始内容和系统错误
|
||||||
|
return respBytes, fmt.Errorf("%s: %w", processors.ErrSystem, parseErr)
|
||||||
|
}
|
||||||
|
// 没有返回内容,直接返回数据源错误
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
} else {
|
} else {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 正常返回 - 不管有没有deps.Options.Json都进行ParseJsonResponse
|
||||||
|
parsed, parseErr := ParseJsonResponse(respBytes)
|
||||||
|
if parseErr != nil {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, parseErr)
|
||||||
|
}
|
||||||
|
|
||||||
return respBytes, nil
|
// 通过gjson获取指定路径的数据
|
||||||
|
contentResult := gjson.GetBytes(parsed, "G37SC0101.G37SC0102.content")
|
||||||
|
if contentResult.Exists() {
|
||||||
|
return []byte(contentResult.Raw), nil
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ func ProcessQYGL8271Request(ctx context.Context, params []byte, deps *processors
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
}
|
}
|
||||||
|
if deps.CallContext.ContractCode == "" {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, errors.New("合同编号不能为空"))
|
||||||
|
}
|
||||||
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
encryptedAuthAuthorizeFileCode, err := deps.WestDexService.Encrypt(deps.CallContext.ContractCode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user