京东订单测试
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package jdshopapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
@@ -21,6 +22,7 @@ func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err e
|
||||
return nil, err
|
||||
}
|
||||
mapData := utils.URLValues2Map(values)
|
||||
fmt.Println(mapData)
|
||||
utils.Map2StructByJson(mapData, &call, false)
|
||||
return call, err
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ func TestGetDeliveryCompany(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOrder(t *testing.T) {
|
||||
err := api.GetOrder(120146365818)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// err := api.GetOrder(120146365818)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
"unsafe"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"golang.org/x/text/encoding/simplifiedchinese"
|
||||
@@ -105,7 +107,7 @@ func TestTryGetCookie(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAAADS(t *testing.T) {
|
||||
str := "AASWvkdk5a60bjm3lFqaoCyzU8toVp+3kKjheuOwxzWZH+adxCfv+Bv9BD0DP/WDy6Y="
|
||||
str := "AASWvkdk5a60bjm3lFqaoCyzJprhJZvabCAbNtGu14Lu/ZBGNYf/MdPCEIcIN9oVbEw="
|
||||
data, _ := base64.StdEncoding.DecodeString(str)
|
||||
dataStr := hex.EncodeToString(data)
|
||||
fmt.Println("all:", dataStr) //96be4764e5aeb46e39b7945a9aa02cb3
|
||||
@@ -113,12 +115,13 @@ func TestAAADS(t *testing.T) {
|
||||
fmt.Println("IV:", dataStr[36:68])
|
||||
fmt.Println("key main", dataStr[68:])
|
||||
data2, _ := base64.StdEncoding.DecodeString("XsGNdyDyDHnR79iKU6d5LTSJYaQyWAEssDoD7VM5Kks=")
|
||||
fmt.Println(len(data2))
|
||||
fmt.Println(len([]byte(dataStr[36:68])))
|
||||
// str2 := []byte(dataStr[68:])
|
||||
// key := []byte(dataStr2)
|
||||
|
||||
decryptedData, err := Decrypt([]byte("e69dc427eff81bfd043d033ff583cba6"), data2, data[18:34])
|
||||
iv, _ := hex.DecodeString("269ae1259bda6c201b36d1aed782eefd")
|
||||
main, _ := hex.DecodeString("90463587ff31d3c210870837da156c4c")
|
||||
fmt.Println(iv)
|
||||
fmt.Println(data[18:34])
|
||||
decryptedData, err := Decrypt(main, data2, iv)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -126,6 +129,17 @@ func TestAAADS(t *testing.T) {
|
||||
fmt.Println("data", string(data3))
|
||||
}
|
||||
|
||||
func TestSZXCXZ(t *testing.T) {
|
||||
//53cb68569fb790a8e17ae3b0c735991f
|
||||
// fmt.Println(len(data))
|
||||
}
|
||||
|
||||
func StringToBytes(s string) []byte {
|
||||
sh := (*reflect.StringHeader)(unsafe.Pointer(&s))
|
||||
bh := reflect.SliceHeader{sh.Data, sh.Len, 0}
|
||||
return *(*[]byte)(unsafe.Pointer(&bh))
|
||||
}
|
||||
|
||||
func Decrypt(decryptBytes, key, iv []byte) ([]byte, error) {
|
||||
block, err := aes.NewCipher(key)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user