function joingroup() { if (isset($_POST['addsubmit'])) { $level = 0; $incMemberCount = false; if ($this->groupinfo['need_verify'] == 0) { $level = 3; //判读权限,如果是不需要校验,则直接成功 $incMemberCount = ture; $title = '加入了群组'; } else { //需要审批,发送动态到管理员 //添加动态 $title = '申请加入群组'; $toUserIds = D('Member')->where('gid=' . $this->gid . ' AND (level=1 or level=2)')->findAll(); $title_data['actor'] = '请求你批准加入'; $title_data['title'] = $this->groupinfo['name']; $body_data['gid'] = $this->gid; $toUserIds = render_in($toUserIds, 'uid', 1); //通知 $cate = "notification"; $this->api->notify_setAppId($this->appId); $this->api->notify_send($toUserIds, 'group_apply', $title_data, $body_data, $url, $cate); } $result = D('Group')->joingroup($this->mid, $this->gid, $level, $incMemberCount, $_POST['reason']); //加入 if ($result) { //添加动态 $title_data["actor"] = getUserName($this->mid); $title_data['title'] = $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); } exit($result); } $this->assign('joinCount', D('Member')->where("uid={$this->mid} AND (level=2 OR level=3)")->count()); $this->assign('isjoin', D('Member')->where("gid={$this->gid} AND uid={$this->mid}")->count()); //判读是否加入过 $this->display(); }
function getnewtopic($uid) { $gidarr = D('Member')->field('gid')->where('uid=' . $uid)->findAll(); if ($gidarr) { $in = 'gid IN ' . render_in($gidarr, 'gid'); return D('Topic')->where("is_del=0 AND " . $in)->order('replytime DESC')->findPage(); } return false; }
function searchData($type, $uid, $title, $content, $field, $asc, $limit = null, $isDel = 0) { $condition = array(); if ($username) { $arr_uid = M('user')->where("name like '%{$name}%'")->field('id')->findAll(); if (!empty($arr_uid) && $type != 'album' && $type != 'photo') { $condition[] = 'uid IN ' . render_in($arr_uid, 'id'); } else { $condition[] = 'userId IN ' . render_in($arr_uid, 'id'); } } if ($type == 'group') { if ($uid) { $condition[] = "uid = {$uid} "; } if ($title) { $condition[] = "name like '%" . $title . "%'"; } $condition[] = "status=1"; $data = D('Group')->getGroupList(1, $condition, $fields = null, "{$field} {$asc}", $limit, $isDel); return $data; } elseif ($type == 'weibo') { if ($uid) { $condition[] = "uid = {$uid} "; } if ($title) { $condition[] = "name like '%{$title}%'"; } $data = D('Group')->getGroupList(1, $condition, $fields = null, "{$field} {$asc}", $limit, $isDel); return $data; } elseif ($type == 'topic') { if ($uid) { $condition[] = "uid = {$uid} "; } if ($title) { $condition[] = "title like '%" . $title . "%'"; } $data = D('Topic')->getTopicList(1, $condition, $fields = null, "{$field} {$asc}", $limit, $isDel); return $data; } elseif ($type == 'album') { if ($title) { $condition[] = "name like '%" . $title . "%'"; } if ($uid) { $condition[] = "userId={$uid}"; } $data = D('Album')->getAlbumList($html = 1, $condition, $fields = null, "{$field} {$asc}", $limit, $isDel); return $data; } elseif ($type == 'file') { if ($uid) { $condition[] = "uid = {$uid} "; } if ($title) { $condition[] = "name like '%" . $title . "%'"; } $data = D('Dir')->getFileList(1, $condition, $fields = null, "{$field} {$asc}", $limit, $isDel); return $data; } elseif ($type == 'post') { if ($uid) { $condition[] = "uid = {$uid} "; } if ($content) { $condition[] = "note %'" . $content . "'%"; } $data = D('Post')->getPostList(1, $condition, $fields = null, "{$field} {$asc}", $limit, $isDel); return $data; } elseif ($type == 'photo') { if ($uid) { $condition[] = "userId={$uid}"; } if ($title) { $condition[] = "name like '%" . $title . "%'"; } $data = D('photo')->getPhotoList($html = 1, $condition, $fields = null, "{$field} {$asc}", $limit, $isDel); return $data; } }