认证说明

此页面所有接口,用户都需要先认证后,在 header 中传递参数

{
    Accept: 'application/json',
    'Authorization': 'Bearer 小程序发过来的code',
}

1. 生成订单

POST /canteen/api/v2/orders

Response:

  • id [Integer] 订单 id

  • user_id [String] 用户 id

  • out_trade_no [String] 订单号

  • total_price [Decimal] 订单金额

  • created_at [String] 订单生成时间

  • updated_at [String] 订单更新时间

2. 微信支付

GET /canteen/api/v2/orders/:id/pay

Response:

  • appId [Integer] 小程序的 appId

  • package [String] prepay_id=wx**************

  • nonceStr [String] 随机字符串

  • timeStamp [Integer] 时间戳

  • signType [String] 签名类型

  • paySign [String] 签名

3. 订单列表

GET /canteen/api/v2/orders

Response:

{
    "orders": [
        {
            "id": 1,
            "user_id": 374,
            "out_trade_no": "wechat_mini_20210224113214_1",
            "total_price": "51.5",
            "created_at": "2021年02月24日",
            "updated_at": "2021年02月24日",
            "products": [
                {
                    "name": "怡宝",
                    "image": "https://images.clwy.cn/canteen/product/2/image/7724a7.jpg!thumb",
                    "price": "2.0",
                    "num": 1
                },
                {
                    "name": "益达口香糖(橘子味)",
                    "image": "https://images.clwy.cn/canteen/product/1/image/18e3e8.jpg!thumb",
                    "price": "5.0",
                    "num": 5
                }
            ]
        }
    ]
}

4. 当前订单详情

GET /canteen/api/v2/orders/1

Response:

{
    "id": 1,
    "user_id": 374,
    "out_trade_no": "wechat_mini_20210224113214_1",
    "total_price": "51.5",
    "created_at": "2021年02月24日",
    "updated_at": "2021年02月24日",
    "products": [
        {
            "name": "怡宝",
            "image": "https://images.clwy.cn/canteen/product/2/image/7724a7.jpg!thumb",
            "price": "2.0",
            "num": 1
        },
        {
            "name": "益达口香糖(橘子味)",
            "image": "https://images.clwy.cn/canteen/product/1/image/18e3e8.jpg!thumb",
            "price": "5.0",
            "num": 5
        }
    ]
}

已添加到喜欢了