Files
hyapi-server/internal/infrastructure/external/jiyi/call_options.go
2026-07-22 17:15:33 +08:00

41 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package jiyi
// CallMode 请求组装模式(不同产品加密字段位置不同)
type CallMode int
const (
// CallModePlain 明文,不附加 encryptType/encryptionType/timestamp
CallModePlain CallMode = iota
// CallModeBodyEncrypt 洞侦类body.encryptType0 明文 / 1 MD5并自动补 timestamp
CallModeBodyEncrypt
// CallModeTopEncrypt 借贷意向类:顶层 encryptionType1 明文 / 2 MD5
CallModeTopEncrypt
)
// CallOptions 调用选项
type CallOptions struct {
Mode CallMode
// EncryptValue
// - CallModeBodyEncrypt0 明文1 MD5默认 0
// - CallModeTopEncrypt1 明文2 MD5默认 1
EncryptValue int
}
// DefaultCallOptions 默认:明文且不注入额外字段
func DefaultCallOptions() CallOptions {
return CallOptions{Mode: CallModePlain}
}
// CaveInvestOptions 洞侦1.0 等body 内 encryptType + timestamp
func CaveInvestOptions(encryptType int) CallOptions {
return CallOptions{Mode: CallModeBodyEncrypt, EncryptValue: encryptType}
}
// TopEncryptionOptions 借贷意向验证3.0 等:顶层 encryptionType
func TopEncryptionOptions(encryptionType int) CallOptions {
if encryptionType <= 0 {
encryptionType = 1
}
return CallOptions{Mode: CallModeTopEncrypt, EncryptValue: encryptionType}
}