Explorar el Código

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx hace 3 años
padre
commit
23f71455f4
Se han modificado 1 ficheros con 38 adiciones y 38 borrados
  1. 38 38
      service/gdyb_service.go

+ 38 - 38
service/gdyb_service.go Ver fichero

@@ -8,13 +8,15 @@ import (
8 8
 	"fmt"
9 9
 	"gdyb/models"
10 10
 	"github.com/astaxie/beego"
11
+	"github.com/go-ole/go-ole"
12
+	"github.com/go-ole/go-ole/oleutil"
11 13
 	"io"
12 14
 	"io/ioutil"
15
+	"log"
13 16
 	"math/rand"
14 17
 	"mime/multipart"
15 18
 	"net/http"
16 19
 	"os"
17
-	"os/exec"
18 20
 	"path/filepath"
19 21
 	"strconv"
20 22
 	"strings"
@@ -60,47 +62,45 @@ func Gdyb1201(certNo string, org_name string, doctor string, fixmedins_code stri
60 62
 
61 63
 	//var x interface{}
62 64
 	//s3 := make([]byte, 256)
63
-	//ole.CoInitialize(0)
64
-	//unknown, err := oleutil.CreateObject("yinhai.yh_hb_sctr")
65
-	//if err != nil {
66
-	//	log.Fatal("CreateObject: ", err)
67
-	//}
68
-	//
69
-	//xxxx := unknown.MustQueryInterface(ole.IID_IDispatch)
70
-	//
71
-	////p := (*string)(unsafe.Pointer(str))
72
-	//var str6 string = ""
73
-	//
74
-	//if err != nil {
75
-	//	log.Fatal("QueryInterface: ", err)
76
-	//}
77
-	//
78
-	//r, err1 := xxxx.CallMethod("yh_hb_call", "1201", string(bytesData), str6)
65
+	ole.CoInitialize(0)
66
+	unknown, err := oleutil.CreateObject("yinhai.yh_hb_sctr")
67
+	if err != nil {
68
+		log.Fatal("CreateObject: ", err)
69
+	}
70
+
71
+	xxxx := unknown.MustQueryInterface(ole.IID_IDispatch)
72
+
73
+	//p := (*string)(unsafe.Pointer(str))
74
+	//var str6 *string
75
+	str := string(make([]byte, 256))
76
+	if err != nil {
77
+		log.Fatal("QueryInterface: ", err)
78
+	}
79
+
80
+	r, err1 := xxxx.CallMethod("yh_hb_call", "1201", string(bytesData), str)
79 81
 	//result := oleutil.MustGetProperty(xxxx, "astr_jysc")
82
+
83
+	if err1 != nil {
84
+		log.Fatal("CallMethod: ", err1, " | ", r)
85
+	}
86
+	fmt.Println("~~~~~~~")
87
+	fmt.Println(str)
88
+	fmt.Println(r)
89
+	fmt.Println("~~~~~~~")
90
+
91
+	xxxx.Release()
92
+
93
+	ole.CoUninitialize()
80 94
 	//
81
-	//if err1 != nil {
82
-	//	log.Fatal("CallMethod: ", err1, " | ", r)
95
+	//var json2 string
96
+	//cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1201", string(bytesData), json2)
97
+	//out, err := cmd.Output()
98
+	//if err != nil {
99
+	//	fmt.Println("error:", err.Error())
83 100
 	//}
84
-	//fmt.Println("~~~~~~~")
85
-	//fmt.Println(result)
86
-	//fmt.Println(r)
87
-	//fmt.Println(s3)
88
-	//fmt.Println(x)
89
-	//fmt.Println("~~~~~~~")
90
-	//
91
-	//xxxx.Release()
92
-	//
93
-	//ole.CoUninitialize()
94 101
 	//
95
-	var json2 string
96
-	cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1201", string(bytesData), json2)
97
-	out, err := cmd.Output()
98
-	if err != nil {
99
-		fmt.Println("error:", err.Error())
100
-	}
101
-
102
-	fmt.Printf("call yh_hb_call %q\n", string(out))
103
-	fmt.Printf(json2)
102
+	//fmt.Printf("call yh_hb_call %q\n", string(out))
103
+	//fmt.Printf(json2)
104 104
 	//
105 105
 	//DllDef := syscall.MustLoadDLL("yh_hb_sctrl.dll")
106 106
 	//Iinit := DllDef.MustFindProc("DllGetClassObject")