fix
This commit is contained in:
@@ -28,7 +28,7 @@ func ProcessCOMB86PMRequest(ctx context.Context, params []byte, deps *processors
|
|||||||
}
|
}
|
||||||
// 如果有ApiCode为FLXG54F5的子产品,改名为FLXG54F6
|
// 如果有ApiCode为FLXG54F5的子产品,改名为FLXG54F6
|
||||||
for _, resp := range combinedResult.Responses {
|
for _, resp := range combinedResult.Responses {
|
||||||
if resp.ApiCode == "FLXG54F5" {
|
if resp.ApiCode == "FLXGBC21" {
|
||||||
resp.ApiCode = "FLXG54F5"
|
resp.ApiCode = "FLXG54F5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ package flxg
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProcessFLXG0V3Bequest FLXG0V3B API处理方法
|
// ProcessFLXG0V3Bequest FLXG0V3B API处理方法
|
||||||
@@ -31,27 +32,20 @@ func ProcessFLXG0V3Bequest(ctx context.Context, params []byte, deps *processors.
|
|||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// mock 1秒,不用真实请求
|
reqData := map[string]interface{}{
|
||||||
// 模拟耗时
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return nil, ctx.Err()
|
|
||||||
case <-time.After(1 * time.Second):
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构造模拟响应
|
|
||||||
mockResp := map[string]interface{}{
|
|
||||||
"code": 0,
|
|
||||||
"msg": "mock success",
|
|
||||||
"data": map[string]interface{}{
|
"data": map[string]interface{}{
|
||||||
"name": encryptedName,
|
"name": encryptedName,
|
||||||
"id_card": encryptedIDCard,
|
"id_card": encryptedIDCard,
|
||||||
"result": "mocked",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
respBytes, err := json.Marshal(mockResp)
|
|
||||||
|
respBytes, err := deps.WestDexService.CallAPI("G34BJ03", reqData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
if errors.Is(err, westdex.ErrDatasource) {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrDatasource, err)
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("%s: %w", processors.ErrSystem, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return respBytes, nil
|
return respBytes, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user