Commit c46465ebcc4316755d404d073fe0d4a1fb17234b
1 parent
d096ea68
会员时间获取服务时间
Showing
2 changed files
with
47 additions
and
15 deletions
pages/user/index/index.js
| @@ -582,16 +582,31 @@ Page({ | @@ -582,16 +582,31 @@ Page({ | ||
| 582 | 582 | ||
| 583 | //------卡片的显示和关闭-------- | 583 | //------卡片的显示和关闭-------- |
| 584 | show_tc: function () { | 584 | show_tc: function () { |
| 585 | + var that=this; | ||
| 585 | if (!this.data.userInfo) return false; | 586 | if (!this.data.userInfo) return false; |
| 586 | - | ||
| 587 | - //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | ||
| 588 | - var val = this.data.userInfo.mobile + "|" + ut.formatTime()+"|"+this.data.getusercode_vailtime; | ||
| 589 | - val = "^" + ut.base64_encode(val); | ||
| 590 | - | ||
| 591 | - qrcode('qrcode', val, 480, 480, this); | ||
| 592 | - this.setData({ | ||
| 593 | - tc_hide: false, | ||
| 594 | - }); | 587 | + var getnowtime; |
| 588 | + rq.get("/api/weshop/users/getServerTime", { | ||
| 589 | + success: function (res) { | ||
| 590 | + if (res.data.code == 0) | ||
| 591 | + { | ||
| 592 | + getnowtime=res.data.data; | ||
| 593 | + if (!getnowtime) | ||
| 594 | + { | ||
| 595 | + getApp().showWarning("获取服务时间失败"); | ||
| 596 | + return; | ||
| 597 | + } | ||
| 598 | + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | ||
| 599 | + var val = that.data.userInfo.mobile + "|" +getnowtime+"|"+that.data.getusercode_vailtime; | ||
| 600 | + val = "^" + ut.base64_encode(val); | ||
| 601 | + | ||
| 602 | + qrcode('qrcode', val, 480, 480, that); | ||
| 603 | + that.setData({ | ||
| 604 | + tc_hide: false, | ||
| 605 | + }); | ||
| 606 | + } | ||
| 607 | + } | ||
| 608 | + }) | ||
| 609 | + | ||
| 595 | }, | 610 | }, |
| 596 | hide_tc: function () { | 611 | hide_tc: function () { |
| 597 | this.setData({ | 612 | this.setData({ |
pages/user/userinfo/userinfo.js
| @@ -867,16 +867,33 @@ Page({ | @@ -867,16 +867,33 @@ Page({ | ||
| 867 | 867 | ||
| 868 | //------卡片的显示和关闭-------- | 868 | //------卡片的显示和关闭-------- |
| 869 | show_tc: function() { | 869 | show_tc: function() { |
| 870 | + var that=this; | ||
| 870 | if (!getApp().globalData.userInfo) return false; | 871 | if (!getApp().globalData.userInfo) return false; |
| 871 | //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | 872 | //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') |
| 872 | - var val=getApp().globalData.userInfo.mobile+"|"+ut.formatTime()+"|"+this.data.getusercode_vailtime; | ||
| 873 | - val="^"+ut.base64_encode(val); | 873 | + var getnowtime; |
| 874 | + req.get("/api/weshop/users/getServerTime", { | ||
| 875 | + success: function (res) { | ||
| 876 | + if (res.data.code == 0) | ||
| 877 | + { | ||
| 878 | + getnowtime=res.data.data; | ||
| 879 | + if (!getnowtime) | ||
| 880 | + { | ||
| 881 | + getApp().showWarning("获取服务时间失败"); | ||
| 882 | + return; | ||
| 883 | + } | ||
| 884 | + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | ||
| 885 | + var val = that.data.userInfo.mobile + "|" +getnowtime+"|"+that.data.getusercode_vailtime; | ||
| 886 | + val = "^" + ut.base64_encode(val); | ||
| 887 | + | ||
| 888 | + qrcode('qrcode', val, 480, 480, that); | ||
| 889 | + that.setData({ | ||
| 890 | + tc_hide: false, | ||
| 891 | + }); | ||
| 892 | + } | ||
| 893 | + } | ||
| 894 | + }) | ||
| 874 | 895 | ||
| 875 | - qrcode('qrcode', val, 480, 480, this); | ||
| 876 | 896 | ||
| 877 | - this.setData({ | ||
| 878 | - tc_hide: false, | ||
| 879 | - }); | ||
| 880 | }, | 897 | }, |
| 881 | hide_tc: function() { | 898 | hide_tc: function() { |
| 882 | this.setData({ | 899 | this.setData({ |