|
@@ -21,6 +21,7 @@ import (
|
21
|
21
|
"os"
|
22
|
22
|
"path/filepath"
|
23
|
23
|
"runtime"
|
|
24
|
+ _ "runtime/cgo"
|
24
|
25
|
"strconv"
|
25
|
26
|
"strings"
|
26
|
27
|
"syscall"
|
|
@@ -50,12 +51,27 @@ func HisManagerApiRegistRouters() {
|
50
|
51
|
beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
|
51
|
52
|
beego.Router("/api/testcard", &HisApiController{}, "get:TestGetBasBaseInfo")
|
52
|
53
|
|
|
54
|
+ beego.Router("/api/testpay", &HisApiController{}, "get:TestPay")
|
|
55
|
+
|
53
|
56
|
}
|
54
|
57
|
|
55
|
|
-var ()
|
|
58
|
+func (c *HisApiController) TestPay() {
|
|
59
|
+ runtime.GC()
|
|
60
|
+ DllDef := syscall.MustLoadDLL("SSSE32.dll")
|
|
61
|
+ readCard := DllDef.MustFindProc("ReadCardBas")
|
|
62
|
+ str := make([]byte, 256)
|
|
63
|
+ str1 := make([]byte, 256)
|
|
64
|
+ ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
|
65
|
+ runtime.GC()
|
|
66
|
+ if err2 != nil {
|
|
67
|
+ fmt.Println("SSCard的运算结果为:", ret2)
|
|
68
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
69
|
+ return
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+}
|
56
|
73
|
|
57
|
74
|
func (c *HisApiController) TestGetBasBaseInfo() {
|
58
|
|
- runtime.GC()
|
59
|
75
|
|
60
|
76
|
DllDef := syscall.MustLoadDLL("SSCard.dll")
|
61
|
77
|
Iinit := DllDef.MustFindProc("Init")
|
|
@@ -86,7 +102,6 @@ func (c *HisApiController) TestGetBasBaseInfo() {
|
86
|
102
|
fmt.Println(" Add(4,5)的结果为:", ret2)
|
87
|
103
|
fmt.Println(" str:", str)
|
88
|
104
|
fmt.Println(" str1:", str1)
|
89
|
|
- runtime.GC()
|
90
|
105
|
if err2 != nil {
|
91
|
106
|
fmt.Println("SSCard的运算结果为:", ret2)
|
92
|
107
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|