Explorar el Código

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

csx hace 3 años
padre
commit
86452f64da
Se han modificado 1 ficheros con 37 adiciones y 39 borrados
  1. 37 39
      service/gdyb_service.go

+ 37 - 39
service/gdyb_service.go Ver fichero

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