コード例 #1
0
 public function doSendLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, $content, $p = 1)
 {
     //确认用户已经登录
     $this->requireLogin();
     //写入数据库
     $model = D('ForumLzlReply');
     $before = getMyScore();
     $result = $model->addLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, op_t($content), $p);
     $after = getMyScore();
     if (!$result) {
         $this->error('发布失败:' . $model->getError());
     }
     //显示成功页面
     $totalCount = D('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $to_f_reply_id)->count();
     $limit = 5;
     $pageCount = ceil($totalCount / $limit);
     exit(json_encode(array('status' => 1, 'info' => '回复成功。' . getScoreTip($before, $after), 'url' => $pageCount)));
 }
コード例 #2
0
ファイル: WeiboApi.class.php プロジェクト: nullog/zhanglubao
 public function sendComment($weibo_id, $content, $comment_id = 0)
 {
     $this->requireSendInterval();
     $this->requireLogin();
     //写入数据库
     $result = $this->commentModel->addComment(get_uid(), $weibo_id, $content, $comment_id);
     if (!$result) {
         return $this->apiError('评论失败:' . $this->commentModel->getError());
     }
     //写入数据库成功,记录动作,更新最后发送时间
     $tox_money_before = getMyToxMoney();
     $increase_score = action_log_and_get_score('add_weibo_comment', 'WeiboComment', $result, is_login());
     $tox_money_after = getMyToxMoney();
     $this->updateLastSendTime();
     //通知微博作者
     $weibo = $this->weiboModel->field('uid')->find($weibo_id);
     $this->sendCommentMessage($weibo['uid'], $weibo_id, "评论内容:{$content}");
     //通知被回复的人。为了避免出现两次通知,进行了特殊处理
     if ($comment_id) {
         $comment = $this->commentModel->field('uid')->find($comment_id);
         if ($comment['uid'] != $weibo['uid']) {
             $this->sendCommentMessage($comment['uid'], $weibo_id, "回复内容:{$content}");
         }
     }
     //通知被AT的人,除去微博作者、被回复的人,避免通知出现两次。
     $uids = get_at_uids($content);
     $uids = array_subtract($uids, array($weibo['uid'], $comment['uid']));
     $this->sendAtMessage($uids, $weibo_id, $content);
     //显示成功页面
     return $this->apiSuccess('评论成功。' . getScoreTip(0, $increase_score) . getToxMoneyTip($tox_money_before, $tox_money_after));
 }
コード例 #3
0
 public function doReply($post_id, $content)
 {
     $post_id = intval($post_id);
     $content = $this->filterPostContent($content);
     //确认有权限回复
     $this->requireAllowReply($post_id);
     //检测回复时间限制
     $uid = is_login();
     $near = D('ForumPostReply')->where(array('uid' => $uid))->order('create_time desc')->find();
     $cha = time() - $near['create_time'];
     if ($cha > 10) {
         //添加到数据库
         $model = D('ForumPostReply');
         $before = getMyScore();
         $tox_money_before = getMyToxMoney();
         $result = $model->addReply($post_id, $content);
         $after = getMyScore();
         $tox_money_after = getMyToxMoney();
         if (!$result) {
             $this->error('回复失败:' . $model->getError());
         }
         //显示成功消息
         $this->success('回复成功。' . getScoreTip($before, $after) . getToxMoneyTip($tox_money_before, $tox_money_after), 'refresh');
     } else {
         $this->error('请10秒之后再回复');
     }
 }
コード例 #4
0
 public function doReply($post_id, $content)
 {
     $post_id = intval($post_id);
     $content = $this->filterPostContent($content);
     $content = filter_content($content);
     //确认有权限评论
     $post_id = intval($post_id);
     $post = D('ForumPost')->where(array('id' => $post_id))->find();
     if (!$post) {
         $this->error('帖子不存在');
     }
     $this->requireLogin();
     $this->checkAuth('Forum/Index/doReply', $post['uid'], '你没有评论贴子权限!');
     //确认有权限评论 end
     $this->checkActionLimit('forum_post_reply', 'Forum', null, get_uid());
     //添加到数据库
     $model = D('ForumPostReply');
     $before = getMyScore();
     $result = $model->addReply($post_id, $content);
     $after = getMyScore();
     if (!$result) {
         $this->error('评论失败:' . $model->getError());
     }
     //显示成功消息
     action_log('forum_post_reply', 'Forum', $result, get_uid());
     $this->success('回复成功。' . getScoreTip($before, $after), 'refresh');
 }
コード例 #5
0
 public function doSendLZLReply($p = 1)
 {
     $post_id = I('post.post_id', 0, 'op_t');
     $to_f_reply_id = I('post.to_f_reply_id', 0, 'op_t');
     $to_reply_id = I('post.to_reply_id', 0, 'op_t');
     $to_uid = I('post.uid', 0, 'op_t');
     $content = I('post.content', '', 'op_t');
     //确认用户已经登录
     $this->requireLogin();
     $this->checkAuth('Forum/Lzl/doSendLZLReply', $this->get_expect_ids(0, 0, $post_id, 0), '你没有回复评论的权限!');
     $this->checkActionLimit('forum_lzl_reply', 'Forum', null, get_uid());
     //写入数据库
     $model = M('ForumLzlReply');
     $before = getMyScore();
     $result = $model->addLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, op_t($content), $p);
     $after = getMyScore();
     if (!$result) {
         $this->error('发布失败:' . $model->getError());
     }
     action_log('forum_lzl_reply', 'Forum', $result, get_uid());
     //显示成功页面
     $totalCount = M('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $to_f_reply_id)->count();
     $limit = 5;
     $pageCount = ceil($totalCount / $limit);
     exit(json_encode(array('status' => 1, 'info' => '回复成功。' . getScoreTip($before, $after), 'url' => $pageCount)));
 }