From 86d675f426f1c3a3c8d3921fd847b1878308fe26 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Tue, 13 Apr 2021 09:38:53 +0800 Subject: [PATCH] 添加is_overdue字段,判断是不是要验证小程序过期 --- app.js | 54 ++++++++++++++++++++++++++++++++++-------------------- pages/index/index/index.js | 7 +++++-- pages/user/index/index.js | 8 +++++--- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/app.js b/app.js index 7ad62bb..04b502c 100644 --- a/app.js +++ b/app.js @@ -110,26 +110,40 @@ App({ var th=this; var pages = getCurrentPages(); //获取加载的页面 var currentPage = pages[pages.length - 1]; //获取当前页面的对象 - if(!currentPage || currentPage.route.indexOf('error/error')==-1){ - var tt=this.globalData.wxapp_buy_obj; - if (!tt){ - this.get_isbuy(function (){ - tt=th.globalData.wxapp_buy_obj; - if (tt.isout == 1){ - th.promiseGet('/api/weshop/store/get/'+t.stoid,{}).then(res=>{ - wx.reLaunch({ - url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+res.data.data.store_tel, - }); - }) - } - else if (tt.isbuy == 0) - wx.reLaunch({ - url: "/pages/error/error?msg=还未购买小程序", - }); - }) - } - } - + var turl="/api/weshop/storeconfig/get/" + th.globalData.setting.stoid; + + th.promiseGet(turl,{}).then(res=>{ + var o=res; + if(o.data.code==0){ + th.globalData.config2 = o.data.data; + //有配置成要验证过期,因为过期的小程序没有办法审核 + if(th.globalData.config2.is_overdue){ + + //要开始验证,小程序有没有购买和过期 + if(!currentPage || currentPage.route.indexOf('error/error')==-1){ + var tt=this.globalData.wxapp_buy_obj; + if (!tt){ + this.get_isbuy(function (){ + tt=th.globalData.wxapp_buy_obj; + if (tt.isout == 1){ + th.promiseGet('/api/weshop/store/get/'+t.stoid,{}).then(res=>{ + wx.reLaunch({ + url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+res.data.data.store_tel, + }); + }) + } + else if (tt.isbuy == 0) + wx.reLaunch({ + url: "/pages/error/error?msg=还未购买小程序", + }); + }) + } + } + } + } + }) + + }, //---初始化第三方---- diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 978e97e..1765275 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -277,8 +277,11 @@ Page({ async init_load() { await getApp().getConfig_ays(); var th = this; - await getApp().get_isbuy(); - this.setappdata(getApp().globalData.wxapp_buy_obj); + if(getApp().globalData.config2.is_overdue==1){ + await getApp().get_isbuy(); + this.setappdata(getApp().globalData.wxapp_buy_obj); + } + //因为营销版本的功能包含了自定义模板的功能,是同时的 diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 4890523..ea6caa5 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -103,9 +103,11 @@ Page({ th = s, need_money = 0, cur_g_num = 0; - - //调用底部导航 - getApp().get_isbuy(th.setappdata); + + if(getApp().globalData.config2.is_overdue==1){ + //调用底部导航 + getApp().get_isbuy(th.setappdata); + } setTimeout(function () { if (getApp().globalData.user_id) getApp().requestCardNum(th); },500) -- libgit2 0.21.4