This commit is contained in:
richboo111
2023-03-21 15:26:23 +08:00
parent c689e2d73a
commit a01dfe715f
2 changed files with 44 additions and 15 deletions

View File

@@ -27,9 +27,9 @@ func TestFormatPrintOrderItem(t *testing.T) {
RestRequest: api.GenerateRestRequest(),
Sn: TestPrinterSN,
Content: str,
Copies: 1,
Voice: VoicePlayOrder,
Mode: ModeCheckYes,
//Copies: 1,
Voice: VoicePlayOrder,
//Mode: ModeCheckYes,
}
orderID, err := api.Print(request)
fmt.Printf("orderID=====%s", orderID)
@@ -69,9 +69,38 @@ func TestPrint(t *testing.T) {
RestRequest: api.GenerateRestRequest(),
Sn: TestPrinterSN,
Content: printContent,
Copies: 1,
Voice: 2,
Mode: 1,
//Copies: 1,
Voice: 2,
//Mode: 1,
}
result, err := api.Print(&request)
//序列化
reslutJson, _ := json.Marshal(result)
var msg = fmt.Sprintf("response result: %+v", string(reslutJson))
fmt.Println(msg)
fmt.Println(err)
}
//打印取消/退款订单
func TestPrintCancelOrRefund(t *testing.T) {
content := `<C><B>京西菜市</B></C><BR>`
content += StrRepeat("-", 32) + `
<L><HB>下单时间: 2023-03-20 16:04:04</HB>
<HB>订单编号: 134278684782</HB><BR>
<B><C>京东到家#29</B></C><BR>
`
content += `<HB><L>取消订单详情</HB><BR>`
content += StrRepeat("-", 32)
content += `<L><B>共3种9件商品</B></L>
实际支付:¥33.71<BR><BR>`
content += StrRepeat("-", 14) + "#29完</HB>" + StrRepeat("-", 14) + `<BR>`
request := PrintRequest{
RestRequest: api.GenerateRestRequest(),
Sn: TestPrinterSN,
Content: content,
//Copies: 1,
Voice: 0,
//Mode: 1,
}
result, err := api.Print(&request)
//序列化