Merge branch 'master' of e.coding.net:rosydev/baseapi
This commit is contained in:
@@ -199,15 +199,15 @@ type PrintRequest struct {
|
||||
Sn string `json:"sn"` //打印机编号
|
||||
Content string `json:"content"` //打印内容,不能超过12k字节
|
||||
//非必填
|
||||
Copies int `json:"copies,omitempty"` //打印份数,默认为1,取值[1-65535]
|
||||
Cutter int `json:"cutter,omitempty"` //是否支持切刀自定义控制 0采用默认切刀 1采用自定义控制切刀
|
||||
Voice int `json:"voice,omitempty"` //声音播放模式,0-取消订单模式,1-静音模式,2-来单播放模式(默认),3-播报退单语音,4-播报美团来单语音,5-播报饿了么来单语音
|
||||
Mode int `json:"mode,omitempty"` //打印模式,默认为0
|
||||
ExpiresIn int `json:"expiresIn,omitempty"` //订单有效期 单位:秒 取值范围为:0<订单失效时间<24*60*60,使用该参数时,需要将参数mode 设置为1
|
||||
BackurlFlag int `json:"backurlFlag,omitempty"` //回调地址对应标识,必须先在管理后台设置,否则无效
|
||||
PayType int `json:"payType,omitempty"` //41~55: 支付宝 41、微信 42、云支付 43、银联刷卡 44、银联支付 45、会员卡消费 46、会员卡充值 47、翼支付 48、成功收款 49、嘉联支付 50、壹钱包 51、京东支付 52、快钱支付 53、威支付 54、享钱支付 55
|
||||
PayMode int `json:"payMode,omitempty"` //59~61: 退款 59 到账 60 消费 61
|
||||
Money float64 `json:"money,omitempty"` //支付金额 允许保留2位小数
|
||||
Copies int `json:"copies,omitempty"` //打印份数,默认为1,取值[1-65535]
|
||||
Cutter int `json:"cutter,omitempty"` //是否支持切刀自定义控制 0采用默认切刀 1采用自定义控制切刀
|
||||
Voice int `json:"voice,omitempty"` //声音播放模式,0-取消订单模式,1-静音模式,2-来单播放模式(默认),3-播报退单语音,4-播报美团来单语音,5-播报饿了么来单语音
|
||||
Mode int `json:"mode,omitempty"` //打印模式,默认为0
|
||||
ExpiresIn int `json:"expiresIn,omitempty"` //订单有效期 单位:秒 取值范围为:0<订单失效时间<24*60*60,使用该参数时,需要将参数mode 设置为1
|
||||
BackurlFlag int `json:"backurlFlag,omitempty"` //回调地址对应标识,必须先在管理后台设置,否则无效
|
||||
//PayType int `json:"payType,omitempty"` //41~55: 支付宝 41、微信 42、云支付 43、银联刷卡 44、银联支付 45、会员卡消费 46、会员卡充值 47、翼支付 48、成功收款 49、嘉联支付 50、壹钱包 51、京东支付 52、快钱支付 53、威支付 54、享钱支付 55
|
||||
//PayMode int `json:"payMode,omitempty"` //59~61: 退款 59 到账 60 消费 61
|
||||
//Money float64 `json:"money,omitempty"` //支付金额 允许保留2位小数
|
||||
}
|
||||
|
||||
//打印标签订单
|
||||
|
||||
@@ -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)
|
||||
//序列化
|
||||
|
||||
Reference in New Issue
Block a user