/** * 创建卡券 ----创建卡券 * 接口调用请求说明 * 协议https * http 请求方式POST * 请求Url https://api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN * POST 数据格式json * 请求参数说明 * access_token 是调用接口凭证 * POST 数据是Json 数据 * 数据示例: * { "card": { * "card_type": "GROUPON", * "groupon": { * "base_info": { * "logo_url": * "http:\/\/www.supadmin.cn\/uploads\/allimg\/120216\/1_120216214725_1.jpg", * "brand_name": "海底捞", * "code_type":"CODE_TYPE_TEXT", * "title": "132 元双人火锅套餐", * "sub_title": "", * "color": "Color010", * "notice": "使用时向服务员出示此券", * "service_phone": "020-88888888", * "description": "不可与其他优惠同享\n 如需团购券发票,请在消费时向商户提出\n 店内均可 * 使用,仅限堂食\n 餐前不可打包,餐后未吃完,可打包\n 本团购券不限人数,建议2 人使用,超过建议人 * 数须另收酱料费5 元/位\n 本单谢绝自带酒水饮料", * "date_info": { * "type": 1, * "begin_timestamp": 1397577600, * "end_timestamp": 1399910400 * }, * "sku": { * "quantity": 50000000 * }, * "use_limit": 1, * "get_limit": 3, * "use_custom_code": false, * "bind_openid": false, * "can_share": true, * "can_give_friend":true, * "location_id_list" : [123, 12321, 345345], * "url_name_type": "URL_NAME_TYPE_RESERVATION", * "custom_url": "http://www.qq.com", * "source": "大众点评" * }, * "deal_detail": "以下锅底2 选1(有菌王锅、麻辣锅、大骨锅、番茄锅、清补凉锅、酸菜鱼锅可 * 选):\n 大锅1 份12 元\n 小锅2 份16 元\n 以下菜品2 选1\n 特级肥牛1 份30 元\n 洞庭鮰鱼卷1 份 * 20 元\n 其他\n 鲜菇猪肉滑1 份18 元\n 金针菇1 份16 元\n 黑木耳1 份9 元\n 娃娃菜1 份8 元\n 冬 * 瓜1 份6 元\n 火锅面2 个6 元\n 欢乐畅饮2 位12 元\n 自助酱料2 位10 元"} * }} * 6 * * @return mixed */ public function create(CardBase $card) { $params = array(); $params['card'] = $card->getParams4Create(); $rst = $this->_request->payPost('card/create', $params); return $this->_client->rst($rst); }
/** * 创建卡券 ----创建卡券 * 接口调用请求说明 * 协议https * http 请求方式POST * 请求Url https://api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN * POST 数据格式json * 请求参数说明 * access_token 是调用接口凭证 * POST 数据是Json 数据 * 数据示例: * { "card": { * "card_type": "GROUPON", * "groupon": { * "base_info": { * "logo_url": * "http:\/\/www.supadmin.cn\/uploads\/allimg\/120216\/1_120216214725_1.jpg", * "brand_name": "海底捞", * "code_type":"CODE_TYPE_TEXT", * "title": "132 元双人火锅套餐", * "sub_title": "", * "color": "Color010", * "notice": "使用时向服务员出示此券", * "service_phone": "020-88888888", * "description": "不可与其他优惠同享\n 如需团购券发票,请在消费时向商户提出\n 店内均可 * 使用,仅限堂食\n 餐前不可打包,餐后未吃完,可打包\n 本团购券不限人数,建议2 人使用,超过建议人 * 数须另收酱料费5 元/位\n 本单谢绝自带酒水饮料", * "date_info": { * "type": 1, * "begin_timestamp": 1397577600, * "end_timestamp": 1399910400 * }, * "sku": { * "quantity": 50000000 * }, * "use_limit": 1, * "get_limit": 3, * "use_custom_code": false, * "bind_openid": false, * "can_share": true, * "can_give_friend":true, * "location_id_list" : [123, 12321, 345345], * "url_name_type": "URL_NAME_TYPE_RESERVATION", * "custom_url": "http://www.qq.com", * "source": "大众点评" * }, * "deal_detail": "以下锅底2 选1(有菌王锅、麻辣锅、大骨锅、番茄锅、清补凉锅、酸菜鱼锅可 * 选):\n 大锅1 份12 元\n 小锅2 份16 元\n 以下菜品2 选1\n 特级肥牛1 份30 元\n 洞庭鮰鱼卷1 份 * 20 元\n 其他\n 鲜菇猪肉滑1 份18 元\n 金针菇1 份16 元\n 黑木耳1 份9 元\n 娃娃菜1 份8 元\n 冬 * 瓜1 份6 元\n 火锅面2 个6 元\n 欢乐畅饮2 位12 元\n 自助酱料2 位10 元"} * }} * 6 * * @return mixed */ public function create(CardBase $card) { $params = array(); $params['card'] = $card->getParams4Create(); $access_token = $this->weixin->getToken(); $json = json_encode($params, JSON_UNESCAPED_UNICODE); $rst = $this->weixin->post($this->_url . 'create?access_token=' . $access_token, $json); if (!empty($rst['errcode'])) { throw new WeixinException($rst['errmsg'], $rst['errcode']); } else { return $rst; } }