{
  "openapi": "3.1.0",
  "info": {
    "title": "芯烨云开放 API（XPrinter Cloud OpenAPI）",
    "version": "1.9.1",
    "description": "根据《芯烨云开放API开发接入文档 v1.9.1》整理的 OpenAPI 3.1 规范定义。\n所有接口均使用 HTTP(S) POST，并要求请求头 Content-Type: application/json;charset=UTF-8。\n公共参数：user、timestamp、sign（sign = SHA1(user + UserKEY + timestamp)，40位小写十六进制）。\n注意：debug=1 时可能返回非 JSON 文本，仅用于测试。"
  },
  "servers": [
    {
      "url": "https://open.xpyun.net",
      "description": "推荐使用 HTTPS"
    },
    {
      "url": "http://open.xpyun.net",
      "description": "兼容 HTTP（不推荐）"
    }
  ],
  "tags": [
    {
      "name": "Printer",
      "description": "打印机与打印任务相关接口（设备管理/打印/状态/语音/LOGO等）"
    }
  ],
  "paths": {
    "/api/openapi/xprinter/addPrinters": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "添加打印机到开发者账户（可批量）",
        "description": "批量添加打印机到开发者账号下。每次最多添加 50 台设备。",
        "operationId": "addPrinters",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddPrintersRequest"
              },
              "example": {
                "items": [
                  {
                    "sn": "XPY123456789A",
                    "name": "X58A"
                  },
                  {
                    "sn": "XPY987654321B",
                    "name": "X58B"
                  },
                  {
                    "sn": "XPY123456723A",
                    "name": "X58C"
                  },
                  {
                    "sn": "XPY987654345B",
                    "name": "X58D"
                  }
                ],
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddPrintersResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": {
                        "success": [
                          "XPY123456789A",
                          "XPY987654321B"
                        ],
                        "fail": [
                          "XPY123456723A",
                          "XPY987654345B"
                        ],
                        "failMsg": [
                          "XPY123456723A:1010",
                          "XPY987654345B:1010"
                        ]
                      },
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "REQUEST_USER_NOT_REGISTER",
                      "code": -4,
                      "data": null,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/setVoiceType": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "设置打印机语音类型",
        "description": "设置打印机语音类型与（部分机型）音量等级。",
        "operationId": "setVoiceType",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetVoiceTypeRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "voiceType": 0,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BooleanResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": true,
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_OFFLINE",
                      "code": 1003,
                      "data": false,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/print": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "打印小票订单",
        "description": "发送小票（票据）打印订单内容给芯烨云小票打印机。该接口仅用于票据订单。",
        "operationId": "printReceipt",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintReceiptRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "content": "----货到付款----",
                "copies": 1,
                "voice": 2,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderIdResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": "OM19081005450140628261",
                      "serverExecutedTime": 23
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_NOT_REGISTER",
                      "code": 1002,
                      "data": null,
                      "serverExecutedTime": 25
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/printLabel": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "打印标签订单",
        "description": "发送标签打印订单内容给芯烨云标签打印机（文档示例机型：XP-T271U、XP-320B）。",
        "operationId": "printLabel",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintLabelRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "content": "<TEXT x=\"10\" y=\"100\" w=\"1\" h=\"2\" r=\"0\">测试文本内容 1</TEXT>\n",
                "copies": 1,
                "voice": 2,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderIdResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": "OM19081005450140628261",
                      "serverExecutedTime": 23
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_NOT_REGISTER",
                      "code": 1002,
                      "data": null,
                      "serverExecutedTime": 25
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/delPrinters": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "批量删除打印机",
        "description": "批量删除打印机设备。",
        "operationId": "delPrinters",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DelPrintersRequest"
              },
              "example": {
                "snlist": [
                  "XPY123456789A",
                  "XPY987654321B"
                ],
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddPrintersResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": {
                        "success": [
                          "XPY123456789A",
                          "XPY987654321B"
                        ],
                        "fail": [
                          "XPY123456723A",
                          "XPY987654345B"
                        ],
                        "failMsg": [
                          "XPY123456723A:1010",
                          "XPY987654345B:1010"
                        ]
                      },
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "REQUEST_USER_NOT_REGISTER",
                      "code": -4,
                      "data": null,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/updPrinter": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "修改打印机信息",
        "description": "修改打印机名称及可选的流量卡号码。",
        "operationId": "updPrinter",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdPrinterRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "name": "X58C1",
                "cardno": "13031547528",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BooleanResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": true,
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "SN_USER_NOT_MATCH",
                      "code": 1001,
                      "data": false,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/delPrinterQueue": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "清空待打印队列",
        "description": "清空指定打印机的待打印任务队列；可选指定要清除的订单号（最多 10 个，逗号分隔）。",
        "operationId": "delPrinterQueue",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DelPrinterQueueRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "orderId": "OM19081005152569029225,OM19081005152569029226",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BooleanResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": true,
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_NOT_REGISTER",
                      "code": 1002,
                      "data": false,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/queryOrderState": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "查询订单是否打印成功",
        "description": "根据订单编号查询订单是否打印成功（orderId 由打印接口返回）。",
        "operationId": "queryOrderState",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryOrderStateRequest"
              },
              "example": {
                "orderId": "OM19081005152569029225",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BooleanResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": true,
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "ORDER_NOT_FOUND",
                      "code": 1005,
                      "data": false,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/queryOrderStatis": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "查询指定打印机某天的订单统计数",
        "description": "查询指定打印机某天的订单统计：已打印订单数、等待打印数。",
        "operationId": "queryOrderStatis",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryOrderStatisRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "date": "2019-08-15",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderStatisResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": {
                        "printed": 2,
                        "waiting": 0
                      },
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "ORDER_DATE_INVALID",
                      "code": 1006,
                      "data": null,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/queryPrinterStatus": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "获取指定打印机状态",
        "description": "获取单台打印机状态：0 离线，1 在线正常，2 在线异常（一般缺纸）。",
        "operationId": "queryPrinterStatus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryPrinterStatusRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrinterStatusResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": 1,
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "REQUEST_PARAM_INVALID",
                      "code": -2,
                      "data": 0,
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/queryPrintersStatus": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "批量获取指定打印机状态",
        "description": "批量获取打印机状态（一次最多 20 台），返回状态数组顺序与 snlist 一一对应。",
        "operationId": "queryPrintersStatus",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryPrintersStatusRequest"
              },
              "example": {
                "snlist": [
                  "XPY123456789A",
                  "XPY123456789B"
                ],
                "user": "testuser",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrinterStatusListResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": [
                        0,
                        1
                      ],
                      "serverExecutedTime": 1
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "REQUEST_PARAM_INVALID",
                      "code": -2,
                      "data": [
                        0,
                        0
                      ],
                      "serverExecutedTime": 1
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/playVoice": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "金额播报",
        "description": "向支持金额播报的芯烨云打印机下发金额播报请求。",
        "operationId": "playVoice",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlayVoiceRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "payType": 41,
                "payMode": 60,
                "money": 25.5,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ZeroStringResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": "0",
                      "serverExecutedTime": 23
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_NOT_REGISTER",
                      "code": 1002,
                      "data": null,
                      "serverExecutedTime": 25
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/pos": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "POS 指令打印",
        "description": "将 POS 指令编码后使用 base64 加密发给芯烨云小票打印机进行打印。",
        "operationId": "posPrint",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PosPrintRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "content": "G0AbIQhoZWxsbyB3b3JsZCEhIQ0KGyEAG2EBaGVsbG8gd29ybGQhISENCg0K",
                "copies": 1,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderIdResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": "OM19081005450140628261",
                      "serverExecutedTime": 23
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_NOT_REGISTER",
                      "code": 1002,
                      "data": null,
                      "serverExecutedTime": 25
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/controlBox": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "钱箱控制",
        "description": "使用打印机控制钱箱开。需保证钱箱输入电压在打印机钱箱口输出电压范围内。",
        "operationId": "controlBox",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlBoxRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ZeroStringResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": "0",
                      "serverExecutedTime": 23
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_NOT_REGISTER",
                      "code": 1002,
                      "data": null,
                      "serverExecutedTime": 25
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/playVoiceExt": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "扩展语音播报",
        "description": "发送预定义语音播报内容给支持预定义语音的打印机（content 如 #62）。",
        "operationId": "playVoiceExt",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlayVoiceExtRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "content": "#62#71#63#92",
                "voiceInterval": 1,
                "voiceTime": 1,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ZeroStringResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "msg": "ok",
                      "code": 0,
                      "data": "0",
                      "serverExecutedTime": 23
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "code": 1003,
                      "msg": "PRINTER_OFFLINE",
                      "serverExecutedTime": 20
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/playCustomVoice": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "自定义语音播报",
        "description": "发送自定义语音播报内容给支持自定义语音播报的打印机（目前仅支持汉语）。",
        "operationId": "playCustomVoice",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlayCustomVoiceRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "content": "A92 号顾客请取餐",
                "voiceInterval": 1,
                "voiceTime": 1,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ZeroStringResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "code": 0,
                      "msg": "ok",
                      "data": "0",
                      "serverExecutedTime": 15
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "code": 1003,
                      "msg": "PRINTER_OFFLINE",
                      "serverExecutedTime": 20
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/uploadLogo": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "店铺 LOGO 上传",
        "description": "上传商户店铺 LOGO。打印机需空闲、已开机并完成配网。执行完毕后设备会播音提示。\n注意：标签打印机在小票模式下不支持 LOGO 上传打印；可在订单内容中使用 <IMG200>base64</IMG> 实现 LOGO 打印。",
        "operationId": "uploadLogo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadLogoRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "content": "iVBORw0KGgoAAAANSUhEUgAAAFAAAAAlCAYAAADV/m7fAAAAAXNSR0IArs4c6QAAAARnQU1BAAC.........",
                "labelMode": 2,
                "imageSize": 200,
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderIdResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "code": 0,
                      "msg": "ok",
                      "data": "OM22081210335737112932L",
                      "serverExecutedTime": 571
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_OFFLINE",
                      "code": 1003,
                      "serverExecutedTime": 25
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/delUploadLogo": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "店铺 LOGO 删除",
        "description": "远程删除商户已上传的店铺 LOGO。",
        "operationId": "delUploadLogo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DelUploadLogoRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BooleanResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "code": 0,
                      "msg": "ok",
                      "data": true,
                      "serverExecutedTime": 90
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "msg": "PRINTER_OFFLINE",
                      "code": 1003,
                      "serverExecutedTime": 25
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/openapi/xprinter/printerInfo": {
      "post": {
        "tags": [
          "Printer"
        ],
        "summary": "获取打印机基本信息",
        "description": "获取打印机基本信息（名称、状态、类型、固件版本、纸张参数、SIM 状态等）。",
        "operationId": "printerInfo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrinterInfoRequest"
              },
              "example": {
                "sn": "XPY123456789A",
                "user": "testuser@google.com",
                "timestamp": "1565417654",
                "sign": "82bdcbe2cf6ac4923339b13c2aad1f95ddf0b0a8",
                "debug": "0"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "业务返回（通过 code 判断成功/失败）",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrinterInfoResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功",
                    "value": {
                      "code": 0,
                      "msg": "ok",
                      "data": {
                        "name": "小票研发测试机器问题测试",
                        "sn": "XPY123456789A",
                        "status": "Offline",
                        "type": "00",
                        "version": "V10.13",
                        "cutter": false,
                        "supportUyghur": false
                      },
                      "serverExecutedTime": 63
                    }
                  },
                  "failure": {
                    "summary": "失败",
                    "value": {
                      "code": 1002,
                      "msg": "PRINTER_NOT_REGISTER",
                      "serverExecutedTime": 54
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "User": {
        "type": "string",
        "description": "芯烨云平台注册用户名（开发者 ID，user）"
      },
      "UnixTimestampSeconds": {
        "type": "string",
        "pattern": "^\\d{10}$",
        "description": "当前 UNIX 时间戳（10 位，精确到秒）"
      },
      "Sha1LowerHex40": {
        "type": "string",
        "pattern": "^[a-f0-9]{40}$",
        "description": "SHA1 签名（40 位小写十六进制字符串），sign = SHA1(user + UserKEY + timestamp)"
      },
      "DebugFlag": {
        "type": "string",
        "description": "debug=1 时返回非 JSON 格式的数据，仅测试使用",
        "enum": [
          "0",
          "1"
        ]
      },
      "PublicRequest": {
        "type": "object",
        "description": "所有请求都必须携带的公共参数",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign"
        ],
        "additionalProperties": true
      },
      "ResponseEnvelope": {
        "type": "object",
        "description": "统一返回包裹结构（data 的具体类型由接口而定）",
        "properties": {
          "code": {
            "type": "integer",
            "description": "返回码：0 表示成功；非 0 表示失败（详见附录错误码）"
          },
          "msg": {
            "type": "string",
            "description": "结果提示信息：成功一般为 ok，失败为错误标识"
          },
          "data": {
            "description": "业务数据。成功/失败时的具体结构与类型以接口说明为准；失败时可能为 null/false/0 等。"
          },
          "serverExecutedTime": {
            "type": "integer",
            "description": "服务器程序执行时间（毫秒）"
          }
        },
        "required": [
          "code",
          "msg",
          "serverExecutedTime"
        ],
        "additionalProperties": false
      },
      "AddPrinterItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "打印机名称"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号（SN/PID，见机身底部/背部标签）"
          }
        },
        "required": [
          "name",
          "sn"
        ],
        "additionalProperties": false
      },
      "AddPrintersRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "items": {
            "type": "array",
            "description": "打印机数组，每次最多添加 50 台",
            "items": {
              "$ref": "#/components/schemas/AddPrinterItem"
            },
            "maxItems": 50
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "items"
        ],
        "additionalProperties": false,
        "description": "批量添加打印机请求"
      },
      "BatchOperationResult": {
        "type": "object",
        "description": "批量操作结果：成功列表、失败列表及失败原因",
        "properties": {
          "success": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "成功的打印机编号列表"
          },
          "fail": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "失败的打印机编号列表"
          },
          "failMsg": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "失败原因列表，格式如 \"SN:错误码\""
          }
        },
        "required": [
          "success",
          "fail",
          "failMsg"
        ],
        "additionalProperties": false
      },
      "AddPrintersResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/BatchOperationResult"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "SetVoiceTypeRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "voiceType": {
            "type": "integer",
            "description": "声音类型：\n固件版本 V10.xx：0 真人语音（大）1 真人语音（中）2 真人语音（小）3 嘀嘀声 4 静音；\n其它固件版本：0 真人语音 3 嘀嘀声 4 静音。"
          },
          "volumeLevel": {
            "type": "integer",
            "description": "声音大小：0 大 1 中 2 小 3 关闭；仅固件版本非 V10.xx 的机器支持"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "voiceType"
        ],
        "additionalProperties": false,
        "description": "设置打印机语音类型请求"
      },
      "BooleanResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "PrintReceiptRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "content": {
            "type": "string",
            "description": "打印内容（GBK 编码判断，不能超过 12K）。内容支持排版控制标签，例如：\n<BR> 换行；<L></L> 左对齐；<C></C> 居中；<R></R> 右对齐；\n<N></N> 正常；<HB></HB> 高一倍；<WB></WB> 宽一倍；<B></B> 放大一倍；<CB></CB> 放大一倍居中；\n<CUT> 自定义切刀；<HB2></HB2> 高二倍；<WB2></WB2> 宽二倍；<B2></B2> 放大二倍；<BOLD></BOLD> 加粗；\n<IMG></IMG> 打印已在平台上传的 LOGO（可通过 <IMG60> 自定义宽度，默认 40，范围 20-200，图片数据最大 30KB）；\n<CY ct=1></CY> 货币符号打印；\n<QRCODE s=6 e=L l=center>二维码内容</QRCODE>；\n<FONT w=\"0\" h=\"0\">...</FONT> 字体倍数放大（w/h 0-7）；\n<BARCODE t=CODE128 w=2 h=100 p=2>条码值</BARCODE>；\n<RH n=\"3\">...</RH> 行间距设置（n 0-5，需放在 <L>/<C>/<R> 之间，且内容≥2行才生效）；\n<P></P> 横向左右布局模式、<AREA></AREA> 区域打印（仅部分机型支持）。\n更多标签说明见文档。"
          },
          "copies": {
            "type": "integer",
            "description": "打印份数，默认 1，最大 5",
            "minimum": 1,
            "maximum": 5,
            "default": 1
          },
          "cutter": {
            "type": "integer",
            "description": "切刀控制开关：0 开启云端默认设置控制切刀；1 关闭云端切刀（可通过 <CUT> 标签自定义切刀位置）。仅支持切刀机型",
            "enum": [
              0,
              1
            ],
            "default": 0
          },
          "voice": {
            "type": "integer",
            "description": "声音播放模式：0 取消订单模式；1 静音模式；2 来单播放模式；3 有用户申请退单；默认 2",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "default": 2
          },
          "mode": {
            "type": "integer",
            "description": "打印模式：0/未指定 检查在线（离线则不生成订单）；1 不检查在线直接生成订单（离线则缓存队列）",
            "enum": [
              0,
              1
            ],
            "default": 0
          },
          "expiresIn": {
            "type": "integer",
            "description": "订单有效期（秒）。超过该时间不自动打印；0 使用系统默认。使用该参数时需要 mode=1。取值范围：0 < expiresIn < 86400",
            "minimum": 0,
            "maximum": 86399
          },
          "payType": {
            "type": "integer",
            "description": "支付方式（41-55），仅支持金额播报的机型有效",
            "minimum": 41,
            "maximum": 55
          },
          "payMode": {
            "type": "integer",
            "description": "支付与否（59-61）：59 退款；60 到账；61 消费。仅支持金额播报的机型有效",
            "minimum": 59,
            "maximum": 61
          },
          "money": {
            "type": "number",
            "description": "支付金额（最多 2 位小数），仅支持金额播报的机型有效"
          },
          "attached": {
            "type": "string",
            "description": "推送接口附加值，由开发者平台产生，通过订单状态接口回调推送给开发者；云存储有效期 24 小时"
          },
          "backurlFlag": {
            "type": "integer",
            "description": "打印订单状态回调标识：[1-5]，对应开放平台后台“功能设置”里的打印接口回调标识",
            "minimum": 1,
            "maximum": 5
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "content"
        ],
        "additionalProperties": false,
        "description": "打印小票订单请求"
      },
      "OrderIdResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "订单编号（orderId）"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "PrintLabelRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "content": {
            "type": "string",
            "description": "标签打印内容（GBK 编码判断，不能超过 12K）。注意：打印内容内（标签除外）尖括号需要转译：\"<\"→\"<\"，\">\"→\">\"。1mm=8dots。内容支持标签指令标签，例如：\n<PAGE n=\"2\"></PAGE> 分页/份数；\n<SIZE>width,height</SIZE> 设置标签纸宽高（单位 mm，需放在 PAGE 内生效）；\n<TEXT x=\"10\" y=\"100\" font=\"9\" w=\"1\" h=\"2\" r=\"0\">文本</TEXT>；\n<BC128 ...>CODE128</BC128>，<BC39 ...>CODE39</BC39>；\n<QRC x=\"20\" y=\"20\" s=\"2\" e=\"L\">二维码</QRC>；\n<IMG x=\"16\" y=\"32\" w=\"100\"> 打印平台已上传的 LOGO（空标签）；\n<SEQ ...> 方框；<L ...> 表格线。更多说明见文档。"
          },
          "copies": {
            "type": "integer",
            "description": "打印份数，默认 1，最大 5",
            "minimum": 1,
            "maximum": 5,
            "default": 1
          },
          "voice": {
            "type": "integer",
            "description": "声音播放模式：0 取消订单模式；1 静音模式；2 来单播放模式；3 有用户申请退单；默认 2",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "default": 2
          },
          "mode": {
            "type": "integer",
            "description": "打印模式：0/未指定 检查在线（离线则不生成订单）；1 不检查在线直接生成订单（离线则缓存队列）",
            "enum": [
              0,
              1
            ],
            "default": 0
          },
          "expiresIn": {
            "type": "integer",
            "description": "订单有效期（秒）。超过该时间不自动打印；0 使用系统默认。使用该参数时需要 mode=1。取值范围：0 < expiresIn < 86400",
            "minimum": 0,
            "maximum": 86399
          },
          "payType": {
            "type": "integer",
            "description": "支付方式（41-55），仅支持金额播报的机型有效",
            "minimum": 41,
            "maximum": 55
          },
          "payMode": {
            "type": "integer",
            "description": "支付与否（59-61）：59 退款；60 到账；61 消费。仅支持金额播报的机型有效",
            "minimum": 59,
            "maximum": 61
          },
          "money": {
            "type": "number",
            "description": "支付金额（最多 2 位小数），仅支持金额播报的机型有效"
          },
          "attached": {
            "type": "string",
            "description": "推送接口附加值，由开发者平台产生，通过订单状态接口回调推送给开发者；云存储有效期 24 小时"
          },
          "backurlFlag": {
            "type": "integer",
            "description": "打印订单状态回调标识：[1-5]，对应开放平台后台“功能设置”里的打印接口回调标识",
            "minimum": 1,
            "maximum": 5
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "content"
        ],
        "additionalProperties": false,
        "description": "打印标签订单请求"
      },
      "SnList": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "打印机编号集合（字符串数组）"
      },
      "DelPrintersRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "snlist": {
            "$ref": "#/components/schemas/SnList"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "snlist"
        ],
        "additionalProperties": false,
        "description": "批量删除打印机请求"
      },
      "DelPrintersResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/BatchOperationResult"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "UpdPrinterRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "name": {
            "type": "string",
            "description": "打印机名称"
          },
          "cardno": {
            "type": "string",
            "description": "打印机流量卡号码"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "name"
        ],
        "additionalProperties": false,
        "description": "修改打印机信息请求"
      },
      "DelPrinterQueueRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "orderId": {
            "type": "string",
            "description": "订单编号。多个订单使用英文逗号\",\"分隔；每次最多支持清除 10 个订单"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn"
        ],
        "additionalProperties": false,
        "description": "清空待打印队列请求"
      },
      "QueryOrderStateRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "orderId": {
            "type": "string",
            "description": "订单编号，由打印接口返回"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "orderId"
        ],
        "additionalProperties": false,
        "description": "查询订单是否打印成功请求"
      },
      "QueryOrderStatisRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "查询日期，格式 yyyy-MM-dd，如：2019-08-15"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "date"
        ],
        "additionalProperties": false,
        "description": "查询某天订单统计请求"
      },
      "OrderStatis": {
        "type": "object",
        "properties": {
          "printed": {
            "type": "integer",
            "description": "已打印订单数"
          },
          "waiting": {
            "type": "integer",
            "description": "等待打印订单数"
          }
        },
        "required": [
          "printed",
          "waiting"
        ],
        "additionalProperties": false
      },
      "OrderStatisResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OrderStatis"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "QueryPrinterStatusRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn"
        ],
        "additionalProperties": false,
        "description": "获取指定打印机状态请求"
      },
      "PrinterStatusValue": {
        "type": "integer",
        "enum": [
          0,
          1,
          2
        ],
        "description": "打印机状态值：0 离线；1 在线正常；2 在线异常（一般为缺纸）。离线判断：与服务器失联超过 30 秒"
      },
      "PrinterStatusResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/PrinterStatusValue"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "QueryPrintersStatusRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "snlist": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "打印机编号数组（一次最多查询 20 台设备）",
            "maxItems": 20
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "snlist"
        ],
        "additionalProperties": false,
        "description": "批量获取打印机状态请求"
      },
      "PrinterStatusListResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PrinterStatusValue"
                    }
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "批量返回打印机状态值，顺序与请求 snlist 一一对应"
              }
            }
          }
        ]
      },
      "PlayVoiceRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "payType": {
            "type": "integer",
            "description": "支付方式（41-55），仅支持金额播报的机型有效",
            "minimum": 41,
            "maximum": 55
          },
          "payMode": {
            "type": "integer",
            "description": "支付与否（59-61）：59 退款；60 到账；61 消费。仅支持金额播报的机型有效",
            "minimum": 59,
            "maximum": 61
          },
          "money": {
            "type": "number",
            "description": "支付金额（最多 2 位小数），仅支持金额播报的机型有效"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn"
        ],
        "additionalProperties": false,
        "description": "金额播报请求"
      },
      "ZeroStringResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "type": "string",
                    "description": "正确返回通常为字符串 \"0\""
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      },
      "PosPrintRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "content": {
            "type": "string",
            "description": "打印内容：打印机可识别的经过 base64 加密后的 POS 指令数据（不能超过 12K）"
          },
          "copies": {
            "type": "integer",
            "description": "打印份数，默认 1，最大 5",
            "minimum": 1,
            "maximum": 5,
            "default": 1
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "content"
        ],
        "additionalProperties": false,
        "description": "POS 指令打印请求"
      },
      "ControlBoxRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn"
        ],
        "additionalProperties": false,
        "description": "钱箱控制请求"
      },
      "PlayVoiceExtRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "content": {
            "type": "string",
            "description": "语音播报内容（预定义语音序号组合），如 #62；具体序号需咨询技术支持"
          },
          "voiceTime": {
            "type": "integer",
            "description": "语音播报次数，默认 1",
            "minimum": 1,
            "default": 1
          },
          "voiceInterval": {
            "type": "integer",
            "description": "多次播报间隔（秒），仅 voiceTime>1 时有效",
            "minimum": 0
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "content"
        ],
        "additionalProperties": false,
        "description": "扩展语音播报请求"
      },
      "PlayCustomVoiceRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "content": {
            "type": "string",
            "description": "自定义语音播报内容（目前仅支持汉语）"
          },
          "voiceTime": {
            "type": "integer",
            "description": "语音播报次数，默认 1",
            "minimum": 1,
            "default": 1
          },
          "voiceInterval": {
            "type": "integer",
            "description": "多次播报间隔（秒），仅 voiceTime>1 时有效",
            "minimum": 0
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "content"
        ],
        "additionalProperties": false,
        "description": "自定义语音播报请求"
      },
      "UploadLogoRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          },
          "content": {
            "type": "string",
            "description": "店铺 LOGO 的 base64 内容（不包含 data:image/...;base64, 前缀）"
          },
          "labelMode": {
            "type": "integer",
            "description": "标签机（T271U、320B）有效且需要指定固定值 2"
          },
          "imageSize": {
            "type": "integer",
            "description": "LOGO 图片大小（标签机有效）：指定后，宽或高大于该值则等比缩放；未达到则保留原大小",
            "minimum": 1
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn",
          "content"
        ],
        "additionalProperties": false,
        "description": "店铺 LOGO 上传请求"
      },
      "DelUploadLogoRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn"
        ],
        "additionalProperties": false,
        "description": "店铺 LOGO 删除请求"
      },
      "PrinterType": {
        "type": "string",
        "description": "打印机类型：00 58票据；01 58标签；02 80票据；03 80标签",
        "enum": [
          "00",
          "01",
          "02",
          "03"
        ]
      },
      "PrinterPaperSize": {
        "type": "object",
        "description": "纸张大小（单位 mm），针对标签机有效",
        "properties": {
          "gap": {
            "type": "integer",
            "description": "标签之间间隔"
          },
          "width": {
            "type": "integer",
            "description": "标签宽度"
          },
          "height": {
            "type": "integer",
            "description": "标签高度或长度"
          }
        },
        "required": [
          "gap",
          "width",
          "height"
        ],
        "additionalProperties": false
      },
      "PrinterInfo": {
        "type": "object",
        "description": "打印机基本信息（部分字段仅 4G 机型存在）",
        "properties": {
          "name": {
            "type": "string",
            "description": "打印机名称"
          },
          "sn": {
            "type": "string",
            "description": "设备编号"
          },
          "status": {
            "type": "string",
            "description": "打印机状态：Offline 离线、OnlinNormal 在线正常、OnlineMissingPaper 在线缺纸"
          },
          "type": {
            "$ref": "#/components/schemas/PrinterType"
          },
          "version": {
            "type": "string",
            "description": "打印机固件版本，如 V10.13"
          },
          "paperSize": {
            "$ref": "#/components/schemas/PrinterPaperSize"
          },
          "cutter": {
            "type": "boolean",
            "description": "是否带切刀：true 有切刀；false 无切刀"
          },
          "supportUyghur": {
            "type": "boolean",
            "description": "是否支持维语：true 支持；false 不支持"
          },
          "simValidity": {
            "type": "string",
            "description": "SIM 有效期（仅带 4G 接口机型）"
          },
          "expiryDays": {
            "type": "integer",
            "description": "剩余有效天数（仅带 4G 接口机型）"
          },
          "official": {
            "type": "boolean",
            "description": "是否官方卡：true 官方卡；false 非官方卡（仅带 4G 接口机型）"
          },
          "simStatus": {
            "type": "integer",
            "description": "卡状态码（仅带 4G 接口机型）：1 待激活；2 已激活；4 停机；6 可测试；7 库存；8 预销户；9 已销户；5 已过期"
          },
          "simStatusDesc": {
            "type": "string",
            "description": "卡状态描述（仅带 4G 接口机型）"
          }
        },
        "required": [
          "name",
          "sn",
          "status",
          "type",
          "version",
          "cutter",
          "supportUyghur"
        ],
        "additionalProperties": false
      },
      "PrinterInfoRequest": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "timestamp": {
            "$ref": "#/components/schemas/UnixTimestampSeconds"
          },
          "sign": {
            "$ref": "#/components/schemas/Sha1LowerHex40"
          },
          "debug": {
            "$ref": "#/components/schemas/DebugFlag"
          },
          "sn": {
            "type": "string",
            "description": "打印机编号"
          }
        },
        "required": [
          "user",
          "timestamp",
          "sign",
          "sn"
        ],
        "additionalProperties": false,
        "description": "获取打印机基本信息请求"
      },
      "PrinterInfoResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ResponseEnvelope"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/PrinterInfo"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        ]
      }
    },
    "responses": {},
    "examples": {},
    "x-xpyun-error-codes": {
      "0": {
        "status": "成功",
        "msg": "ok",
        "troubleshooting": ""
      },
      "-1": {
        "status": "请求头错误",
        "msg": "REQUEST_HEADER_ERROR",
        "troubleshooting": "检查 Content-Type: application/json;charset=UTF-8；出现 415 时重点排查请求头与提交方式；检查 Accept 标头等"
      },
      "-2": {
        "status": "参数不合法",
        "msg": "REQUEST_PARAM_INVALID",
        "troubleshooting": "参数值为空或格式/大小不符合要求；检查必填参数与格式"
      },
      "-3": {
        "status": "参数签名失败",
        "msg": "REQUEST_SIGN_FAILED",
        "troubleshooting": "参考 sign 字段说明；检查开发者秘钥或开发者ID是否包含空白字符"
      },
      "-4": {
        "status": "用户未注册",
        "msg": "REQUEST_USER_NOT_REGISTER",
        "troubleshooting": "需前往平台注册开发者账号"
      },
      "1001": {
        "status": "打印机编号和用户不匹配",
        "msg": "SN_USER_NOT_MATCH",
        "troubleshooting": "打印机尚未添加至云平台，需要登录云平台添加或调用添加接口"
      },
      "1002": {
        "status": "打印机未注册",
        "msg": "PRINTER_NOT_REGISTER",
        "troubleshooting": "打印机尚未添加至云平台，需要登录云平台添加或调用添加接口"
      },
      "1003": {
        "status": "打印机不在线",
        "msg": "PRINTER_OFFLINE",
        "troubleshooting": "检查打印机是否正常联网，网络环境是否可访问互联网"
      },
      "1004": {
        "status": "添加订单失败",
        "msg": "ADD_ORDER_FAILED",
        "troubleshooting": "检查订单内容中是否存在非法使用的标签（如空标签）"
      },
      "1005": {
        "status": "未找到订单信息",
        "msg": "ORDER_NOT_FOUND",
        "troubleshooting": "检查订单号是否为云端接口返回的订单号"
      },
      "1006": {
        "status": "订单日期格式或大小不正确",
        "msg": "ORDER_DATE_INVALID",
        "troubleshooting": "检查 date 参数格式 yyyy-MM-dd"
      },
      "1007": {
        "status": "打印内容不能超过 12K",
        "msg": "PRINT_CONTENT_MORE_THAN_12K_BYTES",
        "troubleshooting": "打印内容超出 12K 需按业务拆分数据"
      },
      "1008": {
        "status": "用户修改打印机记录失败",
        "msg": "PRINTER_RECORD_LOCK_FAIL",
        "troubleshooting": ""
      },
      "1009": {
        "status": "添加打印机时编号或名称不能为空",
        "msg": "SN_OR_NAME_EMPTY",
        "troubleshooting": "sn 和 name 为必填项，不可省略"
      },
      "1010": {
        "status": "打印机设备编号无效",
        "msg": "PRINTER_NUMBER_INVALID",
        "troubleshooting": "确认设备为云打印机且编号输入正确（机身 sn/pid 标签后一串字符）"
      },
      "1011": {
        "status": "打印机已存在",
        "msg": "PRINTER_EXIST",
        "troubleshooting": "如需再次添加，需先在云平台删除或调用 delPrinters 接口删除"
      },
      "1012": {
        "status": "添加打印设备失败",
        "msg": "PRINTER_EXCEPTION",
        "troubleshooting": "稍后再试或联系售后技术支持"
      },
      "1013": {
        "status": "打印订单触发幂等性",
        "msg": "ORDER_IDEMPOTENT",
        "troubleshooting": "排查是否重复提交，幂等因子需保证全局唯一"
      },
      "1014": {
        "status": "幂等因子过长",
        "msg": "ORDER_IDEMPOTENT_LIMITLEN",
        "troubleshooting": "幂等因子有效长度为 50 个字符，调整长度"
      },
      "1016": {
        "status": "LOGO 文件格式错误",
        "msg": "LOGO_FORMAT_ERROR",
        "troubleshooting": "确认图片格式（png/jpg）；内容需 base64；去掉 data:image/...;base64, 前缀"
      },
      "1017": {
        "status": "LOGO 文件超出规定范围",
        "msg": "LOGO_SIZE_LARGE",
        "troubleshooting": "logo 文件大小不能超过 30KB"
      },
      "1018": {
        "status": "LOGO 上传次数超限制",
        "msg": "LOGO_UPLOAD_TIMES",
        "troubleshooting": "每天最多 3 次，等待次日再上传"
      },
      "1020": {
        "status": "LOGO 删除失败",
        "msg": "LOGO_DELETE_NO_EXIST",
        "troubleshooting": "logo 已删除或尚未上传；若确认已上传仍报错请联系技术排查"
      },
      "1021": {
        "status": "LOGO 上传模式错误",
        "msg": "LABEL_MODE_ERROR",
        "troubleshooting": "标签机需在标签打印模式下上传；可打印自检页确认模式"
      },
      "1022": {
        "status": "设备属于定制设备无权使用",
        "msg": "CUSTOM_DEVICE_NO_PERMISSION",
        "troubleshooting": "该打印机指定了所属账号，不能添加；有疑问请联系客服"
      }
    }
  }
}