This commit is contained in:
Mrx
2026-02-12 16:56:17 +08:00
parent 54e3edfea7
commit b3105417ec
2 changed files with 4 additions and 3 deletions

View File

@@ -1975,7 +1975,7 @@ type PaymentReq struct {
Id string `json:"id"` Id string `json:"id"`
PayMethod string `json:"pay_method"` // 支付方式: wechat, alipay, appleiap, test(仅开发环境), test_empty(仅开发环境-空报告模式) PayMethod string `json:"pay_method"` // 支付方式: wechat, alipay, appleiap, test(仅开发环境), test_empty(仅开发环境-空报告模式)
PayType string `json:"pay_type" validate:"required,oneof=query agent_vip agent_upgrade whitelist"` PayType string `json:"pay_type" validate:"required,oneof=query agent_vip agent_upgrade whitelist"`
Code string `json:"code"` // 微信小程序登录 code用于未绑定 openid 时换取 openid 并调起支付(可选) Code string `json:"code,optional"` // 微信小程序登录 code未绑定 openid 时传此参数以换取 openid 并调起支付
} }
type PaymentResp struct { type PaymentResp struct {

View File

@@ -78,7 +78,7 @@ func TestDecryptIDCard(t *testing.T) {
// TestEncryptIDCard_DecryptIDCard 身份证加密解密 round-trip 测试 // TestEncryptIDCard_DecryptIDCard 身份证加密解密 round-trip 测试
func TestEncryptIDCard_DecryptIDCard(t *testing.T) { func TestEncryptIDCard_DecryptIDCard(t *testing.T) {
idCard := "360733199005090032" idCard := "51018219920914121x"
key, _ := hex.DecodeString("ff83609b2b24fc73196aac3d3dfb874f") key, _ := hex.DecodeString("ff83609b2b24fc73196aac3d3dfb874f")
// 加密 // 加密
@@ -89,10 +89,11 @@ func TestEncryptIDCard_DecryptIDCard(t *testing.T) {
} }
fmt.Printf("encrypted: %s\n", encrypted) fmt.Printf("encrypted: %s\n", encrypted)
// 解密 // 解密
decrypted, err := DecryptIDCard(encrypted, key) decrypted, err := DecryptIDCard("Ix2KZkm22Uuw8FfgmWYzdRoo7lEtuTpiT8mwkQqNrdk=", key)
if err != nil { if err != nil {
t.Fatalf("身份证解密失败: %v", err) t.Fatalf("身份证解密失败: %v", err)
} }
fmt.Printf("decrypted: %s\n", decrypted)
if decrypted != idCard { if decrypted != idCard {
t.Errorf("解密结果不匹配,期望: %s, 实际: %s", idCard, decrypted) t.Errorf("解密结果不匹配,期望: %s, 实际: %s", idCard, decrypted)