• ThinkSNS1.6 群组邀请好友 通知页面,出现同意,忽略功能


    \group\Lib\Action\InviteAction.class.php 

    Function create 方法下

    $body_data['mid'] = $this->mid;  下添加

    $body_data['gid'] = $this->groupinfo['id'];//修改群组邀请链接错误的gid

     

    $url = $this->groupinfo['id'];//在同意,忽略 做为参数使用

     

     

    \thinksns\Tpl\ipiao2\Notify\index.html

    添加两个JS 函数做为 触发同意 忽略

     

    function agreeGroup(gid,nid){

            Confirm({message:'确认添加到这个圈子吗?',handler:function(tp){

                    if(tp=='ok'){

                        $.post(ROOT+"/apps/Group/index.php?s=/group/agreegroup/nid/"+nid+"/gid/"+gid ,function(txt){

    alert(txt);

                            if(txt == 1){

                                Alert("确认成功!");

                                setTimeout(function(){ parent.ymPrompt.close(); },1500);

                                location.reload();

                            }else{

                                Alert("确认失败!");

                            }

                        });

                    }

                    if(tp=='cancel'){

                        ymPrompt.close();

                    }

                    if(tp=='close'){

                        ymPrompt.close();

                    }

                }});

        }

     

        function ignoreGroup(gid,nid){

            Confirm({message:'忽略添加到这个圈子吗?',handler:function(tp){

                    if(tp=='ok'){

                        $.post(ROOT+"/apps/Group/index.php?s=/group/ignoregroup/nid/"+nid+"/gid/"+gid ,function(txt){

                            if(txt == 1){

                                Alert("忽略成功!");

                                setTimeout(function(){ parent.ymPrompt.close(); },1500);

                                location.reload();

                            }else{

                                Alert("忽略失败!");

                            }

                        });

                    }

                    if(tp=='cancel'){

                        ymPrompt.close();

                    }

                    if(tp=='close'){

                        ymPrompt.close();

                    }

                }});

            

        }

     

     

    <lt name="notify.new" value="2"> 下面添加 做为群组邀请使用

    <if condition="$notify['type'] eq 'group_create'">

    <a href="javascript: agreeGroup({$notify.url},{$notify.id});">同意</a> | <a href="javascript: ignoreGroup({$notify.url},{$notify.id});">忽略</a>

    </if>

     

     

     

    \apps\group\Lib\Action\GroupAction.class.php

    添加同意, 忽略处理函数

     

        //同意加入该群

        function agreegroup () {

            $nid = $_REQUEST['nid'];

            $gid = $_REQUEST['gid'];

            $level = 3;

            $incMemberCount = false;

     

            $result = D('Group')->joingroup($this->mid, $gid, $level, $incMemberCount, '受邀请');   //加入

            if ($result) {

                //添加动态

                $title_data["actor"] = getUserName($this->mid);

                $title_data['title'] = '加入了群组';

                $body_data['gid'] = $this->gid;

                $body_data['group_name'] = $this->groupinfo['name'];

                $this->api->feed_publish('group_join', $title_data, $body_data, $this->appId, 0, $this->gid);

     

                //添加成功后, 修改通知的状态, new 的值为2

                D()->table('ts_notify')->setField('new', 2, 'id='.$nid);

                echo 1;

            }

        }

     

        //忽略加入该群

        function ignoregroup () {

            //添加成功后, 修改通知的状态, new 加入 

            if (D()->table('ts_notify')->setField('new', 3, 'id='.$_REQUEST['nid'])){

                echo 1;

            }

        }

     

    在后台——高级——通知模板

    编辑group_create  在DEAL  修改数据为:你已加入该圈子 你已经忽略了圈子请求

  • 相关阅读:
    华科机考:特殊排序
    华科机考:排序
    华科机考:字符串连接
    华科机考:a+b
    华科机考:IP地址
    华科机考:统计单词
    iOS 应用评分
    jQuery Custom PopUp Window
    Csharp:字符串操作
    Css:Conditional comments 条件注释
  • 原文地址:https://www.cnblogs.com/ybbqg/p/2399636.html
Copyright © 2020-2023  润新知