














onLoad(options) { //options.scene="priceid%3D3%26pricenumber%3D4013ce57"; if(!options || !options.scene){ //options.scene是在后台生成二维码的时候添加的,一定不能为空, console.log('请通过扫码进入'); return; } let that=this; this.setData({qrscene: decodeURIComponent(options.scene ? options.scene : '')}); }, onShow:function(){ if(!this.data.qrscene){return;} }
参考:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html
调用的接口:https://api.weixin.qq.com/wxa/getwxacodeunlimit
此方法不能完全解决问题,譬如:

点重新进入小程序,仍然还会 携带 options.scene 中的数据。
建议最好时 二维码弄成动态的,生成二维码的时候scene带上 token,前端获取token传到后端进行校验,一个token对应一个手机号只允许使用一次。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。