diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 02baf12..5ab3214 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -582,16 +582,31 @@ Page({ //------卡片的显示和关闭-------- show_tc: function () { + var that=this; if (!this.data.userInfo) return false; - - //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') - var val = this.data.userInfo.mobile + "|" + ut.formatTime()+"|"+this.data.getusercode_vailtime; - val = "^" + ut.base64_encode(val); - - qrcode('qrcode', val, 480, 480, this); - this.setData({ - tc_hide: false, - }); + var getnowtime; + rq.get("/api/weshop/users/getServerTime", { + success: function (res) { + if (res.data.code == 0) + { + getnowtime=res.data.data; + if (!getnowtime) + { + getApp().showWarning("获取服务时间失败"); + return; + } + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') + var val = that.data.userInfo.mobile + "|" +getnowtime+"|"+that.data.getusercode_vailtime; + val = "^" + ut.base64_encode(val); + + qrcode('qrcode', val, 480, 480, that); + that.setData({ + tc_hide: false, + }); + } + } + }) + }, hide_tc: function () { this.setData({ diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index 84224ca..622840e 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -867,16 +867,33 @@ Page({ //------卡片的显示和关闭-------- show_tc: function() { + var that=this; if (!getApp().globalData.userInfo) return false; //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') - var val=getApp().globalData.userInfo.mobile+"|"+ut.formatTime()+"|"+this.data.getusercode_vailtime; - val="^"+ut.base64_encode(val); + var getnowtime; + req.get("/api/weshop/users/getServerTime", { + success: function (res) { + if (res.data.code == 0) + { + getnowtime=res.data.data; + if (!getnowtime) + { + getApp().showWarning("获取服务时间失败"); + return; + } + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') + var val = that.data.userInfo.mobile + "|" +getnowtime+"|"+that.data.getusercode_vailtime; + val = "^" + ut.base64_encode(val); + + qrcode('qrcode', val, 480, 480, that); + that.setData({ + tc_hide: false, + }); + } + } + }) - qrcode('qrcode', val, 480, 480, this); - this.setData({ - tc_hide: false, - }); }, hide_tc: function() { this.setData({