transform to gitea.zjmud.xyz

This commit is contained in:
zhangkun9038@dingtalk.com 2025-03-05 20:52:20 +08:00
parent 3324e49678
commit 9d5fb45249
14 changed files with 31 additions and 33 deletions

View File

@ -3,8 +3,8 @@ package v5sdkgo
import ( import (
"context" "context"
"fmt" "fmt"
. "github.com/phyer/v5sdkgo/rest" . "gitea.zjmud.xyz/phyer/v5sdkgo/rest"
. "github.com/phyer/v5sdkgo/ws" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws"
"log" "log"
"time" "time"

View File

@ -6,7 +6,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
. "github.com/phyer/v5sdkgo/utils" "gitea.zjmud.xyz/phyer/v5sdkgo/utils"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strings" "strings"
@ -186,10 +186,10 @@ func (this *RESTAPI) Run(ctx context.Context) (res *RESTAPIResult, err error) {
} }
// Sign and set request headers // Sign and set request headers
timestamp := IsoTime() timestamp := utils.IsoTime()
preHash := PreHashString(timestamp, this.Method, uri, body) preHash := utils.PreHashString(timestamp, this.Method, uri, body)
//log.Println("preHash:", preHash) //log.Println("preHash:", preHash)
sign, err := HmacSha256Base64Signer(preHash, this.ApiKeyInfo.SecKey) sign, err := utils.HmacSha256Base64Signer(preHash, this.ApiKeyInfo.SecKey)
if err != nil { if err != nil {
return return
} }
@ -312,7 +312,7 @@ func (this *RESTAPI) PrintRequest(request *http.Request, body string, preHash st
if this.ApiKeyInfo.SecKey != "" { if this.ApiKeyInfo.SecKey != "" {
fmt.Println(" Secret-Key: " + 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("\tUrl: " + request.URL.String())
fmt.Println("\tMethod: " + strings.ToUpper(request.Method)) fmt.Println("\tMethod: " + strings.ToUpper(request.Method))
if len(request.Header) > 0 { if len(request.Header) > 0 {

View File

@ -2,8 +2,8 @@ package ws
import ( import (
"errors" "errors"
. "github.com/phyer/v5sdkgo/ws/wImpl" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
. "github.com/phyer/v5sdkgo/ws/wInterface" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wInterface"
"log" "log"
"runtime/debug" "runtime/debug"
) )

View File

@ -5,7 +5,7 @@ package wImpl
import ( import (
"encoding/json" "encoding/json"
. "github.com/phyer/v5sdkgo/utils" "gitea.zjmud.xyz/phyer/v5sdkgo/utils"
) )
// jrpc请求结构体 // jrpc请求结构体
@ -20,7 +20,7 @@ func (r JRPCReq) GetType() int {
} }
func (r JRPCReq) ToString() string { func (r JRPCReq) ToString() string {
data, err := Struct2JsonString(r) data, err := utils.Struct2JsonString(r)
if err != nil { if err != nil {
return "" return ""
} }

View File

@ -6,7 +6,7 @@ package wImpl
import ( import (
"encoding/json" "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 { func (r ReqData) ToString() string {
data, err := Struct2JsonString(r) data, err := utils.Struct2JsonString(r)
if err != nil { if err != nil {
return "" return ""
} }

View File

@ -1,11 +1,11 @@
package wInterface package wInterface
import ( import (
. "github.com/phyer/v5sdkgo/ws/wImpl" "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
) )
// 请求数据 // 请求数据
type WSParam interface { type WSParam interface {
EventType() Event EventType() wImpl.Event
ToMap() *map[string]string ToMap() *map[string]string
} }

View File

@ -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 // 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 ( import (
"fmt" "fmt"
. "gitea.zjmud.xyz/phyer/v5sdkgo/wImpl"
"log" "log"
"testing" "testing"
"time" "time"
. "v5sdk_go/ws/wImpl"
) )
const ( const (

View File

@ -5,9 +5,9 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
. "github.com/phyer/v5sdkgo/config" . "gitea.zjmud.xyz/phyer/v5sdkgo/config"
. "github.com/phyer/v5sdkgo/utils" . "gitea.zjmud.xyz/phyer/v5sdkgo/utils"
. "github.com/phyer/v5sdkgo/ws/wImpl" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
"log" "log"
"regexp" "regexp"
"runtime/debug" "runtime/debug"

View File

@ -2,7 +2,7 @@ package ws
import ( import (
"context" "context"
. "github.com/phyer/v5sdkgo/ws/wImpl" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
"log" "log"
"time" "time"
) )

View File

@ -3,11 +3,11 @@ package ws
import ( import (
"context" "context"
"errors" "errors"
. "github.com/phyer/v5sdkgo/config" . "gitea.zjmud.xyz/phyer/v5sdkgo/config"
. "github.com/phyer/v5sdkgo/rest" . "gitea.zjmud.xyz/phyer/v5sdkgo/rest"
. "github.com/phyer/v5sdkgo/utils" . "gitea.zjmud.xyz/phyer/v5sdkgo/utils"
. "github.com/phyer/v5sdkgo/ws/wImpl" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
. "github.com/phyer/v5sdkgo/ws/wInterface" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wInterface"
"log" "log"
"sync" "sync"
"time" "time"

View File

@ -1,7 +1,7 @@
package ws package ws
import ( import (
. "github.com/phyer/v5sdkgo/ws/wImpl" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
) )
/* /*

View File

@ -2,7 +2,7 @@ package ws
import ( import (
"errors" "errors"
. "github.com/phyer/v5sdkgo/ws/wImpl" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
) )
/* /*

View File

@ -3,7 +3,7 @@ package ws
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
. "github.com/phyer/v5sdkgo/ws/wImpl" . "gitea.zjmud.xyz/phyer/v5sdkgo/ws/wImpl"
"log" "log"
"strings" "strings"
"testing" "testing"

View File

@ -218,7 +218,7 @@ func TestWsClient_Jrpc(t *testing.T) {
} }
/* /*
测试 添加全局消息回调函数 测试 添加全局消息回调函数
*/ */
func TestAddMessageHook(t *testing.T) { func TestAddMessageHook(t *testing.T) {
@ -235,7 +235,7 @@ func TestAddMessageHook(t *testing.T) {
} }
/* /*
普通推送数据回调函数 普通推送数据回调函数
*/ */
func TestAddBookedDataHook(t *testing.T) { func TestAddBookedDataHook(t *testing.T) {
var r *WsClient var r *WsClient
@ -313,7 +313,6 @@ func TestGetInfoFromErrMsg(t *testing.T) {
} }
/* /*
*/ */
func TestParseMessage(t *testing.T) { func TestParseMessage(t *testing.T) {
r := prework() r := prework()
@ -329,7 +328,7 @@ func TestParseMessage(t *testing.T) {
} }
/* /*
原始方式 深度订阅 测试 原始方式 深度订阅 测试
*/ */
func TestSubscribeTBT(t *testing.T) { func TestSubscribeTBT(t *testing.T) {
r := prework() r := prework()
@ -361,7 +360,6 @@ func TestSubscribeTBT(t *testing.T) {
} }
/* /*
*/ */
func TestSubscribeBalAndPos(t *testing.T) { func TestSubscribeBalAndPos(t *testing.T) {
r := prework_pri(CROSS_ACCOUNT) r := prework_pri(CROSS_ACCOUNT)