transfer_yl/cmd/api/internal/test/sign_test.go

25 lines
733 B
Go

package test
import (
"encoding/json"
"fmt"
"rs/untils/sign"
"testing"
)
const PrimaryKey = "da4953198bce4bc8eca9ff7101ae7eb8"
func TestSign(t *testing.T) {
var (
reqDataMap map[string]interface{}
)
j := "{\"createTime\":1721111144,\"deliverOrderNo\":\"DELIVER_1721111144961285\",\"extendParams\":\"{\\\"appId\\\":2783278,\\\"num\\\":1,\\\"posId\\\":2783278}\",\"requestTime\":1721111144,\"sign\":\"NDEyNWNhODMwY2FjYjJmNTgwYWY5Njk1ODJjMTI1YmEyYzNlN2M0MTlmNDliZjg5MDc0NTQ3MDVkYjI1MDAyOA==\",\"supplierId\":51,\"supplierSkuId\":808,\"thirdSkuId\":\"yl20240712\"}"
err := json.Unmarshal([]byte(j), &reqDataMap)
if err != nil {
panic("j")
}
sysSign, err := sign.GetSign(reqDataMap, PrimaryKey)
fmt.Println(sysSign)
}