官方文档:https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/url-link/urllink.generate.html#method-http
getLink(){
let that = this
wx.request({
url: app.globalData.siteurlh5 +’/api/accesstoken.php’,
method: ‘GET’,
success: function (res) {
console.log(res.data.access_token, ‘000’)
wx.request({
url: ‘https://api.weixin.qq.com/wxa/generate_urllink?access_token=’+res.data.access_token, //仅为示例,并非真实的接口地址
header: {
‘content-type’: ‘application/json’ // 默认值
},
data:{
“path”: “/pages/lineVideo/lineVideo”,
“query”:‘roomId=38’
},
method:‘POST’,
success(res) {
console.log(res)
},
fail(res) {
wx.showToast({
title: ‘服务器繁忙,请稍后再试’,
icon: ‘none’,
duration: 4000
})
}
})
}
})
},
目的就是,大促前,给客户发送短信,让客户直接从短信点击链接进入到我们小程序。