|
@@ -67,7 +67,7 @@ func HisManagerApiRegistRouters() {
|
67
|
67
|
beego.Router("/api/psn/ncds/putonrecord", &HisApiController{}, "get:PsnPutNCDSOnRecord")
|
68
|
68
|
beego.Router("/api/psn/ncds/unputonrecord", &HisApiController{}, "get:PsnPutUnNCDSOnRecord")
|
69
|
69
|
|
70
|
|
- beego.Router("/api/test", &HisApiController{}, "get:TestTest")
|
|
70
|
+ beego.Router("/api/test", &HisApiController{}, "get:TestGetBasBaseInfo")
|
71
|
71
|
|
72
|
72
|
beego.Router("/api/reversal", &HisApiController{}, "get:ReversalData")
|
73
|
73
|
beego.Router("/api/reversal/other", &HisApiController{}, "get:ReversalOtherData")
|
|
@@ -76,6 +76,68 @@ func HisManagerApiRegistRouters() {
|
76
|
76
|
|
77
|
77
|
}
|
78
|
78
|
|
|
79
|
+func (c *HisApiController) TestGetBasBaseInfo() {
|
|
80
|
+ DllDef := syscall.MustLoadDLL("SSCard.dll")
|
|
81
|
+ defer syscall.FreeLibrary(DllDef)
|
|
82
|
+ Iinit:= DllDef.MustFindProc("Init")
|
|
83
|
+ readCard := DllDef.MustFindProc("ReadCardBas")
|
|
84
|
+ ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
|
|
85
|
+ if ret != 0 {
|
|
86
|
+ fmt.Println("SSCard的报错原因:", err)
|
|
87
|
+ fmt.Println("SSCard的运算结果为:", ret)
|
|
88
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
89
|
+ return
|
|
90
|
+ }
|
|
91
|
+
|
|
92
|
+ result := int(ret)
|
|
93
|
+ fmt.Println("SSCard的运算结果为1:", result)
|
|
94
|
+
|
|
95
|
+ if readCard == nil {
|
|
96
|
+ fmt.Println("readcard is nil")
|
|
97
|
+ readCard = DllDef.MustFindProc("ReadCardBas")
|
|
98
|
+ }
|
|
99
|
+ if readCard == nil {
|
|
100
|
+ fmt.Println("readcard reload is nil")
|
|
101
|
+ return
|
|
102
|
+ }
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+ str := make([]byte, 1024)
|
|
106
|
+ str1 := make([]byte, 1024)
|
|
107
|
+ cdat:=len(str)
|
|
108
|
+ cdat1:=len(str1)
|
|
109
|
+ p:= *((*int32)(unsafe.Pointer(&str[0])))
|
|
110
|
+ p1:= *((*int32)(unsafe.Pointer(&str1[0])))
|
|
111
|
+ ret2, _, err2 := readCard.Call(uintptr(p), uintptr(cdat), uintptr(p1), uintptr(cdat1))
|
|
112
|
+ fmt.Println(" Add(4,5)的结果为:", ret2)
|
|
113
|
+ str11 := prttostr(uintptr(p))
|
|
114
|
+ str22 := prttostr(uintptr(p1))
|
|
115
|
+
|
|
116
|
+ fmt.Println(" str:", str11)
|
|
117
|
+ fmt.Println(" str1:", str22)
|
|
118
|
+ // runtime.GC()
|
|
119
|
+ if err2 != nil {
|
|
120
|
+ fmt.Println("SSCard的运算结果为:", ret2)
|
|
121
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
122
|
+ return
|
|
123
|
+ }
|
|
124
|
+
|
|
125
|
+}
|
|
126
|
+
|
|
127
|
+func prttostr(vcode uintptr) string {
|
|
128
|
+ var vbyte []byte
|
|
129
|
+ for i:=0;i<10;i++{
|
|
130
|
+ sbyte:=*((*byte)(unsafe.Pointer(vcode)))
|
|
131
|
+ if sbyte==0{
|
|
132
|
+ break
|
|
133
|
+ }
|
|
134
|
+ vbyte=append(vbyte,sbyte)
|
|
135
|
+ vcode += 1
|
|
136
|
+ }
|
|
137
|
+ return string(vbyte)
|
|
138
|
+ }
|
|
139
|
+
|
|
140
|
+
|
79
|
141
|
//func (c *HisApiController) TestPay() {
|
80
|
142
|
// DllDef2 := syscall.MustLoadDLL("SSSE32.dll")
|
81
|
143
|
// readCards := DllDef2.MustFindProc("BankTrans")
|