Commit 86d675f426f1c3a3c8d3921fd847b1878308fe26

Authored by yvan.ni
1 parent 04c1fbc1

添加is_overdue字段,判断是不是要验证小程序过期

@@ -110,26 +110,40 @@ App({ @@ -110,26 +110,40 @@ App({
110 var th=this; 110 var th=this;
111 var pages = getCurrentPages(); //获取加载的页面 111 var pages = getCurrentPages(); //获取加载的页面
112 var currentPage = pages[pages.length - 1]; //获取当前页面的对象 112 var currentPage = pages[pages.length - 1]; //获取当前页面的对象
113 - if(!currentPage || currentPage.route.indexOf('error/error')==-1){  
114 - var tt=this.globalData.wxapp_buy_obj;  
115 - if (!tt){  
116 - this.get_isbuy(function (){  
117 - tt=th.globalData.wxapp_buy_obj;  
118 - if (tt.isout == 1){  
119 - th.promiseGet('/api/weshop/store/get/'+t.stoid,{}).then(res=>{  
120 - wx.reLaunch({  
121 - url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+res.data.data.store_tel,  
122 - });  
123 - })  
124 - }  
125 - else if (tt.isbuy == 0)  
126 - wx.reLaunch({  
127 - url: "/pages/error/error?msg=还未购买小程序",  
128 - });  
129 - })  
130 - }  
131 - }  
132 - 113 + var turl="/api/weshop/storeconfig/get/" + th.globalData.setting.stoid;
  114 +
  115 + th.promiseGet(turl,{}).then(res=>{
  116 + var o=res;
  117 + if(o.data.code==0){
  118 + th.globalData.config2 = o.data.data;
  119 + //有配置成要验证过期,因为过期的小程序没有办法审核
  120 + if(th.globalData.config2.is_overdue){
  121 +
  122 + //要开始验证,小程序有没有购买和过期
  123 + if(!currentPage || currentPage.route.indexOf('error/error')==-1){
  124 + var tt=this.globalData.wxapp_buy_obj;
  125 + if (!tt){
  126 + this.get_isbuy(function (){
  127 + tt=th.globalData.wxapp_buy_obj;
  128 + if (tt.isout == 1){
  129 + th.promiseGet('/api/weshop/store/get/'+t.stoid,{}).then(res=>{
  130 + wx.reLaunch({
  131 + url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+res.data.data.store_tel,
  132 + });
  133 + })
  134 + }
  135 + else if (tt.isbuy == 0)
  136 + wx.reLaunch({
  137 + url: "/pages/error/error?msg=还未购买小程序",
  138 + });
  139 + })
  140 + }
  141 + }
  142 + }
  143 + }
  144 + })
  145 +
  146 +
133 }, 147 },
134 148
135 //---初始化第三方---- 149 //---初始化第三方----
pages/index/index/index.js
@@ -277,8 +277,11 @@ Page({ @@ -277,8 +277,11 @@ Page({
277 async init_load() { 277 async init_load() {
278 await getApp().getConfig_ays(); 278 await getApp().getConfig_ays();
279 var th = this; 279 var th = this;
280 - await getApp().get_isbuy();  
281 - this.setappdata(getApp().globalData.wxapp_buy_obj); 280 + if(getApp().globalData.config2.is_overdue==1){
  281 + await getApp().get_isbuy();
  282 + this.setappdata(getApp().globalData.wxapp_buy_obj);
  283 + }
  284 +
282 285
283 286
284 //因为营销版本的功能包含了自定义模板的功能,是同时的 287 //因为营销版本的功能包含了自定义模板的功能,是同时的
pages/user/index/index.js
@@ -103,9 +103,11 @@ Page({ @@ -103,9 +103,11 @@ Page({
103 th = s, 103 th = s,
104 need_money = 0, 104 need_money = 0,
105 cur_g_num = 0; 105 cur_g_num = 0;
106 -  
107 - //调用底部导航  
108 - getApp().get_isbuy(th.setappdata); 106 +
  107 + if(getApp().globalData.config2.is_overdue==1){
  108 + //调用底部导航
  109 + getApp().get_isbuy(th.setappdata);
  110 + }
109 setTimeout(function () { 111 setTimeout(function () {
110 if (getApp().globalData.user_id) getApp().requestCardNum(th); 112 if (getApp().globalData.user_id) getApp().requestCardNum(th);
111 },500) 113 },500)