95 lines
2.6 KiB
YAML
95 lines
2.6 KiB
YAML
openapi: 3.0.3
|
||
info:
|
||
title: 条形码识别端口 API
|
||
version: 1.0.0
|
||
description: 本地视觉识别 EAN-13 的测试接口定义(示例)。
|
||
servers:
|
||
- url: http://localhost:8000
|
||
paths:
|
||
/recognize/ean13:
|
||
post:
|
||
summary: 识别 EAN-13(✅ 完全实现:Pyzbar+自研回退,UI 与服务端可用)
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
file:
|
||
type: string
|
||
format: binary
|
||
responses:
|
||
"200":
|
||
description: 成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
code:
|
||
type: string
|
||
description: EAN-13 数字串(未识别为空字符串)
|
||
message:
|
||
type: string
|
||
type:
|
||
type: string
|
||
description: 命中的主类型;未识别为空
|
||
others:
|
||
type: array
|
||
items:
|
||
type: object
|
||
properties:
|
||
type:
|
||
type: string
|
||
code:
|
||
type: string
|
||
"400":
|
||
description: 参数错误
|
||
"500":
|
||
description: 服务器错误
|
||
/api/barcode/scan:
|
||
post:
|
||
summary: 图片上传并识别 EAN-13(✅ 完全实现)
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
multipart/form-data:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
file:
|
||
type: string
|
||
format: binary
|
||
responses:
|
||
"200":
|
||
description: 成功
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
success:
|
||
type: boolean
|
||
barcodeType:
|
||
type: string
|
||
example: EAN13
|
||
barcode:
|
||
type: string
|
||
example: 6901234567892
|
||
"400":
|
||
description: 无法识别或参数错误
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
success:
|
||
type: boolean
|
||
example: false
|
||
message:
|
||
type: string
|
||
example: 无法识别,请重新上传
|
||
|
||
|