Ejemplo n.º 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();
     $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)));
 }
Ejemplo n.º 2
0
 public function myconcerned($uid = 0, $page = 1, $lastId = 0)
 {
     if ($page == 1) {
         $result = $this->weiboApi->listMyFollowingWeibo($page, null, '', 1, $lastId);
         $this->assign('lastId', $result['lastId']);
         $this->assign('list', $result['list']);
     }
     //载入我关注的微博
     $total_count = $this->weiboApi->listMyFollowingWeiboCount($page, 0, '', 1, $lastId);
     $this->assign('total_count', $total_count['total_count']);
     $this->assign('page', $page);
     //显示页面
     $this->assign('tab', 'concerned');
     $this->assign('loadMoreUrl', U('loadConcernedWeibo'));
     $this->assignSelf();
     $this->setTitle('我关注的——微博');
     $this->assign('filter_tab', '我关注的');
     $this->assign('tox_money_name', getToxMoneyName());
     $this->assign('tox_money', getMyToxMoney());
     $this->display('index');
 }
Ejemplo n.º 3
0
 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));
 }
 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秒之后再回复');
     }
 }