1. 程式人生 > >微信小程式例子——獲取微信群唯一標識openGId

微信小程式例子——獲取微信群唯一標識openGId

1、效果展示


2、操作步驟

1)呼叫【顯示當前頁面的轉發按鈕】API 並設定引數withShareTicket為true

 wx.showShareMenu({
     withShareTicket:true
    })

2)在頁面轉發函式onShareAppMessage 】中使用【獲取轉發詳細資訊】API獲取加密資料encryptedData和加密演算法iv

wx.getShareInfo({
          shareTicket: res.shareTickets[0],
          success: function (res) {
            console.log(res.encryptedData)
            console.log(res.iv)
          }
        })

3)呼叫登入介面獲取使用者登入的code

wx.login({
      success:function(res){
        console.log(res.code)
      }
    })

4)加密資料解密,參考 https://mp.weixin.qq.com/debug/wxadoc/dev/api/signature.html

3、在獲取微信群唯一標識openGId過程中有遇到任何問題或者不明白的地方,可以新增我的微信進行諮詢,感謝支援!微訊號:FutureJet 4、覺得不錯請打賞,您的十分滿意是筆者的無限動力。