This commit is contained in:
李子铭 2024-10-28 13:42:46 +08:00
parent ec8e8e4bb6
commit 0eeb2deef0
1 changed files with 17 additions and 3 deletions

View File

@ -31,19 +31,33 @@ func TestConfig(t *testing.T) {
})
}
func StrIdx(str string, substr string) string {
substr = fmt.Sprintf("%s:", substr) // "order:" "result:"
index := strings.Index(str, substr)
if index == -1 {
return ""
}
return str[index+len(substr):]
}
func TestOrder(t *testing.T) {
request := &proto.OrderRequest{
Config: config(),
Order: &proto.OrderRequest_Order{
OrderNo: "test_zltx_4",
Account: "18666666666",
Extra: nil,
OrderNo: "test_zltx_4",
Account: "18666666666",
Quantity: 1,
Extra: nil,
},
Product: &proto.OrderRequest_Product{
ProductNo: "106",
Extra: []byte(`{}`),
},
}
fmt.Println(request.String())
//fmt.Println(StrIdx(request.String(), "order"))
//fmt.Println(StrIdx(request.String(), "product"))
t.Run("TestOrder", func(t *testing.T) {
got, err := zltx.Order(context.Background(), request)
if err != nil {