HTML5技术

总结的一些微信API接口 - 菜鸟的飞翔梦(11)

字号+ 作者:H5之家 来源:H5之家 2017-01-08 08:01 我要评论( )

cardExt: '{"timestamp":"?php echo $kqInfo['cardExt']['timestamp'];?", "signature":"?php echo $kqInfo['cardExt']['signature'];?"}' } ], success: function (res) { var cardList = res.cardList; // 添加的

           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);

 

以上所述就是本文的全部内容,希望大家能够喜欢。

在此感谢大家的一路相陪,希望大家在新的一年里身体健康,万事如意,心想事成,财源滚滚~~~

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • 干货来袭-整套完整安全的API接口解决方案 - hubro

    干货来袭-整套完整安全的API接口解决方案 - hubro

    2017-01-05 17:00

  • 《年终总结》工作三年多,来来回回,跌跌撞撞,总结批评一下自己这三年半。 - 受戒人

    《年终总结》工作三年多,来来回回,跌跌撞撞,总结批评一下自己这三

    2017-01-05 11:00

  • 【年终总结】我的2016,阅读本文大约需要一整年 - 南尘

    【年终总结】我的2016,阅读本文大约需要一整年 - 南尘

    2017-01-04 08:03

  • 年终的第一篇总结 结束南漂 写在2017 - 欢醉

    年终的第一篇总结 结束南漂 写在2017 - 欢醉

    2017-01-03 14:00

网友点评
-