public function doSendShare()
 {
     $aContent = I('post.content', '', 'text');
     $aQuery = I('post.query', '', 'text');
     parse_str($aQuery, $feed_data);
     if (empty($aContent)) {
         $this->error(L('_ERROR_CONTENT_CANNOT_EMPTY_'));
     }
     if (!is_login()) {
         $this->error(L('_ERROR_SHARE_PLEASE_FIRST_LOGIN_'));
     }
     $new_id = send_weibo($aContent, 'share', $feed_data, $feed_data['from']);
     $user = query_user(array('nickname'), is_login());
     $info = M('Weibo/Share')->getInfo($feed_data);
     $toUid = $info['uid'];
     M('Common/Message')->sendMessage($toUid, L('_PROMPT_SHARE_'), $user['nickname'] . L('_SHARE_CONTENT_SHARED_') . L('_EXCLAMATION_'), 'Weibo/Index/weiboDetail', array('id' => $new_id), is_login(), 1);
     $result['url'] = '';
     //返回成功结果
     $result['status'] = 1;
     $result['info'] = L('_SUCCESS_SHARE_') . L('_EXCLAMATION_') . cookie('score_tip');
     $this->ajaxReturn($result);
 }
Пример #2
0
 public function doSendShare()
 {
     $aContent = I('post.content', '', 'text');
     $aQuery = I('post.query', '', 'text');
     parse_str($aQuery, $feed_data);
     if (empty($aContent)) {
         $this->error('内容不能为空');
     }
     if (!is_login()) {
         $this->error('请登陆后再分享');
     }
     $new_id = send_weibo($aContent, 'share', $feed_data, $feed_data['from']);
     $user = query_user(array('nickname'), is_login());
     $info = D('Weibo/Share')->getInfo($feed_data);
     $toUid = $info['uid'];
     D('Common/Message')->sendMessage($toUid, '分享提醒', $user['nickname'] . '分享了您的内容!', 'Weibo/Index/weiboDetail', array('id' => $new_id), is_login(), 1);
     $result['url'] = '';
     //返回成功结果
     $result['status'] = 1;
     $result['info'] = '分享成功!' . cookie('score_tip');
     $this->ajaxReturn($result);
 }
Пример #3
0
 /**
  * doSendRepost   执行转发
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function doSendRepost()
 {
     $this->checkIsLogin();
     $aContent = I('post.content', '', 'op_t');
     $aType = I('post.type', '', 'op_t');
     $aSourceId = I('post.sourceId', 0, 'intval');
     $aWeiboId = I('post.weiboId', 0, 'intval');
     $aBeComment = I('post.becomment', 'false', 'op_t');
     $this->checkAuth(null, -1, L('_INFO_AUTHORITY_TRANSMIT_LACK_'));
     $return = check_action_limit('add_weibo', 'weibo', 0, is_login(), true);
     if ($return && !$return['state']) {
         $this->error($return['info']);
     }
     if (empty($aContent)) {
         $this->error(L('_ERROR_CONTENT_CANNOT_EMPTY_'));
     }
     $weiboModel = D('Weibo');
     $feed_data = '';
     $source = $weiboModel->getWeiboDetail($aSourceId);
     $sourceweibo = $source['weibo'];
     $feed_data['source'] = $sourceweibo;
     $feed_data['sourceId'] = $aSourceId;
     //发布微博
     $new_id = send_weibo($aContent, $aType, $feed_data);
     if ($new_id) {
         D('weibo')->where('id=' . $aSourceId)->setInc('repost_count');
         $aWeiboId != $aSourceId && D('weibo')->where('id=' . $aWeiboId)->setInc('repost_count');
         S('weibo_' . $aWeiboId, null);
         S('weibo_' . $aSourceId, null);
     }
     // 发送消息
     $user = query_user(array('nickname'), is_login());
     $toUid = D('weibo')->where(array('id' => $aWeiboId))->getField('uid');
     D('Common/Message')->sendMessage($toUid, L('_PROMPT_TRANSMIT_'), $user['nickname'] . L('_TIP_TRANSMITTED_') . L('_EXCLAMATION_'), 'Weibo/Index/weiboDetail', array('id' => $new_id), is_login(), 1);
     // 发布评论
     //  dump($aBeComment);exit;
     if ($aBeComment == 'true') {
         send_comment($aWeiboId, $aContent);
     }
     $result['html'] = R('WeiboDetail/weibo_html', array('weibo_id' => $new_id), 'Widget');
     //返回成功结果
     $result['status'] = 1;
     $result['info'] = '转发成功!' . cookie('score_tip');
     $this->ajaxReturn($result);
 }
Пример #4
0
 /**
  * 转发功能实现
  */
 public function doForward()
 {
     if (!is_login()) {
         $this->error('请您先登录', U('Mob/index/index'), 1);
     }
     $aContent = I('post.content', '', 'op_t');
     //说点什么的内容
     $aType = I('post.type', '', 'op_t');
     //类型
     $aSoueseId = I('post.sourseId', 0, 'intval');
     //获取该微博源ID
     $aWeiboId = I('post.weiboId', 0, 'intval');
     //要转发的微博的ID
     $aBeComment = I('post.release', 'false', 'op_t');
     //是否作为评论发布
     if (empty($aContent)) {
         $this->error('转发内容不能为空');
     }
     $this->checkAuth('Weibo/Index/doSendRepost', -1, '您无微博转发权限。');
     $return = check_action_limit('add_weibo', 'weibo', 0, is_login(), true);
     if ($return && !$return['state']) {
         $this->error($return['info']);
     }
     $weiboModel = D('Weibo');
     $feed_data = '';
     $sourse = $weiboModel->getWeiboDetail($aSoueseId);
     $sourseweibo = $sourse['weibo'];
     $feed_data['sourse'] = $sourseweibo;
     $feed_data['sourseId'] = $aSoueseId;
     $new_id = send_weibo($aContent, $aType, $feed_data);
     //发布微博
     if ($new_id) {
         D('weibo')->where('id=' . $aSoueseId)->setInc('repost_count');
         $aWeiboId != $aSoueseId && D('weibo')->where('id=' . $aWeiboId)->setInc('repost_count');
         S('weibo_' . $aWeiboId, null);
         S('weibo_' . $aSoueseId, null);
     }
     // 发送消息
     $user = query_user(array('nickname'), is_login());
     $toUid = D('weibo')->where(array('id' => $aWeiboId))->getField('uid');
     D('Common/Message')->sendMessage($toUid, $user['nickname'] . '转发了您的微博!', '转发提醒', U('Weibo/Index/weiboDetail', array('id' => $new_id)), is_login(), 1);
     // 发布评论
     if ($aBeComment == 'on') {
         send_comment($aWeiboId, $aContent);
     }
     //转发后的微博内容获取
     $weibo = D('Weibo')->where(array('status' => 1, 'id' => $new_id))->order('create_time 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'), $v['uid']);
         $v['support'] = D('Support')->where(array('appname' => 'Weibo', 'table' => 'weibo', 'row' => $v['id']))->count();
         $v['content'] = parse_weibo_mobile_content($v['content']);
         $v['data'] = unserialize($v['data']);
         //字符串转换成数组,获取微博源ID
         if ($v['data']['sourseId']) {
             //判断是否是源微博
             $v['sourseId'] = $v['data']['sourseId'];
             $v['is_sourseId'] = '1';
         } else {
             $v['sourseId'] = $v['id'];
             $v['is_sourseId'] = '0';
         }
         $v['sourseId_user'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourseId']))->find();
         //源微博用户名
         $v['sourseId_user'] = $v['sourseId_user']['uid'];
         $v['sourseId_user'] = query_user(array('nickname'), $v['sourseId_user']);
         $v['sourseId_content'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourseId']))->field('content')->find();
         //源微博内容
         $v['sourseId_content'] = parse_weibo_mobile_content($v['sourseId_content']['content']);
         //把表情显示出来。
         $v['sourseId_repost_count'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourseId']))->field('repost_count')->find();
         //源微博转发数
         $v['sourseId_img'] = D('Weibo')->where(array('status' => 1, 'id' => $v['sourseId']))->field('data')->find();
         //为了获取源微图片
         $v['sourseId_img'] = unserialize($v['sourseId_img']['data']);
         $v['sourseId_img'] = explode(',', $v['sourseId_img']['attach_ids']);
         //把attach_ids里的图片ID转出来
         foreach ($v['sourseId_img'] as &$b) {
             $v['sourseId_img_path'][] = getThumbImageById($b);
             //获得缩略图
             //获得原图
             $bi = M('Picture')->where(array('status' => 1))->getById($b);
             if (!is_bool(strpos($bi['path'], 'http://'))) {
                 $v['sourseId_img_big'][] = $bi['path'];
             } else {
                 $v['sourseId_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);
             //获得原图
             $bi = M('Picture')->where(array('status' => 1))->getById($b);
             if (!is_bool(strpos($bi['path'], 'http://'))) {
                 $v['sourseId_img_big'][] = $bi['path'];
             } else {
                 $v['sourseId_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['sourseId_img']['0'])) {
             $v['sourseId_is_img'] = '0';
         } else {
             $v['sourseId_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;
         $data['info'] = '转发失败!';
     }
     $this->ajaxReturn($data);
 }