易联云打印机添加GetOrderPagingList

This commit is contained in:
gazebo
2019-09-27 18:37:14 +08:00
parent 34d95a4f46
commit 9e46a9195d
2 changed files with 31 additions and 3 deletions

View File

@@ -56,6 +56,15 @@ type TokenInfo struct {
MachineCode string `json:"machine_code"`
}
type PrinterOrderResult struct {
Content string `json:"content"`
ID string `json:"id"`
OriginID string `json:"origin_id"`
PrintTime string `json:"print_time"`
ReceivingTime string `json:"receiving_time"`
Status int `json:"status"`
}
func New(clientID, clientSecret string, config ...*platformapi.APIConfig) *API {
curConfig := platformapi.DefAPIConfig
if len(config) > 0 {
@@ -256,3 +265,16 @@ func (a *API) CancelAll(machineCode, token string) (err error) {
func (a *API) PlayText(machineCode, orderID, text, token string) (err error) {
return a.printMsg(machineCode, orderID, fmt.Sprintf("<audio>%s,9,0</audio>", strings.Replace(text, ",", ".", -1)), token)
}
// pageIndex从1开始pageSize最大为100
func (a *API) GetOrderPagingList(machineCode, token string, pageIndex, pageSize int) (orderResultList []*PrinterOrderResult, err error) {
result, err := a.AccessAPI("printer/getorderpaginglist", map[string]interface{}{
"machine_code": machineCode,
"page_index": pageIndex,
"page_size": pageSize,
}, token)
if err != nil {
err = utils.Map2StructByJson(result, &orderResultList, false)
}
return orderResultList, err
}