|
@@ -5,6 +5,7 @@ import (
|
5
|
5
|
"fmt"
|
6
|
6
|
"gdyb/models"
|
7
|
7
|
"gdyb/utils/csbhttp"
|
|
8
|
+ "net"
|
8
|
9
|
"strconv"
|
9
|
10
|
"time"
|
10
|
11
|
)
|
|
@@ -939,3 +940,62 @@ func Jsyb3201(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float6
|
939
|
940
|
request_url = request_url + "3201"
|
940
|
941
|
return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
|
941
|
942
|
}
|
|
943
|
+
|
|
944
|
+func Jsyb9001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, admin_user_id int64, request_url string, cainfo string, access_key string) (string, string) {
|
|
945
|
+
|
|
946
|
+ // 生成签名
|
|
947
|
+ timestamp := time.Now().Unix()
|
|
948
|
+ // 生成输入报文
|
|
949
|
+ inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
|
|
950
|
+ input := make(map[string]interface{})
|
|
951
|
+ inputData := make(map[string]interface{})
|
|
952
|
+ inputMessage["infno"] = "9001" // 交易编码
|
|
953
|
+ inputData["opter_no"] = admin_user_id
|
|
954
|
+ inputData["mac"] = GetMacTwo() // 开始时间
|
|
955
|
+ inputData["ip"] = GetLocalIpTwo()
|
|
956
|
+ input["signIn"] = inputData
|
|
957
|
+
|
|
958
|
+ inputMessage["input"] = input //交易输入
|
|
959
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
960
|
+ fmt.Println(string(bytesData))
|
|
961
|
+ if err != nil {
|
|
962
|
+ fmt.Println(err.Error())
|
|
963
|
+ return err.Error(), ""
|
|
964
|
+ }
|
|
965
|
+ request_url = request_url + "9001"
|
|
966
|
+ return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
|
|
967
|
+
|
|
968
|
+}
|
|
969
|
+
|
|
970
|
+//获取本机ip
|
|
971
|
+func GetLocalIpTwo() string {
|
|
972
|
+ addrs, err := net.InterfaceAddrs()
|
|
973
|
+ if err != nil {
|
|
974
|
+ fmt.Println("get local ip failed")
|
|
975
|
+ }
|
|
976
|
+ for _, address := range addrs {
|
|
977
|
+ if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
|
|
978
|
+ if ipnet.IP.To4() != nil {
|
|
979
|
+ return ipnet.IP.String()
|
|
980
|
+ }
|
|
981
|
+ }
|
|
982
|
+ }
|
|
983
|
+ return ""
|
|
984
|
+}
|
|
985
|
+
|
|
986
|
+//获取本机Mac
|
|
987
|
+func GetMacTwo() string {
|
|
988
|
+ interfaces, err := net.Interfaces()
|
|
989
|
+ if err != nil {
|
|
990
|
+ fmt.Println("Get loacl Mac failed")
|
|
991
|
+ }
|
|
992
|
+ for _, inter := range interfaces {
|
|
993
|
+ mac := inter.HardwareAddr
|
|
994
|
+ fmt.Println("+======" + mac.String())
|
|
995
|
+ if mac.String() != "" {
|
|
996
|
+ return mac.String()
|
|
997
|
+ }
|
|
998
|
+
|
|
999
|
+ }
|
|
1000
|
+ return ""
|
|
1001
|
+}
|