public function getLZLReplyList($to_f_reply_id, $order, $page = 1, $limit = 3) { $list = M('GroupLzlReply')->where('status=1 and to_f_reply_id=' . $to_f_reply_id)->order($order)->select(); foreach ($list as $k => &$v) { $v['userInfo'] = query_user(array('avatar128', 'nickname', 'uid', 'space_url'), $v['uid']); $v['content'] = parse_weibo_mobile_content($v['content']); } unset($v); $list = getPage($list, $limit, $page); return $list; }
public function getLZLReplyList($to_f_reply_id, $order, $page = 1, $limit = 3) { $list = S('post_replylzllist_' . $to_f_reply_id); if ($list == null) { $list = D('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $to_f_reply_id)->order($order)->select(); foreach ($list as $k => &$v) { $v['userInfo'] = query_user(array('avatar128', 'nickname', 'uid', 'space_url'), $v['uid']); $v['content'] = parse_weibo_mobile_content($v['content']); } unset($v); S('post_replylzllist_' . $to_f_reply_id, $list, 60); } $list = getPage($list, $limit, $page); return $list; }
public function getWeiboDetail($id) { // $weibo = S('weibo_' . $id); // $check_empty = empty($weibo); // if ($check_empty) { $weibo = $this->where(array('status' => 1, 'id' => $id))->find(); if (!$weibo) { return null; } $weibo_data = unserialize($weibo['data']); $class_exists = true; $type = array('repost', 'feed', 'image', 'share'); if (!in_array($weibo['type'], $type)) { $class_exists = class_exists('Addons\\Insert' . ucfirst($weibo['type']) . '\\Insert' . ucfirst($weibo['type']) . 'Addon'); } $weibo['content'] = parse_topic(parse_weibo_mobile_content($weibo['content'])); if ($weibo['type'] === 'feed' || $weibo['type'] == '' || !$class_exists) { $fetchContent = "<p class='word-wrap'>" . $weibo['content'] . "</p>"; } elseif ($weibo['type'] === 'repost') { $fetchContent = A('Mob/WeiboType')->fetchRepost($weibo); } elseif ($weibo['type'] === 'image') { $fetchContent = A('Mob/WeiboType')->fetchImage($weibo); } elseif ($weibo['type'] === 'share') { $fetchContent = R('Weibo/Share/getFetchHtml', array('param' => unserialize($weibo['data']), 'weibo' => $weibo), 'Widget'); } else { $fetchContent = Hook::exec('Addons\\Insert' . ucfirst($weibo['type']) . '\\Insert' . ucfirst($weibo['type']) . 'Addon', 'fetch' . ucfirst($weibo['type']), $weibo); } $weibo = array('id' => intval($weibo['id']), 'content' => strval($weibo['content']), 'create_time' => intval($weibo['create_time']), 'type' => $weibo['type'], 'data' => unserialize($weibo['data']), 'weibo_data' => $weibo_data, 'comment_count' => intval($weibo['comment_count']), 'repost_count' => intval($weibo['repost_count']), 'can_delete' => 0, 'is_top' => $weibo['is_top'], 'uid' => $weibo['uid'], 'fetchContent' => $fetchContent, 'from' => $weibo['from']); // S('weibo_' . $id, $weibo, 60 * 60); // } $weibo['user'] = query_user(array('uid', 'nickname', 'avatar64', 'space_url', 'rank_link', 'title'), $weibo['uid']); $weibo['can_delete'] = $this->canDeleteWeibo($weibo); // 判断转发的原微博是否已经删除 if ($weibo['type'] == 'repost') { $source_weibo = $this->getWeiboDetail($weibo['weibo_data']['sourceId']); if (!$source_weibo['uid']) { if (!$check_empty) { S('weibo_' . $id, null); $weibo = $this->getWeiboDetail($id); } } } return $weibo; }
/** * 增加专辑评论 */ public function doAddComment() { if (!is_login()) { $this->error('请您先进行登录', U('Mob/member/index'), 1); } $aContent = I('post.content', '', 'op_t'); //获取评论内容 $aIssueId = I('post.issueId', 0, 'intval'); //获取当前专辑ID $aUid = I('post.uid', 0, 'intval'); if (empty($aContent)) { $this->error('评论内容不能为空'); } $uid = is_login(); $result = D('LocalComment')->addIssueComment($uid, $aIssueId, $aContent); $title = get_nickname(is_login()) . '评论了您'; D('Common/Message')->sendMessage($aUid, $title, "评论内容:{$aContent}", 'Issue/Index/IssueContentDetail', array('id' => $aIssueId), is_login(), 0); action_log('add_issue_comment', 'local_comment', $result, $uid); $map['id'] = array('eq', $result); $issuecomment = D('Local_comment')->where(array('status' => 1, $map))->order('create_time desc')->select(); foreach ($issuecomment as &$v) { $v['user'] = query_user(array('nickname', 'avatar32', 'uid'), $v['uid']); $v['cover_url'] = getThumbImageById($v['cover_id']); $v['content'] = parse_weibo_mobile_content($v['content']); } if ($issuecomment) { $data['html'] = ""; foreach ($issuecomment as $val) { $this->assign("vo", $val); $data['html'] .= $this->fetch("_issuecomment"); $data['status'] = 1; } } else { $data['stutus'] = 0; } $this->ajaxReturn($data); }
/** * 加载更多热门微博 */ public function addMoreHotWeibo() { $aPage = I('post.page', 1, 'op_t'); $aCount = I('post.count', 10, 'op_t'); $hot_left = modC('HOT_LEFT', 3); $time_left = get_some_day($hot_left); $time_left = get_some_day($hot_left); $param['create_time'] = array('gt', $time_left); $param['status'] = 1; $param['is_top'] = 0; $weibo = D('Weibo')->where(array('status' => 1, $param))->page($aPage, $aCount)->order('comment_count desc')->select(); $support['appname'] = 'Weibo'; //查找是否点赞 $support['table'] = 'weibo'; $support['uid'] = is_login(); $is_zan = D('Support')->where($support)->select(); $is_zan = array_column($is_zan, 'row'); foreach ($weibo as &$v) { $v['user'] = query_user(array('nickname', 'avatar64', 'uid'), $v['uid']); $v['rand_title'] = mob_get_head_title($v['uid']); $v['support'] = D('Support')->where(array('appname' => 'Weibo', 'table' => 'weibo', 'row' => $v['id']))->count(); if ($v['type'] === "repost") { $v['content'] = A('Mob/WeiboType')->fetchRepost($v); } else { if ($v['type'] === "xiami" || $v['type'] == "video") { $v['content'] = Hook::exec('Addons\\Insert' . ucfirst($v['type']) . '\\Insert' . ucfirst($v['type']) . 'Addon', 'fetch' . ucfirst($v['type']), $v); } else { $v['content'] = parse_weibo_mobile_content($v['content']); } } if (empty($v['from'])) { $v['from'] = "网站端"; } $v['data'] = unserialize($v['data']); //字符串转换成数组,获取微博源ID if ($v['data']['sourceId']) { //判断是否是源微博 $v['sourceId'] = $v['data']['sourceId']; $v['is_sourceId'] = '1'; } else { $v['sourceId'] = $v['id']; $v['is_sourceId'] = '0'; } $v['sourceId_user'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->find(); //源微博用户名 $v['sourceId_user'] = $v['sourceId_user']['uid']; $v['sourceId_user'] = query_user(array('nickname', 'uid'), $v['sourceId_user']); $v['sourceId_content'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('content')->find(); //源微博内容 if (!is_null($v['sourceId_content'])) { $v['sourceId_content'] = parse_weibo_mobile_content($v['sourceId_content']['content']); //把表情显示出来。 } $v['sourceId_repost_count'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('repost_count')->find(); //源微博转发数 $v['sourceId_from'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('from')->find(); //源微博来源 if (empty($v['sourceId_from']['from'])) { $v['sourceId_from'] = "网站端"; } else { $v['sourceId_from'] = "手机网页版"; } $v['sourceId_img'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('data')->find(); //为了获取源微图片 $v['sourceId_img'] = unserialize($v['sourceId_img']['data']); $v['sourceId_img'] = explode(',', $v['sourceId_img']['attach_ids']); //把attach_ids里的图片ID转出来 foreach ($v['sourceId_img'] as &$b) { $v['sourceId_img_path'][] = getThumbImageById($b, 100, 100); //获得缩略图 //获得原图 $bi = M('Picture')->where(array('status' => 1))->getById($b); if (!is_bool(strpos($bi['path'], 'http://'))) { $v['sourceId_img_big'][] = $bi['path']; } else { $v['sourceId_img_big'][] = getRootUrl() . substr($bi['path'], 1); } } $v['cover_url'] = explode(',', $v['data']['attach_ids']); //把attach_ids里的图片ID转出来 foreach ($v['cover_url'] as &$a) { $v['img_path'][] = getThumbImageById($a, 100, 100); //获得原图 $bi = M('Picture')->where(array('status' => 1))->getById($b); if (!is_bool(strpos($bi['path'], 'http://'))) { $v['sourceId_img_big'][] = $bi['path']; } else { $v['sourceId_img_big'][] = getRootUrl() . substr($bi['path'], 1); } } if (in_array($v['id'], $is_zan)) { //判断是否已经点赞 $v['is_support'] = '1'; } else { $v['is_support'] = '0'; } if (empty($v['data']['attach_ids'])) { //判断是否是图片 $v['is_img'] = '0'; } else { $v['is_img'] = '1'; } if (empty($v['sourceId_img']['0'])) { $v['sourceId_is_img'] = '0'; } else { $v['sourceId_is_img'] = '1'; } } if ($weibo) { $data['html'] = ""; foreach ($weibo as $val) { $this->assign("vl", $val); $data['html'] .= $this->fetch("_weibolist"); $data['status'] = 1; } } else { $data['stutus'] = 0; } $this->ajaxReturn($data); }
public function addmoreWeibo() { $aPage = I('post.page', 1, 'op_t'); $aCount = I('post.count', 10, 'op_t'); $uid = I('post.uid', '', 'op_t'); $weibo = D('Weibo')->where(array('status' => 1, 'uid' => $uid))->order('create_time desc')->page($aPage, $aCount)->select(); //我关注的人的微博 $support['appname'] = 'Weibo'; //查找是否点赞 $support['table'] = 'weibo'; $support['uid'] = is_login(); $is_zan = D('Support')->where($support)->select(); $is_zan = array_column($is_zan, 'row'); foreach ($weibo as &$v) { $v['user'] = query_user(array('nickname', 'avatar64', 'space_mob_url'), $v['uid']); $v['rand_title'] = mob_get_head_title($v['uid']); $v['support'] = D('Support')->where(array('appname' => 'Weibo', 'table' => 'weibo', 'row' => $v['id']))->count(); $v['content'] = parse_weibo_mobile_content($v['content']); if (empty($v['from'])) { $v['from'] = "网站端"; } $v['data'] = unserialize($v['data']); //字符串转换成数组,获取微博源ID if ($v['data']['sourceId']) { //判断是否是源微博 $v['sourceId'] = $v['data']['sourceId']; $v['is_sourceId'] = '1'; } else { $v['sourceId'] = $v['id']; $v['is_sourceId'] = '0'; } $v['sourceId_user'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->find(); //源微博用户名 $v['sourceId_user'] = $v['sourceId_user']['uid']; $v['sourceId_user'] = query_user(array('nickname', 'space_mob_url'), $v['sourceId_user']); $v['sourceId_content'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('content')->find(); //源微博内容 $v['sourceId_content'] = parse_weibo_mobile_content($v['sourceId_content']['content']); //把表情显示出来。 $v['sourceId_repost_count'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('repost_count')->find(); //源微博转发数 $v['sourceId_from'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('from')->find(); //源微博来源 if (empty($v['sourceId_from']['from'])) { $v['sourceId_from'] = "网站端"; } else { $v['sourceId_from'] = "手机网页版"; } $v['sourceId_img'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourceId']))->field('data')->find(); //为了获取源微图片 $v['sourceId_img'] = unserialize($v['sourceId_img']['data']); $v['sourceId_img'] = explode(',', $v['sourceId_img']['attach_ids']); //把attach_ids里的图片ID转出来 foreach ($v['sourceId_img'] as &$b) { $v['sourceId_img_path'][] = getThumbImageById($b, 100, 100); //获得缩略图 //获得原图 $bi = M('Picture')->where(array('status' => 1))->getById($b); if (!is_bool(strpos($bi['path'], 'http://'))) { $v['sourceId_img_big'][] = $bi['path']; } else { $v['sourceId_img_big'][] = getRootUrl() . substr($bi['path'], 1); } } $v['cover_url'] = explode(',', $v['data']['attach_ids']); //把attach_ids里的图片ID转出来 foreach ($v['cover_url'] as &$a) { $v['img_path'][] = getThumbImageById($a, 100, 100); //获得原图 $bi = M('Picture')->where(array('status' => 1))->getById($b); if (!is_bool(strpos($bi['path'], 'http://'))) { $v['sourceId_img_big'][] = $bi['path']; } else { $v['sourceId_img_big'][] = getRootUrl() . substr($bi['path'], 1); } } if (in_array($v['id'], $is_zan)) { //判断是否已经点赞 $v['is_support'] = '1'; } else { $v['is_support'] = '0'; } if (empty($v['data']['attach_ids'])) { //判断是否是图片 $v['is_img'] = '0'; } else { $v['is_img'] = '1'; } if (empty($v['sourceId_img']['0'])) { $v['sourceId_is_img'] = '0'; } else { $v['sourceId_is_img'] = '1'; } } if ($weibo) { $data['html'] = ""; foreach ($weibo as $val) { $this->assign("vo", $val); $data['html'] .= $this->fetch("_myweibo"); $data['status'] = 1; } } else { $data['stutus'] = 0; } $this->ajaxReturn($data); }
public function addMoreBlogComment() { $aPage = I('post.page', 0, 'op_t'); $aCount = I('post.count', 10, 'op_t'); $aId = I('post.id', '', 'op_t'); $blog_comment = M('LocalComment')->where(array('app' => 'News', 'mod' => 'index', 'status' => 1, 'row_id' => $aId))->order('create_time desc')->page($aPage, $aCount)->select(); foreach ($blog_comment as &$v) { $v['user'] = query_user(array('nickname', 'avatar32', 'uid'), $v['uid']); $v['cover_url'] = getThumbImageById($v['cover']); $v['content'] = parse_weibo_mobile_content($v['content']); } if ($blog_comment) { $data['html'] = ""; foreach ($blog_comment as $val) { $this->assign("vl", $val); $data['html'] .= $this->fetch("_blogcomment"); $data['status'] = 1; } } else { $data['stutus'] = 0; } $this->ajaxReturn($data); }
/** * 增加评论实现 */ public function doAddComment() { if (!is_login()) { $this->error('请您先登录', U('Mob/index/index'), 1); } $aContent = I('post.weibocontent', '', 'op_t'); //说点什么的内容 $aWeiboId = I('post.weiboId', 0, 'intval'); //要评论的微博的ID 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); //发布评论 $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'), $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); }