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

+ 19 - 22
controllers/sg/his_api_controller.go 查看文件

@@ -60,32 +60,15 @@ var (
60 60
 	str1     = make([]byte, 256)
61 61
 )
62 62
 
63
-func (c *HisApiController) TestGetBasBaseInfo() {
64
-	ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
65
-	if ret != 0 {
66
-		fmt.Println("SSCard的报错原因:", err)
67
-		fmt.Println("SSCard的运算结果为:", ret)
68
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
69
-		return
70
-	}
71
-
72
-	result := int(ret)
73
-	fmt.Println("SSCard的运算结果为1:", result)
74
-
75
-	if readCard == nil {
76
-		fmt.Println("readcard is nil")
77
-		readCard = DllDef.MustFindProc("ReadCardBas")
78
-	}
79
-	if readCard == nil {
80
-		fmt.Println("readcard reload  is nil")
81
-		return
82
-	}
63
+func GetBasBaseInfo() {
64
+	DllDef2 := syscall.MustLoadDLL("SSCard.dll")
65
+	readCard := DllDef2.MustFindProc("ReadCardBas")
83 66
 
84 67
 	str = nil
85 68
 	str1 = nil
86 69
 	str = make([]byte, 256)
87 70
 	str1 = make([]byte, 256)
88
-	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), 0, (uintptr)(unsafe.Pointer(&str1[0])), 0)
71
+	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
89 72
 	fmt.Println(" Add(4,5)的结果为:", ret2)
90 73
 	fmt.Println(" str:", str)
91 74
 	fmt.Println(" str1:", str1)
@@ -93,13 +76,27 @@ func (c *HisApiController) TestGetBasBaseInfo() {
93 76
 	str1 = nil
94 77
 	str = make([]byte, 256)
95 78
 	str1 = make([]byte, 256)
96
-	runtime.GC()
97 79
 	if err2 != nil {
98 80
 		fmt.Println("SSCard的运算结果为:", ret2)
81
+		return
82
+	}
83
+
84
+}
85
+
86
+func (c *HisApiController) TestGetBasBaseInfo() {
87
+	ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
88
+	if ret != 0 {
89
+		fmt.Println("SSCard的报错原因:", err)
90
+		fmt.Println("SSCard的运算结果为:", ret)
99 91
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
100 92
 		return
101 93
 	}
102 94
 
95
+	result := int(ret)
96
+	fmt.Println("SSCard的运算结果为1:", result)
97
+
98
+	go GetBasBaseInfo()
99
+
103 100
 }
104 101
 
105 102
 func (c *HisApiController) GetOrgInfo() {