function post() { $tid = isset($_POST['tid']) ? intval($_POST['tid']) : 0; $content_i = replaceSpecialChar(h($_POST['content'])); if (empty($content_i)) { $this->error('请输入内容'); } if ($tid > 0 && !empty($content_i)) { $topic = gettopic($tid); //获取话题内容 import('ORG.Net.IpLocation'); $ip = new IpLocation(); if ($_POST['attach']) { $post['attach'] = serialize($_POST['attach']); } //添加附件 $post['gid'] = $this->gid; $post['uid'] = $this->mid; $post['tid'] = $tid; $post['content'] = h($_POST['content']); $post['istopic'] = 0; $post['ctime'] = time(); $post['ip'] = $ip->get_client_ip(); $title_data['actor'] = $this->mid; $body_data['gid'] = $this->gid; $body_data['tid'] = $tid; $body_data['title'] = $topic['title']; if (isset($_POST['quote'])) { //如果引用帖子 $qid = isset($_POST['qid']) ? intval($_POST['qid']) : 0; //引用帖子id $post['quote'] = $qid; $postData = getPost($qid); if ($postData['uid'] != $this->mid) { //通知 $cate = "notification"; $this->api->notify_setAppId($this->appId); $this->api->notify_send($postData['uid'], 'group_topic_quote', $title_data, $body_data, $url, $cate); setScore($this->mid, 'group_topic_reply'); } } $result = $this->post->add($post); //添加回复 if ($result) { //添加回复通知 if (!($topic['uid'] == $this->mid || $postData['tid'] == $topic['id'])) { //如果不是回复自己 //通知 $cate = "notification"; $this->api->notify_setAppId($this->appId); $this->api->notify_send($topic['uid'], 'group_reply', $title_data, $body_data, $url, $cate); setScore($this->mid, 'group_topic_reply'); } //添加动态 $this->api->feed_publish('group_topic_post', $title_data, $body_data, $this->appId, 0, $this->gid); $this->topic->setField('replytime', time(), 'id=' . $tid); $this->topic->setInc('replycount', 'id=' . $tid); } redirect(__APP__ . "/Topic/topic/gid/{$this->gid}/tid/" . $tid); } redirect(__APP__ . "/Topic/index/gid/{$this->gid}"); }