public function shareFeed()
{
// 获取传入的值
$post = $_POST;
// 安全过滤
foreach ($post as $key => $val) {
$post[$key] = t($post[$key]);
}
// 过滤内容值
// $post['body'] = filter_keyword($post['body']);
$filterBodyStatus = filter_words($post['body']);
if (!$filterBodyStatus['status']) {
$return = array('status' => 0, 'data' => $filterBodyStatus['data']);
exit(json_encode($return));
}
$post['body'] = $filterBodyStatus['data'];
// 判断资源是否删除
if (empty($post['curid'])) {
$map['feed_id'] = intval($post['sid']);
} else {
$map['feed_id'] = intval($post['curid']);
}
$map['is_del'] = 0;
$isExist = model('Feed')->where($map)->count();
if ($isExist == 0) {
$return['status'] = 0;
$return['data'] = '内容已被删除,转发失败';
exit(json_encode($return));
}
// 进行分享操作
$return = model('Share')->shareFeed($post, 'share');
if ($return['status'] == 1) {
$app_name = $post['app_name'];
// 添加积分
if ($app_name == 'public') {
model('Credit')->setUserCredit($this->uid, 'forward_weibo');
// 分享被转发
$suid = model('Feed')->where($map)->getField('uid');
model('Credit')->setUserCredit($suid, 'forwarded_weibo');
}
if ($app_name == 'weiba') {
model('Credit')->setUserCredit($this->uid, 'forward_topic');
// 分享被转发
$suid = D('Feed')->where('feed_id=' . $map['feed_id'])->getField('uid');
model('Credit')->setUserCredit($suid, 'forwarded_topic');
}
$this->assign($return['data']);
// 分享配置
$weiboSet = model('Xdata')->get('admin_Config:feed');
$this->assign('weibo_premission', $weiboSet['weibo_premission']);
$return['feed_id'] = $return['data']['feed_id'];
$return['data'] = $this->fetch('PostFeed');
}
if ($post['comment'] == '1') {
}
exit(json_encode($return));
}