csx 3 years ago
parent
commit
729423d0fe
1 changed files with 8 additions and 11 deletions
  1. 8 11
      controllers/sg/his_api_controller.go

+ 8 - 11
controllers/sg/his_api_controller.go View File

@@ -52,15 +52,14 @@ func HisManagerApiRegistRouters() {
52 52
 
53 53
 }
54 54
 
55
-var (
56
-	DllDef   = syscall.MustLoadDLL("SSCard.dll")
57
-	Iinit    = DllDef.MustFindProc("Init")
58
-	readCard = DllDef.MustFindProc("ReadCardBas")
59
-	str      = make([]byte, 256)
60
-	str1     = make([]byte, 256)
61
-)
55
+var ()
62 56
 
63 57
 func (c *HisApiController) TestGetBasBaseInfo() {
58
+	runtime.GC()
59
+
60
+	DllDef := syscall.MustLoadDLL("SSCard.dll")
61
+	Iinit := DllDef.MustFindProc("Init")
62
+	readCard := DllDef.MustFindProc("ReadCardBas")
64 63
 	ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
65 64
 	if ret != 0 {
66 65
 		fmt.Println("SSCard的报错原因:", err)
@@ -81,10 +80,8 @@ func (c *HisApiController) TestGetBasBaseInfo() {
81 80
 		return
82 81
 	}
83 82
 
84
-	str = nil
85
-	str1 = nil
86
-	str = make([]byte, 256)
87
-	str1 = make([]byte, 256)
83
+	str := make([]byte, 256)
84
+	str1 := make([]byte, 256)
88 85
 	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), 0, (uintptr)(unsafe.Pointer(&str1[0])), 0)
89 86
 	fmt.Println(" Add(4,5)的结果为:", ret2)
90 87
 	fmt.Println(" str:", str)