diff --git a/main.go b/main.go index 372ca0b..eecf288 100644 --- a/main.go +++ b/main.go @@ -3,8 +3,8 @@ package v5sdkgo import ( "context" "fmt" - . "github.com/phyer/v5sdkgo/rest" - . "github.com/phyer/v5sdkgo/ws" + . "gitea.zjmud.xyz/phyer/v5sdkgo/rest" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws" "log" "time" diff --git a/rest/rest.go b/rest/rest.go index 1682eef..2fb1f31 100644 --- a/rest/rest.go +++ b/rest/rest.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" "fmt" - . "github.com/phyer/v5sdkgo/utils" + "gitea.zjmud.xyz/phyer/v5sdkgo/utils" "io/ioutil" "net/http" "strings" @@ -186,10 +186,10 @@ func (this *RESTAPI) Run(ctx context.Context) (res *RESTAPIResult, err error) { } // Sign and set request headers - timestamp := IsoTime() - preHash := PreHashString(timestamp, this.Method, uri, body) + timestamp := utils.IsoTime() + preHash := utils.PreHashString(timestamp, this.Method, uri, body) //log.Println("preHash:", preHash) - sign, err := HmacSha256Base64Signer(preHash, this.ApiKeyInfo.SecKey) + sign, err := utils.HmacSha256Base64Signer(preHash, this.ApiKeyInfo.SecKey) if err != nil { return } @@ -312,7 +312,7 @@ func (this *RESTAPI) PrintRequest(request *http.Request, body string, preHash st if this.ApiKeyInfo.SecKey != "" { fmt.Println(" Secret-Key: " + this.ApiKeyInfo.SecKey) } - fmt.Println(" Request(" + IsoTime() + "):") + fmt.Println(" Request(" + utils.IsoTime() + "):") fmt.Println("\tUrl: " + request.URL.String()) fmt.Println("\tMethod: " + strings.ToUpper(request.Method)) if len(request.Header) > 0 { diff --git a/ws/utils.go b/ws/utils.go index f9cfef6..851d049 100644 --- a/ws/utils.go +++ b/ws/utils.go @@ -2,8 +2,8 @@ package ws import ( "errors" - . "github.com/phyer/v5sdkgo/ws/wImpl" - . "github.com/phyer/v5sdkgo/ws/wInterface" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wInterface" "log" "runtime/debug" ) diff --git a/ws/wImpl/JRPCData.go b/ws/wImpl/JRPCData.go index 1f7faa7..d157eaf 100644 --- a/ws/wImpl/JRPCData.go +++ b/ws/wImpl/JRPCData.go @@ -5,7 +5,7 @@ package wImpl import ( "encoding/json" - . "github.com/phyer/v5sdkgo/utils" + "gitea.zjmud.xyz/phyer/v5sdkgo/utils" ) // jrpc请求结构体 @@ -20,7 +20,7 @@ func (r JRPCReq) GetType() int { } func (r JRPCReq) ToString() string { - data, err := Struct2JsonString(r) + data, err := utils.Struct2JsonString(r) if err != nil { return "" } diff --git a/ws/wImpl/ReqData.go b/ws/wImpl/ReqData.go index 634cec8..9a4a5cc 100644 --- a/ws/wImpl/ReqData.go +++ b/ws/wImpl/ReqData.go @@ -6,7 +6,7 @@ package wImpl import ( "encoding/json" - . "github.com/phyer/v5sdkgo/utils" + "gitea.zjmud.xyz/phyer/v5sdkgo/utils" ) // 客户端请求消息格式 @@ -20,7 +20,7 @@ func (r ReqData) GetType() int { } func (r ReqData) ToString() string { - data, err := Struct2JsonString(r) + data, err := utils.Struct2JsonString(r) if err != nil { return "" } diff --git a/ws/wInterface/IParam.go b/ws/wInterface/IParam.go index a4dae3c..932571a 100644 --- a/ws/wInterface/IParam.go +++ b/ws/wInterface/IParam.go @@ -1,11 +1,11 @@ package wInterface import ( - . "github.com/phyer/v5sdkgo/ws/wImpl" + "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" ) // 请求数据 type WSParam interface { - EventType() Event + EventType() wImpl.Event ToMap() *map[string]string } diff --git a/ws/ws_AddBookedDataHook_test.go b/ws/ws_AddBookedDataHook_test.go index 70ff328..54fd5ff 100644 --- a/ws/ws_AddBookedDataHook_test.go +++ b/ws/ws_AddBookedDataHook_test.go @@ -4,10 +4,10 @@ package ws // go test ws_cli.go ws_op.go ws_contants.go utils.go ws_pub_channel.go ws_pub_channel_test.go ws_priv_channel.go ws_priv_channel_test.go ws_jrpc.go ws_jrpc_test.go ws_test_AddBookedDataHook.go -v import ( "fmt" + . "gitea.zjmud.xyz/phyer/v5sdkgo/wImpl" "log" "testing" "time" - . "v5sdk_go/ws/wImpl" ) const ( diff --git a/ws/ws_cli.go b/ws/ws_cli.go index e5aaa81..5022b40 100644 --- a/ws/ws_cli.go +++ b/ws/ws_cli.go @@ -5,9 +5,9 @@ import ( "encoding/json" "errors" "fmt" - . "github.com/phyer/v5sdkgo/config" - . "github.com/phyer/v5sdkgo/utils" - . "github.com/phyer/v5sdkgo/ws/wImpl" + . "gitea.zjmud.xyz/phyer/v5sdkgo/config" + . "gitea.zjmud.xyz/phyer/v5sdkgo/utils" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" "log" "regexp" "runtime/debug" diff --git a/ws/ws_jrpc.go b/ws/ws_jrpc.go index ad68c2a..fe17f3f 100644 --- a/ws/ws_jrpc.go +++ b/ws/ws_jrpc.go @@ -2,7 +2,7 @@ package ws import ( "context" - . "github.com/phyer/v5sdkgo/ws/wImpl" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" "log" "time" ) diff --git a/ws/ws_op.go b/ws/ws_op.go index c9e78f8..dbb5ec9 100644 --- a/ws/ws_op.go +++ b/ws/ws_op.go @@ -3,11 +3,11 @@ package ws import ( "context" "errors" - . "github.com/phyer/v5sdkgo/config" - . "github.com/phyer/v5sdkgo/rest" - . "github.com/phyer/v5sdkgo/utils" - . "github.com/phyer/v5sdkgo/ws/wImpl" - . "github.com/phyer/v5sdkgo/ws/wInterface" + . "gitea.zjmud.xyz/phyer/v5sdkgo/config" + . "gitea.zjmud.xyz/phyer/v5sdkgo/rest" + . "gitea.zjmud.xyz/phyer/v5sdkgo/utils" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wInterface" "log" "sync" "time" diff --git a/ws/ws_priv_channel.go b/ws/ws_priv_channel.go index c427420..abc68c8 100644 --- a/ws/ws_priv_channel.go +++ b/ws/ws_priv_channel.go @@ -1,7 +1,7 @@ package ws import ( - . "github.com/phyer/v5sdkgo/ws/wImpl" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" ) /* diff --git a/ws/ws_pub_channel.go b/ws/ws_pub_channel.go index 55f30c8..6fcf37a 100644 --- a/ws/ws_pub_channel.go +++ b/ws/ws_pub_channel.go @@ -2,7 +2,7 @@ package ws import ( "errors" - . "github.com/phyer/v5sdkgo/ws/wImpl" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" ) /* diff --git a/ws/ws_pub_channel_test.go b/ws/ws_pub_channel_test.go index 3f63f62..a9cf286 100644 --- a/ws/ws_pub_channel_test.go +++ b/ws/ws_pub_channel_test.go @@ -3,7 +3,7 @@ package ws import ( "encoding/json" "fmt" - . "github.com/phyer/v5sdkgo/ws/wImpl" + . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl" "log" "strings" "testing" diff --git a/ws/ws_test.go b/ws/ws_test.go index 8ac7e7e..df53f93 100644 --- a/ws/ws_test.go +++ b/ws/ws_test.go @@ -218,7 +218,7 @@ func TestWsClient_Jrpc(t *testing.T) { } /* - 测试 添加全局消息回调函数 +测试 添加全局消息回调函数 */ func TestAddMessageHook(t *testing.T) { @@ -235,7 +235,7 @@ func TestAddMessageHook(t *testing.T) { } /* - 普通推送数据回调函数 +普通推送数据回调函数 */ func TestAddBookedDataHook(t *testing.T) { var r *WsClient @@ -313,7 +313,6 @@ func TestGetInfoFromErrMsg(t *testing.T) { } /* - */ func TestParseMessage(t *testing.T) { r := prework() @@ -329,7 +328,7 @@ func TestParseMessage(t *testing.T) { } /* - 原始方式 深度订阅 测试 +原始方式 深度订阅 测试 */ func TestSubscribeTBT(t *testing.T) { r := prework() @@ -361,7 +360,6 @@ func TestSubscribeTBT(t *testing.T) { } /* - */ func TestSubscribeBalAndPos(t *testing.T) { r := prework_pri(CROSS_ACCOUNT)