f
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package jrzq
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/haiyuapi"
|
||||
)
|
||||
|
||||
// ProcessJRZQK9P2Request JRZQK9P2 API处理方法 - 洞侦1.0(转发海宇 JRZQK9P2,查空计费)
|
||||
func ProcessJRZQK9P2Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.JRZQK9P2Req
|
||||
if err := json.Unmarshal(params, ¶msDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
if deps.HaiyuapiService == nil {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("海宇API服务未初始化"))
|
||||
}
|
||||
|
||||
reqParams := map[string]interface{}{
|
||||
"name": paramsDto.Name,
|
||||
"id_card": paramsDto.IDCard,
|
||||
"mobile_no": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
respBytes, err := deps.HaiyuapiService.CallAPI(ctx, "JRZQK9P2", reqParams)
|
||||
if err != nil {
|
||||
if errors.Is(err, haiyuapi.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
if errors.Is(err, haiyuapi.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
return respBytes, nil
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package jrzq
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/haiyuapi"
|
||||
)
|
||||
|
||||
// ProcessJRZQP8D2Request JRZQP8D2 API处理方法 - 全景雷达BH(转发海宇 JRZQP8D2,查空不计费)
|
||||
func ProcessJRZQP8D2Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.JRZQP8D2Req
|
||||
if err := json.Unmarshal(params, ¶msDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
if deps.HaiyuapiService == nil {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("海宇API服务未初始化"))
|
||||
}
|
||||
|
||||
reqParams := map[string]interface{}{
|
||||
"name": paramsDto.Name,
|
||||
"id_card": paramsDto.IDCard,
|
||||
"mobile_no": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
respBytes, err := deps.HaiyuapiService.CallAPI(ctx, "JRZQP8D2", reqParams)
|
||||
if err != nil {
|
||||
if errors.Is(err, haiyuapi.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
if errors.Is(err, haiyuapi.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
return respBytes, nil
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package jrzq
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/haiyuapi"
|
||||
)
|
||||
|
||||
// ProcessJRZQR4N7Request JRZQR4N7 API处理方法 - 借贷意向验证3.0(转发海宇 JRZQR4N7,查空计费)
|
||||
func ProcessJRZQR4N7Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.JRZQR4N7Req
|
||||
if err := json.Unmarshal(params, ¶msDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
if deps.HaiyuapiService == nil {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("海宇API服务未初始化"))
|
||||
}
|
||||
|
||||
reqParams := map[string]interface{}{
|
||||
"name": paramsDto.Name,
|
||||
"id_card": paramsDto.IDCard,
|
||||
"mobile_no": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
respBytes, err := deps.HaiyuapiService.CallAPI(ctx, "JRZQR4N7", reqParams)
|
||||
if err != nil {
|
||||
if errors.Is(err, haiyuapi.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
if errors.Is(err, haiyuapi.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
return respBytes, nil
|
||||
}
|
||||
Reference in New Issue
Block a user