コード例 #1
0
ファイル: LZLController.class.php プロジェクト: yaomoo/bbs
 public function doSendLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, $content, $p = 1)
 {
     //确认用户已经登录
     $this->requireLogin();
     //写入数据库
     $model = D('ForumLzlReply');
     $before = getMyScore();
     $tox_money_before = getMyToxMoney();
     $result = $model->addLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, op_t($content), $p);
     $after = getMyScore();
     $tox_money_after = getMyToxMoney();
     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) . getToxMoneyTip($tox_money_before, $tox_money_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秒之后再回复');
     }
 }