个人拥有的优惠券

简要描述:

  • 个人拥有的优惠券列表(分为 3 种状态:未使用 已过期 已使用)

请求域名:

请求URL:

  • /addons/yun_shop/api.php?i=2&route=coupon.member-coupon.coupons-of-member-by-status&status_request=1

参数:

参数名 是否必须 类型 说明
status_request int 用于请求个人拥有的不同状态下的优惠券, 1 表示请求"未使用"的优惠券, 2 "已过期", 3 "已使用"
pagesize int 分页 - 每页的优惠券数量(如果不设置,默认为10)

返回示例:

正确时返回:

{
    "result": 1, 
    "msg": "ok", 
    "data": [
        {
            "id": 310, 
            "coupon_id": 142, 
            "used": 0, 
            "use_time": 0, 
            "get_time": 1493256969, 
			"can_spread":true,
            "belongs_to_coupon": {
                "id": 142, 
                "name": "立减100元", 
                "coupon_method": 1, 
                "deduct": 100, 
                "discount": 10, 
                "enough": 1000, 
                "use_type": 0, 
                "category_ids": null, 
                "categorynames": null, 
                "goods_ids": null, 
                "goods_names": null, 
                "time_limit": 0, 
                "time_days": 30, 
                "time_start": "2017-04-27 00:00:00", 
                "time_end": "2017-05-04 00:00:00", 
                "total": 300, 
                "start": "2017-04-27", 
                "end": "2017-05-27"
            }, 
            "api_limit": "商城通用"
        }, 
        {
            "id": 321, 
            "coupon_id": 145, 
            "used": 0, 
            "use_time": 0, 
            "get_time": 1493280298, 
            "belongs_to_coupon": {
                "id": 145, 
                "name": "适用于多个商品", 
                "coupon_method": 1, 
                "deduct": 200, 
                "discount": 10, 
                "enough": 3500, 
                "use_type": 2, 
                "category_ids": null, 
                "categorynames": null, 
                "goods_ids": [
                    "62", 
                    "68", 
                    "192", 
                    "207"
                ], 
                "goods_names": [
                    "测试商品-电视1", 
                    "99测试", 
                    "供应商测试4", 
                    "测试商品 勿删1"
                ], 
                "time_limit": 0, 
                "time_days": 10, 
                "time_start": "2017-05-02 00:00:00", 
                "time_end": "2017-05-09 00:00:00", 
                "total": 300, 
                "start": "2017-04-27", 
                "end": "2017-05-07"
            }, 
            "api_limit": "适用于下列商品: 测试商品-电视1,99测试,供应商测试4,测试商品 勿删1"
        }
    ]
}

错误时返回:

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

返回参数说明:

参数名 类型 说明
coupon_id int 优惠券 ID
used int 是否已使用( 0 未使用; 1 已使用)
get_time int 获取优惠券的时间 (Unix时间戳)
can_spread bool 能否展开 true 显示展开 false 不显示展开
belongs_to_coupon.id int 优惠券ID
belongs_to_coupon.name str 优惠券名称
belongs_to_coupon.coupon_method int 优惠方式: 1为立减deduct, 2为折扣discount
belongs_to_coupon. deduct int 立减多少元(注意,coupon_method为1时,该数据才有意义)
belongs_to_coupon. discount float 折扣(注意,coupon_method为2时,该数据才有意义; 例子:7表示打7折,即原价的0.7倍)
belongs_to_coupon. enough int 消费满多少元, 优惠券才可用(空或0为不限制)
belongs_to_coupon. use_type int 适用范围,0商城通用 1指定分类 2指定商品
belongs_to_coupon. category_ids array 适用的分类ID (受belongs_to_coupon. use_type影响)
belongs_to_coupon. categorynames array 适用的分类名称 (受belongs_to_coupon. use_type影响)
belongs_to_coupon. goods_ids array 适用的商品ID(受belongs_to_coupon. use_type影响)
belongs_to_coupon. goods_names array 适用的商品范围(受belongs_to_coupon. use_type影响)
belongs_to_coupon. time_limit int 时间限制类型: 0 表示领取后几天有效, 1时间范围
belongs_to_coupon. time_days int 领取后几天有效(受belongs_to_coupon. time_limit影响)
belongs_to_coupon. time_start int 有效期的起始时间(受belongs_to_coupon. time_limit影响)
belongs_to_coupon. time_end int 有效期的终止时间(受belongs_to_coupon. time_limit影响)
belongs_to_coupon. total int 发放总数量限制( -1 为不限制)
belongs_to_coupon. start int 有效期
belongs_to_coupon. end int 有效期
belongs_to_coupon. api_limit str 适用范围的描述, 比如"适用于下列商品: 测试商品-电视1,99测试"

备注:

  • 正确时返回的数据中, 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 无意义