文档
测试

2.2取得菜品

GET
getProductsByEmployee

接口描述

取得登录收银员相关的菜品,用于菜单模式

请求参数

参数名
类型
描述
必填
token
Stribg
登录TOKEN
必填
appid
String
商户appid,登录中返回的;用来与后端解密后TOKEN中保存的appid比对用,防止非法请求
必填
employee_id
Long
收银员ID,登录中返回的
必填
current_page
int
页数,即第几页,默认1
可选
page_size
int
每页记录条数,默认10
可选

响应参数

参数名
类型
描述
必填
code
int
错误码,成功返回 200,失败返回其它
必填
message
String
错误描述
必填
data
Object
对象,业务数据,具体看下一级返回字段
必填
products
Array
JSONArray,菜品数组,每个数组对象字段如下(不是全部,列出接口用到一部分字段)
必填
product_id
Long
商品ID
必填
product_name
String
商品名称,最长8个中文汉字
必填
price
Double
商品单价
必填
unit
Sttring
商品规格单位,如份、杯
必填
category_id
Long
菜品分类 ID
必填

说明 / 示例

### 请求示例 ``` https://api2.XXX.cn/cm/getProducts?token=TOKEN&appid=jb25112e65f20e7dfe&employee_id=1 ``` ### 返回示例 #### 成功返回 JSON ``` { "code": 200, "message": "success", "data": { "total": 5, "products": [ { "unit": "份", "pinyin_code": "YSCP1", "img_url": null, "clear_flag": 0, "price": 4.0, "product_id": 51118932, "kitchen_print": 0, "vip_price": 3.0, "product_name": "演示菜品1" }, { "unit": "份", "pinyin_code": "YSCP2", "img_url": null, "clear_flag": 0, "price": 8.0, "product_id": 51118933, "kitchen_print": 0, "vip_price": 6.0, "product_name": "演示菜品2" }, { "unit": "份", "pinyin_code": "YSCP3", "img_url": null, "clear_flag": 0, "price": 12.0, "product_id": 51118934, "kitchen_print": 0, "vip_price": 9.0, "product_name": "演示菜品3" }, { "unit": "份", "pinyin_code": "YSCP4", "img_url": null, "clear_flag": 0, "price": 16.0, "product_id": 51118935, "kitchen_print": 0, "vip_price": 12.0, "product_name": "演示菜品4" }, { "unit": "份", "pinyin_code": "YSCP5", "img_url": null, "clear_flag": 0, "price": 20.0, "product_id": 51118936, "kitchen_print": 0, "vip_price": 15.0, "product_name": "演示菜品5" } ] } } ``` #### 失败返回 ``` { "code": 1502, "message": "business.error.netShopId.isnotExist", "data": "" } ``` ==business.error.netShopId.isnotExist== 商户appid不存在 ``` { "code": 5002, "message": "business.error.employee.notFound", "data": "" } ``` 收银员不存在,employee_id 错误