/** * 取消收藏 * * @access public * @return void * @example * <pre> * /index.php?m=native&c=My&a=delCollect <br> * post|get : tid * </pre> */ public function delCollectAction() { $tid = intval($this->getInput('tid')); if ($this->_getCollectService()->delCollect($this->uid, $tid) !== false) { $thread = Wekit::load('forum.PwThread')->getThread($tid); PwLaiWangSerivce::sendNotification($thread['created_userid'], array('type' => 1, 'message' => '《' . $thread['subject'] . '》已被 ' . $this->userInfo['username'] . ' 取消收藏。--系统消息,回复无效。')); // $this->showMessage('success'); } $this->showError('fail'); }
/** * send messages */ protected function _sendMessage($action, $threads) { $userBo = new PwUserBo($this->uid); switch ($action) { case 'doban': foreach ($threads as $v) { PwLaiWangSerivce::sendNotification($v['created_userid'], array('type' => 5, 'message' => '您被管理员 ' . $userBo->username . ' 禁止发帖了,同时您的头像、签名将不可见,如要申诉,请联系管理员。--系统消息,回复无效。')); } return; break; case 'dodelete_reply': foreach ($threads as $v) { PwLaiWangSerivce::sendNotification($v['created_userid'], array('type' => 4, 'message' => "您有一个回帖被删除:\n" . mb_substr($v['content'], 0, 30))); } return; break; } if (!is_array($threads) || !$threads || !$action || $action == 'doban') { return false; } $noticeService = Wekit::load('message.srv.PwNoticeService'); $reason = $this->getInput('reason'); foreach ($threads as $thread) { $params = array(); $params['manageUsername'] = $this->manage->user->username; $params['manageUserid'] = $this->manage->user->uid; $params['manageThreadTitle'] = $thread['subject']; $params['manageThreadId'] = $thread['tid']; //$this->params['_other']['reason'] && $params['manageReason'] = $this->params['_other']['reason']; $reason && ($params['manageReason'] = $reason); if ($action == 'docombined') { $actions = $this->getInput('actions'); $tmp = array(); foreach ($actions as $v) { $tmp[] = $this->_getManageActionName('do' . $v); } $tmp && ($params['manageTypeString'] = implode(',', $tmp)); } else { $params['manageTypeString'] = $this->_getManageActionName($action); } // laiwang PwLaiWangSerivce::sendNotification($thread['created_userid'], array('type' => 4, 'message' => '您的帖子《' . $params['manageThreadTitle'] . '》被管理员 ' . $userBo->username . ' 执行了删除操作。--系统消息,回复无效')); // $noticeService->sendNotice($thread['created_userid'], 'threadmanage', $thread['tid'], $params); } }
/** * 回复帖子;回复回帖;回复回复 * @access public * @return string * @example <pre> 直接回复时参数状态:/index.php?m=native&c=post&a=doreply&_getHtml=1 点击喜欢后顺便回复时参数状态:/index.php?m=native&c=post&a=doreply&fid=分类id ( _getHtml: 1表示回复帖子;2表示回复回帖 | ) post(回复帖子): tid&atc_content&created_address&area_code post(回复回帖、回复回复->相当于在本楼层回帖): tid&pid&atc_content&created_address&area_code post(在点喜欢的时候顺便回复内容):tid&pid&atc_content&created_address&area_code&from_type=like cookie:usersession response: {err:"",data:""} </pre> */ public function doreplyAction() { $tid = $this->getInput('tid'); list($title, $content, $hide, $rpid, $created_address, $area_code) = $this->getInput(array('atc_title', 'atc_content', 'hide', 'pid', 'created_address', 'area_code'), 'post'); $_getHtml = $this->getInput('_getHtml', 'get'); $this->runHook('c_post_run', $this->post); $this->runHook('c_post_doreply', $this->post); $info = $this->post->getInfo(); $title == 'Re:' . $info['subject'] && ($title = ''); if ($rpid) { //回复一个回帖 $post = Wekit::load('thread.PwThread')->getPost($rpid); if ($post && $post['tid'] == $tid && $post['ischeck']) { $post['content'] = $post['ifshield'] ? '此帖已被屏蔽' : trim(Pw::stripWindCode(preg_replace('/\\[quote(=.+?\\,\\d+)?\\].*?\\[\\/quote\\]/is', '', $post['content']))); $post['content'] && ($content = '[quote=' . $post['created_username'] . ',' . $rpid . ']' . Pw::substrs($post['content'], 120) . '[/quote] ' . $content); } else { //回复主贴 $rpid = 0; } } $postDm = $this->post->getDm(); $postDm->setTitle($title)->setContent($content)->setHide($hide)->setReplyPid($rpid); if (($result = $this->post->execute($postDm)) !== true) { $data = $result->getData(); $data && $this->addMessage($data, 'data'); $this->showError($result->getError()); } $pid = $this->post->getNewId(); //记录回帖位置信息 $data = array('pid' => $pid, 'created_address' => $created_address, 'area_code' => $area_code); $res = Wekit::loadDao('native.dao.PwPostsPlaceDao')->insertValue($data); // 发送通知 // 关于type请查看sendNotification的注释 // 如果自己回复了自己的帖子,则不发送通知 if ($info['created_userid'] != $this->uid) { PwLaiWangSerivce::sendNotification($info['created_userid'], array('type' => $rpid > 0 ? 3 : 2, 'message' => $rpid > 0 ? $this->loginUser->info['username'] . " 评论了您的回帖:\n" . $content : $this->loginUser->info['username'] . ' 评论了您的帖子《' . $info['subject'] . "》:\n" . $content, 'url' => $rpid > 0 ? 'read' : 'read', 'arg' => $rpid > 0 ? array((string) $tid) : array((string) $tid))); } // $this->showMessage('success'); }