cardExt: '{"timestamp":"<?php echo $kqInfo['cardExt']['timestamp'];?>", "signature":"<?php echo $kqInfo['cardExt']['signature'];?>"}'
}
],
success: function (res) {
var cardList = res.cardList; // 添加的卡券列表信息
alert(cardList);
},
cancel: function (res) {
alert('已取消');
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
};
var shareData = {
title: '微信JS-SDK Demo',
desc: '微信JS-SDK,帮助第三方为用户提供更优质的移动web服务',
link: 'http://demo.open.weixin.qq.com/jssdk/',
imgUrl: 'http://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRt8Qia4lv7k3M9J1SKqKCImxJCt7j9rHYicKDI45jRPBxdzdyREWnk0ia0N5TMnMfth7SdxtzMvVgXg/0'
};
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
});
var readyFunc = function onBridgeReady() {
// 绑定关注事件
document.querySelector('#openCard').addEventListener('click',
function(e) {
WeixinJSBridge.invoke('chooseCard', {
"app_id": "<?php echo $listInfo['app_id']?>",
"location_id ": '',
"sign_type": "SHA1",
"card_sign": "<?php echo $listInfo['card_sign']?>",
"card_id": "<?php echo $listInfo['card_id']?>",
"card_type": "<?php echo $listInfo['card_type']?>",
"time_stamp": "<?php echo $listInfo['time_stamp']?>",
"nonce_str": "<?php echo $listInfo['nonce_str']?>"
},
function(res) {
alert(res.err_msg + res.choose_card_info);
$("#showInfo").empty().append(res.err_msg + res.choose_card_info);
});
});
}
if (typeof WeixinJSBridge === "undefined") {
document.addEventListener('WeixinJSBridgeReady', readyFunc, false);
} else {
readyFunc();
}
</script>
</body>
</html>
5. [代码]创建卡券
$kqinfo = array("card" => array());
$kqinfo['card']['card_type'] = 'GENERAL_COUPON';
$kqinfo['card']['general_coupon'] = array('base_info' => array(), 'default_detail' => array());
$kqinfo['card']['general_coupon']['base_info']['logo_url'] = 'URL';
$kqinfo['card']['general_coupon']['base_info']['code_type'] = 'CODE_TYPE_QRCODE';
$kqinfo['card']['general_coupon']['base_info']['brand_name'] = '';
$kqinfo['card']['general_coupon']['base_info']['title'] = '测试卡券';
$kqinfo['card']['general_coupon']['base_info']['color'] = 'Color030';
$kqinfo['card']['general_coupon']['base_info']['notice'] = '测试测试测试';
$kqinfo['card']['general_coupon']['base_info']['description'] = '这是一张优惠券';
$kqinfo['card']['general_coupon']['base_info']['date_info']['type'] = 1;
$kqinfo['card']['general_coupon']['base_info']['date_info']['begin_timestamp'] = time();
$kqinfo['card']['general_coupon']['base_info']['date_info']['end_timestamp'] = time() + 100 * 24 * 3600;
$kqinfo['card']['general_coupon']['base_info']['sku']['quantity'] = 100000;
$kqinfo['card']['general_coupon']['default_detail'] = '测试数据\n测试数据\n测试数据';
//var_dump($kqinfo);
//$kqinfo = json_encode($kqinfo);
$kqinfo = C::enJson($kqinfo);
//print_r( $kqinfo);
//$resultData = $wx->wxCardCreated($kqinfo);
以上所述就是本文的全部内容,希望大家能够喜欢。
在此感谢大家的一路相陪,希望大家在新的一年里身体健康,万事如意,心想事成,财源滚滚~~~