This commit is contained in:
2026-07-22 17:40:57 +08:00
parent 39a97f106c
commit 14d96fabbe
7 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
package jrzq
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/jiyi"
)
// ProcessJRZQP8D2Request 全景雷达BH上游 jy000003查空不计费三要素 MD5 入参)
func ProcessJRZQP8D2Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.JRZQP8D2Req
if err := json.Unmarshal(params, &paramsDto); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
return nil, errors.Join(processors.ErrInvalidParam, err)
}
body := map[string]string{
"name": jiyi.MD5Encrypt(paramsDto.Name),
"idCard": jiyi.MD5Encrypt(paramsDto.IDCard),
"mobile": jiyi.MD5Encrypt(paramsDto.MobileNo),
}
apiKey := "jy000003"
apiPath := "/api/v1/panorama/encrypt"
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.DefaultCallOptions())
if err != nil {
if errors.Is(err, jiyi.ErrDatasource) {
return nil, errors.Join(processors.ErrDatasource, err)
}
if errors.Is(err, jiyi.ErrNotFound) {
return nil, errors.Join(processors.ErrNotFound, err)
}
return nil, errors.Join(processors.ErrSystem, err)
}
respBytes, err := json.Marshal(resp.Data)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
return respBytes, nil
}