首页 » 微信公众平台开发:从零基础到ThinkPHP5高性能框架实践 » 微信公众平台开发:从零基础到ThinkPHP5高性能框架实践全文在线阅读

《微信公众平台开发:从零基础到ThinkPHP5高性能框架实践》16.6 朋友的券

关灯直达底部

创建朋友的券接口是创建系列接口最重要的一环。

朋友的券是在原有卡券的基础上衍生出的一种高级券的类型,比起普通卡券,朋友的券可以展示有图文介绍的优惠详情(通过advanced_info字段定义),突出服务和商品摘要信息。

创建朋友的券的接口如下。


https:// api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN  

创建朋友的券时,POST数据示例如下。


{    "card":{        "card_type":"CASH",        "cash":{            "base_info":{                "logo_url":"http:// mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaH                qkKSVMMWeN3hLut7X7hicFNjakmx ibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0",                "brand_name":"微信餐厅",                "code_type":"CODE_TYPE_TEXT",                "color":"Color010",                "service_phone":"020-88888888",                "description":"不可与其他优惠同享如需团购券发票,请在消费时向商户提出",                "date_info":{                    "type":"DATE_TYPE_FIX_TIME_RANGE",                    "begin_timestamp":1447397802,                    "end_timestamp":1449893532                },                "can_share":false,                "can_give_friend":false,                "location_id_list":[                    272981040,                    400183234                ],                "get_limit":3,                "center_title":"快速核销",                "center_sub_title":"",                "center_url":"www.qq.com",                "custom_url_name":"立即使用",                "custom_url":"http:// www.qq.com",                "custom_url_sub_title":"6个汉字tips",                "promotion_url_name":"更多优惠",                "promotion_url":"http:// www.qq.com"            },            "advanced_info":{                "use_condition":{                    "accept_category":"鞋类",                    "reject_category":"阿迪达斯",                    "can_use_with_other_discount":true                },                "abstract":{                    "abstract":"微信餐厅推出多种新季菜品,期待您的光临",                    "icon_url_list":[                        "http:// mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sf                        z1bjiaoOYA027iasqSG0sj piby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0"                    ]                },                "text_image_list":[                    {                        "image_url":"http:// mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3                        sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sjpiby4vce3AtaPu6cI                        hBHkt6IjlkY9YnDsfw/0",                        "text":"此菜品精选食材,以独特的烹饪方法,最大程度地刺激食客的味蕾"                    },                    {                        "image_url":"http:// mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn                        97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sj piby4vce3AtaPu6cIhBHkt6Ij                        lkY9YnDsfw/0",                        "text":"此菜品迎合大众口味,老少皆宜,营养均衡"                    }                ],                "time_limit":[                    {                        "type":"MONDAY",                        "begin_hour":0,                        "end_hour":10,                        "begin_minute":10,                        "end_minute":59                    },                    {                        "type":"HOLIDAY"                    }                ],                "business_service":[                    "BIZ_SERVICE_FREE_WIFI",                    "BIZ_SERVICE_WITH_PET",                    "BIZ_SERVICE_FREE_PARK",                    "BIZ_SERVICE_DELIVER"                ],                "consume_share_self_num":1,                "consume_share_card_list":[                ],                "share_friends":true            },            "reduce_cost":10        }    }}  

上述数据的参数说明和普通卡券的基本一致,这里就不再详细描述。