Преглед изворни кода

优化商家小程序订阅消息

齐博 пре 1 година
родитељ
комит
64ae39530d

+ 3 - 2
application/common/fun/Subscribe.php

@@ -7,9 +7,10 @@ class Subscribe
 {
     /**
      * 查找用户需要订阅的模板消息ID
+     * @param string $check 是否做判断订阅商家小程序与否。如果订阅过的话,就不返回订阅模板ID
      * @return void|NULL|string|mixed|unknown|array|boolean|NULL
      */
-    public static function get_template(){
+    public static function get_template($if_check=true){
         static $template = null;
         if($template!==null){
             return $template;
@@ -21,7 +22,7 @@ class Subscribe
             if(!$info['wxapp_subscribe_template_id']){
                 return ;
             }
-            if($user && Db::name('qun_weixin')->where('wxapp_appid',get_wxappAppid())->where('uid',$user['uid'])->value('if_dy')){
+            if($if_check && $user && Db::name('qun_weixin')->where('wxapp_appid',get_wxappAppid())->where('uid',$user['uid'])->value('if_dy')){
                 return ;
             }
             $template = $info['wxapp_subscribe_template_id'];

+ 1 - 0
application/common/upgrade/log342.txt

@@ -0,0 +1 @@
+优化商家小程序订阅消息

+ 1 - 0
template/index_style/default/index/labelhy/link.htm

@@ -96,6 +96,7 @@ $(document).ready(function(){
 					<div class="butters" onclick="editurl('{:urls('qun/content/contact',['id'=>input('hy_id')])}','fa fa-qrcode','联系我们')">联系我们</div>
 
 					<div class="butters" onclick="editurl('{:urls('qun/content/apply',['id'=>input('hy_id')])}','fa fa-star','关注')",>关注</div>
+					<div class="butters" onclick="editurl('{:urls('index/wxapp/subscribe')}','fa fa-fw fa-bullhorn','订阅消息')",>订阅消息</div>
 					<div class="butters" onclick="editurl('{:murl('tongji/msg/index')}','fa fa-volume-up','我的信息')",>我的信息</div>
 					<div class="butters" onclick="editurl('{:urls('qun/content/my')}','fa fa-group','我的__QUN__')",>我的__QUN__</div>
 					<div class="butters" onclick="editurl('{:urls('qun/near/index')}','fa fa-flag-checkered','附近__QUN__')",>附近__QUN__</div>

+ 1 - 1
template/index_style/default/index/wxapp/subscribe.htm

@@ -77,7 +77,7 @@ btn.addEventListener('error',function (e) {
 
 <script type="text/javascript">
 function goto_wxapp(){
-	wx.miniProgram.navigateTo({ url: "/pages/subscribe/index?template={$template?:config('webdb.wxapp_subscribe_template_id')}&uids={:mymd5($userdb['uid'].','.time())}&url={:urlencode($fromurl)}"});
+	wx.miniProgram.navigateTo({ url: "/pages/subscribe/index?template={$template?:fun('Subscribe@get_template',false)}&uids={:mymd5($userdb['uid'].','.time())}&url={:urlencode($fromurl)}"});
 }
 wx.miniProgram.getEnv(function(res) {	
 	if(res.miniprogram==true){		//在小程序中访问