f
This commit is contained in:
@@ -40,6 +40,7 @@ type ApiRequestService struct {
|
||||
whitelistService *WhitelistService
|
||||
tianyuanapi *tianyuanapi.Client
|
||||
tianyuanapiCallLogService *TianyuanapiCallLogService
|
||||
authService *AuthorizationService
|
||||
}
|
||||
|
||||
// NewApiRequestService 构造函数
|
||||
@@ -51,6 +52,7 @@ func NewApiRequestService(
|
||||
tianyuanapi *tianyuanapi.Client,
|
||||
tianyuanapiCallLogService *TianyuanapiCallLogService,
|
||||
whitelistService *WhitelistService,
|
||||
authService *AuthorizationService,
|
||||
) *ApiRequestService {
|
||||
return &ApiRequestService{
|
||||
config: c,
|
||||
@@ -60,6 +62,7 @@ func NewApiRequestService(
|
||||
tianyuanapi: tianyuanapi,
|
||||
tianyuanapiCallLogService: tianyuanapiCallLogService,
|
||||
whitelistService: whitelistService,
|
||||
authService: authService,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,6 +241,7 @@ var requestProcessors = map[string]func(*ApiRequestService, []byte) ([]byte, err
|
||||
"IVYZ8I9J": (*ApiRequestService).ProcessIVYZ8I9JRequest,
|
||||
"JRZQ7F1A": (*ApiRequestService).ProcessJRZQ7F1ARequest,
|
||||
"IVYZ3P9M": (*ApiRequestService).ProcessIVYZ3P9MRequest,
|
||||
"IVYZ4Y27": (*ApiRequestService).ProcessIVYZ4Y27Request,
|
||||
}
|
||||
|
||||
// PreprocessRequestApi 调用指定的请求处理函数
|
||||
@@ -1608,3 +1612,33 @@ func (a *ApiRequestService) ProcessIVYZ3P9MRequest(params []byte) ([]byte, error
|
||||
|
||||
return convertTianyuanResponse(resp)
|
||||
}
|
||||
|
||||
// ProcessIVYZ4Y27Request 学历信息查询(需生成专用授权书PDF并Base64编码传入)
|
||||
func (a *ApiRequestService) ProcessIVYZ4Y27Request(params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !name.Exists() || !idCard.Exists() {
|
||||
return nil, errors.New("api请求, IVYZ4Y27, 获取相关参数失败")
|
||||
}
|
||||
|
||||
// 生成专用授权书PDF并Base64编码
|
||||
userInfo := map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
}
|
||||
authFileBase64, err := a.authService.GenerateIVYZ4Y27AuthorizationBase64(userInfo)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("生成IVYZ4Y27授权书失败: %v", err)
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("IVYZ4Y27", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"auth_authorize_file_base64": authFileBase64,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return convertTianyuanResponse(resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user