优惠券中心

简要描述:

  • 提供给用户的"优惠券中心"的数据接口(排除已经过期的优惠券,排除用户等级没有达到会员等级要求的优惠券)

请求域名:

请求URL

  • /addons/yun_shop/api.php?i=2&route=coupon.member-coupon.coupons-for-member

参数:

参数名 是否必须 类型 说明
pagesize int 分页 - 每页的优惠券数量(如果不设置,默认为10)

返回示例:

正确时返回:

{
    "result": 1,
    "msg": "ok",
    "data": {
        "data": {
            "total": 3,
            "per_page": 10,
            "current_page": 1,
            "last_page": 1,
            "next_page_url": null,
            "prev_page_url": null,
            "from": 1,
            "to": 3,
            "data": [
                {
                    "id": 5,
                    "name": "优惠券测试",
                    "coupon_method": 1,
                    "deduct": "10.00",
                    "discount": "0.00",
                    "enough": 100,
                    "use_type": 0,
                    "category_ids": null,
                    "categorynames": null,
                    "goods_ids": [
                        "64"
                    ],
                    "goods_names": [
                        "爱心值测试"
                    ],
                    "time_limit": 0,
                    "time_days": 0,
                    "time_start": "2017-09-26 00:00:00",
                    "time_end": "2017-10-03 00:00:00",
                    "get_max": -1,
                    "total": -1,
                    "money": "0.00",
                    "credit": 0,
                    "updated_at": "2017-09-26 15:14:15",
                    "has_many_member_coupon_count": 28,
                    "member_got_count": 0,
                    "coupon_type_name": "平台商品",
                    "api_availability": 1,
                    "api_remaining": -1,
                    "api_limit": "商城通用"
                },
                {
                    "id": 4,
                    "name": "12",
                    "coupon_method": 1,
                    "deduct": "10.00",
                    "discount": "0.00",
                    "enough": 0,
                    "use_type": 0,
                    "category_ids": null,
                    "categorynames": null,
                    "goods_ids": null,
                    "goods_names": null,
                    "time_limit": 0,
                    "time_days": 0,
                    "time_start": "2017-08-16 00:00:00",
                    "time_end": "2017-08-23 00:00:00",
                    "get_max": 11,
                    "total": 0,
                    "money": "0.00",
                    "credit": 0,
                    "updated_at": "2017-08-16 15:49:45",
                    "has_many_member_coupon_count": 1,
                    "member_got_count": 0,
                    "coupon_type_name": "平台商品",
                    "api_availability": 3,
                    "api_remaining": 11,
                    "api_limit": "商城通用"
                },
                {
                    "id": 3,
                    "name": "满100减10",
                    "coupon_method": 1,
                    "deduct": "10.00",
                    "discount": "0.00",
                    "enough": 100,
                    "use_type": 0,
                    "category_ids": null,
                    "categorynames": null,
                    "goods_ids": null,
                    "goods_names": null,
                    "time_limit": 0,
                    "time_days": 0,
                    "time_start": "2017-07-14 00:00:00",
                    "time_end": "2017-07-21 00:00:00",
                    "get_max": -1,
                    "total": 100,
                    "money": "0.00",
                    "credit": 0,
                    "updated_at": "2017-07-17 19:09:21",
                    "has_many_member_coupon_count": 39,
                    "member_got_count": 0,
                    "coupon_type_name": "平台商品",
                    "api_availability": 1,
                    "api_remaining": -1,
                    "api_limit": "商城通用"
                }
            ]
        },
        "search_array": [
            "全部",
            "平台",
            "门店",
            "酒店",
            "指定商品",
            "分类商品",
            "兑换券",
            "满减券",
            "折扣券"
        ],
		 "slide_shows": [
      {
        "id": 1,
        "uniacid": 1,
        "sort": 1,
        "title": "ces",
        "slide_pic": "https://dev8.yunzmall.com/static/upload/image/18d759ccb27c6766046530b598dd91d4.jpg",
        "slide_link": "123",
        "mini_link": "123",
        "is_show": 1,
        "created_at": "2020-02-11 14:28:33",
        "updated_at": "2020-02-11 14:28:33",
        "pic_url": "http://dev15.yunzmall.com/static/upload/image/18d759ccb27c6766046530b598dd91d4.jpg",
        "status_name": "显示"
      }
    ]
    }
}

错误时返回:

{
    "result": 0, 
    "msg": "没有找到记录", 
    "data": [ ]
}

返回参数说明data.data:

参数名 类型 说明
name str 优惠券名称
coupon_method int 优惠方式: 1为立减deduct, 2为折扣discount
deduct int 立减多少元(注意,coupon_method为1时,该数据才有意义)
discount float 折扣(注意,coupon_method为2时,该数据才有意义; 例子:7表示打7折,即原价的0.7倍)
enough int 消费满多少元, 优惠券才可用(空或0为不限制)
use_type int 适用范围,0商城通用 1指定分类 2指定商品
category_ids array 适用的分类ID (受use_type影响)
categorynames array 适用的分类名称 (受use_type影响)
goods_ids array 适用的商品ID (受use_type影响)
goods_names array 适用的商品名称 (受use_type影响)
time_limit int 时间限制类型: 0领取后几天有效, 1时间范围
time_days int 领取后几天有效(受time_limit影响)
time_start int 有效期的起始时间(受time_limit影响)
time_end int 有效期的终止时间(受time_limit影响)
get_max int 每人限领的上限
total int 发放总数量限制( -1 为不限制)
has_many_member_coupon_count int 已经被领取多少张
member_got_count int 该用户已经领取该优惠券多少张
api_availability int 优惠券是否可用: 1 可领取, 2 已经领取, 3 已经被抢光
api_remaining int 优惠券还剩多少张
belongs_to_coupon. api_limit str 适用范围的描述, 比如"适用于下列商品: 测试商品-电视1,99测试"

| search_array | array | 搜索列表 | | slide_shows | array | 幻灯片列表 |

返回参数说明data.data.slide_shows:

参数名 类型 说明
pic_url str 图片路径
slide_link str 连接
mini_link str 小程序连接

备注:

  • 正确时返回的数据中, coupon_method 是"优惠方式", 1为立减deduct, 2为折扣discount; 所以当它的值为 1 时, deduct 字段才有意义, discount 无意义(之所以有值是因为可能用户期间变更了优惠方式类型,但是旧有的数据会残留)
  • 正确时返回的数据中, use_type 是"适用范围", 0商城通用 1指定分类 2指定商品; 所以当它的值为 1 时, categorynames 字段才有意义, goods_names 无意义
  • 同样的, time_limit 是"时间限制类型", 0领取后几天有效, 1为时间范围; 当它的值为 0 时, time_days 才有意义, 同时 time_starttime_end 无意义