XinYeYouKu/app/third/dfpOpenSdk/example/example.go

52 lines
1.7 KiB
Go

package main
import (
"fmt"
"net/http"
"qteam/app/third/dfpOpenSdk/config"
"qteam/app/third/dfpOpenSdk/opensdk"
)
func main() {
// 配置应用配置,可配置多个应用
configure := config.KeyConfigure{
KeyId: "KYGdqsNCF8oPnevCh1rRtqD3",
PriKey: "bunzNs09MIwSW4BcjewJd9stERakj/MHnHlmxhyCYjU=",
RespPubKey: "BOAMD8CD4EGYIwWkdueVH6ajyLvUGmUSgvgmhn7Nt9TrwW5Ko1UsKUltagslnxhjWt0l/D1aXM1FYq8fv70THmU=",
ReqParamEncryptKey: "",
}
m := make(map[string]*config.KeyConfigure)
m["KYGdqsNCF8oPnevCh1rRtqD3"] = &configure
sdkConfigure := config.OpenSdkConfigure{
DevEnv: true,
DevUrl: "https://open.test.cibfintech.com",
KeyConfigures: m,
}
sdk := opensdk.OpenSDK{Configure: sdkConfigure, KeyConfigure: configure}
keyId := "KYGdqsNCF8oPnevCh1rRtqD3"
id, err := sdk.GateWayWithKeyId("/api/open/queryPubKey", http.MethodGet, nil, nil, nil, keyId)
fmt.Println(id)
if err != nil {
return
}
//infoMap := map[string]string{"mbcNo": "KYGdqsNCF8oPnevCh1rRtqD3"}
//bodyJson, _ := json.Marshal(infoMap)
//
//infoMap2 := map[string]string{"boolParam": "false", "floatParam": "0.5"}
//
//response, _ := sdk.GatewayJsonWithKeyId("/api/cashManage/loginMbc", http.MethodPost, nil, nil, string(bodyJson), keyId)
//response2, _ := sdk.GateWayWithKeyId("/api/testApi", http.MethodPost, nil, nil, infoMap2, keyId)
//
//fmt.Println(response)
//fmt.Println(response2)
//response3, _ := sdk.UploadFileWithKeyId("C:\\Users\\cy\\Desktop\\phpsm2sm3sm4-main.zip", keyId)
//fmt.Println(response3)
//id, _ := sdk.DownloadFileWithKeyId("exchange/M00/14/9B/Cj_Bu2VxKluANlz1AADek3NRg8E.029e4c", "C:\\Users\\cy\\Desktop\\new_sdk\\dfp-open-sdk-go\\tmp2.zip", keyId)
//fmt.Println(id)
}