/** * doComment 发布评论 * @author:xjw129xjt(肖骏涛) xjt@ourstu.com */ public function doComment() { $this->checkIsLogin(); $aWeiboId = I('post.weibo_id', 0, 'intval'); $aContent = I('post.content', 0, 'op_t'); $aCommentId = I('post.comment_id', 0, 'intval'); $this->checkAuth(null, -1, '您无微博发布评论权限。'); $return = check_action_limit('add_weibo_comment', 'weibo_comment', 0, is_login(), true); if ($return && !$return['state']) { $this->error($return['info']); } if (empty($aContent)) { $this->error('内容不能为空'); } //发送评论 $result['data'] = send_comment($aWeiboId, $aContent, $aCommentId); $result['html'] = R('Comment/comment_html', array('comment_id' => $result['data']), 'Widget'); $result['status'] = 1; $result['info'] = '评论成功!' . cookie('score_tip'); //返回成功结果 $this->ajaxReturn($result); }
/** * doComment 发布评论 * @author:xjw129xjt(肖骏涛) xjt@ourstu.com */ public function doComment() { $this->checkIsLogin(); $aWeiboId = I('post.weibo_id', 0, 'intval'); $aContent = I('post.content', 0, 'op_t'); $aCommentId = I('post.comment_id', 0, 'intval'); $this->checkAuth(null, -1, L('_INFO_AUTHORITY_COMMENT_LACK_') . L('_PERIOD_')); $return = check_action_limit('add_weibo_comment', 'weibo_comment', 0, is_login(), true); if ($return && !$return['state']) { $this->error($return['info']); } if (empty($aContent)) { $this->error(L('_ERROR_CONTENT_CANNOT_EMPTY_')); } //发送评论 $result['data'] = send_comment($aWeiboId, $aContent, $aCommentId); $result['html'] = R('Comment/comment_html', array('comment_id' => $result['data']), 'Widget'); $result['status'] = 1; $result['info'] = L('_SUCCESS_COMMENT_') . L('_EXCLAMATION_') . cookie('score_tip'); //返回成功结果 $this->ajaxReturn($result); }
/** * 增加评论实现 */ public function doAddComment() { if (!is_login()) { $this->error('请您先登录', U('Mob/member/index'), 1); } $aContent = I('post.weibocontent', '', 'op_t'); //说点什么的内容 $aWeiboId = I('post.weiboId', 0, 'intval'); //要评论的微博的ID $aCommentId = I('post.comment_id', 0, 'intval'); if (empty($aContent)) { $this->error('评论内容不能为空。'); } $this->checkAuth('Weibo/Index/doComment', -1, '您无微博评论权限。'); $return = check_action_limit('add_weibo_comment', 'weibo_comment', 0, is_login(), true); //行为限制 if ($return && !$return['state']) { $this->error($return['info']); } $new_id = send_comment($aWeiboId, $aContent, $aCommentId); //发布评论 $weibocomment = D('WeiboComment')->where(array('status' => 1, 'id' => $new_id))->order('create_time desc')->select(); foreach ($weibocomment as &$k) { $k['user'] = query_user(array('nickname', 'avatar32', 'uid'), $k['uid']); $k['rand_title'] = mob_get_head_title($k['uid']); $k['content'] = parse_weibo_mobile_content($k['content']); } if ($weibocomment) { $data['html'] = ""; foreach ($weibocomment as $val) { $this->assign("vl", $val); $data['html'] .= $this->fetch("_weibocomment"); $data['status'] = 1; } } else { $data['stutus'] = 0; } $this->ajaxReturn($data); }