csx 4 年之前
父節點
當前提交
276af875fd
共有 1 個文件被更改,包括 9 次插入13 次删除
  1. 9 13
      controllers/sg/his_api_controller.go

+ 9 - 13
controllers/sg/his_api_controller.go 查看文件

@@ -72,17 +72,18 @@ func HisManagerApiRegistRouters() {
72 72
 
73 73
 }
74 74
 
75
-var (
76
-	str  = make([]byte, 0)
77
-	str1 = make([]byte, 0)
78
-)
79
-
80 75
 func (c *HisApiController) TestPay() {
81 76
 	DllDef := syscall.MustLoadDLL("SSSE32.dll")
82
-	readCard := DllDef.MustFindProc("ReadCardBas")
77
+	readCard := DllDef.MustFindProc("BankTrans")
78
+	inputData := make(map[string]interface{})
79
+	inputData["transId"] = "05"
80
+	inputData["amount"] = "0.01"
81
+	inputData["traceNo"] = "1122233444455555"
82
+	inputData["cardNo"] = "F36084348"
83
+	inputData["id"] = "44022919620927046X"
84
+	bytes_arr, _ := json.Marshal(inputData)
83 85
 	str := make([]byte, 256)
84
-	str1 := make([]byte, 256)
85
-	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
86
+	ret2, _, err2 := readCard.Call(bytes_arr, (uintptr)(unsafe.Pointer(&str[0])))
86 87
 	if err2 != nil {
87 88
 		fmt.Println("SSCard的运算结果为:", ret2)
88 89
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
@@ -104,7 +105,6 @@ func (c *HisApiController) TestGetBasBaseInfo() {
104 105
 	//C.free(unsafe.Pointer(cs2))
105 106
 
106 107
 	//
107
-	runtime.GC()
108 108
 
109 109
 	DllDef := syscall.MustLoadDLL("SSCard.dll")
110 110
 	Iinit := DllDef.MustFindProc("Init")
@@ -126,17 +126,13 @@ func (c *HisApiController) TestGetBasBaseInfo() {
126 126
 	//ssss
127 127
 
128 128
 	str := make([]byte, 256)
129
-
130 129
 	str1 := make([]byte, 256)
131
-
132 130
 	s2 := []byte(string(str))
133 131
 	s3 := []byte(string(str1))
134
-
135 132
 	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&s2[0])), IntPtr(256), (uintptr)(unsafe.Pointer(&s3[0])), IntPtr(256))
136 133
 	fmt.Println(" Add(4,5)的结果为:", ret2)
137 134
 	fmt.Println(" str:", s2)
138 135
 	fmt.Println(" str1:", s3)
139
-	runtime.GC()
140 136
 	if err2 != nil {
141 137
 		fmt.Println("SSCard的运算结果为:", ret2)
142 138
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)