This commit is contained in:
邹宗楠
2024-12-18 17:12:10 +08:00
parent d5e46f7fd2
commit 0ad94d882a
3 changed files with 7 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ func TestSkuBrandList(t *testing.T) {
}
func TestPictureUpload(t *testing.T) {
result, err := api.PictureUpload("https://image.jxc4.com/image/cc7119fbe87cdefc66995cd79321c21c.jpg", nil)
result, err := api.PictureUpload("http://image.jxc4.com/image/bd3d57f1be97f55693f44c6f5167efd7.jpg", nil)
if err != nil {
t.Fatal(err)
} else {

View File

@@ -99,7 +99,7 @@ func TestAPI_AddPrinterOrder(t *testing.T) {
//--------------------------------
//<font# bolder=1 height=2 width=1>1.哇哈哈纯净水24瓶装 x8 ¥321.0</font#><BR><BR><LEFT><font# bolder=0 height=2 width=1>共1种8件商品</font#></LEFT>
//<font# bolder=0 height=2 width=1>--------------#19完-------------</font#>`
result, err := api.Print("680020033919", context, "10")
result, err := api.Print("580011089858", context, "10")
fmt.Println(result)
fmt.Println(err)
}

View File

@@ -179,8 +179,12 @@ func FormatPrintOrderItemV2(foodName string, quantity, cnt int) string {
} else {
restLen = foodNameLen - LineLength
}
repeatTimes := MaxLineLength - restLen
if repeatTimes < 0 {
repeatTimes = MaxLineLength
}
result += `<font# bolder=0 height=2 width=1>` + utils.Int2Str(cnt) + `.` + foodName
result += StrRepeat(" ", MaxLineLength-restLen) + `x` + quantityStr + `</font#>`
result += StrRepeat(" ", repeatTimes) + `x` + quantityStr + `</font#>`
} else {
result += `<font# bolder=0 height=2 width=1>` + utils.Int2Str(cnt) + `.` + foodName + StrRepeat(" ", MaxLineLength-foodNameLen) + `x` + quantityStr + `</font#>`
}