...
|
...
|
@@ -463,6 +463,8 @@ class LoginController extends HomeBaseController |
|
|
|
|
|
//微博分享
|
|
|
public function wb_share(){
|
|
|
$login = cmf_is_user_login();
|
|
|
if($login) {
|
|
|
$token = session('token');
|
|
|
$title = $this->request->post('title');//分享标题
|
|
|
$share_url = $this->request->post('share_url');//分享url
|
...
|
...
|
@@ -470,16 +472,19 @@ class LoginController extends HomeBaseController |
|
|
$url = 'https://api.weibo.com/2/statuses/share.json';
|
|
|
$data = [
|
|
|
'access_token' => $token,
|
|
|
'status' => $title." ".$share_url
|
|
|
'status' => $title . " " . $share_url
|
|
|
];
|
|
|
$res = $this->http_post($url,$data);
|
|
|
$json_arr = json_decode($res,true);
|
|
|
if(isset($json_arr['error_code'])&&!empty($json_arr['error_code'])){
|
|
|
$this->apiResponse(0,$json_arr['error']);
|
|
|
$res = $this->http_post($url, $data);
|
|
|
$json_arr = json_decode($res, true);
|
|
|
if (isset($json_arr['error_code']) && !empty($json_arr['error_code'])) {
|
|
|
$this->apiResponse(0, $json_arr['error']);
|
|
|
}
|
|
|
$postModel = new PortalPostModel();
|
|
|
$postModel->where('id',$article_id)->setInc('post_share_wb',1);
|
|
|
$this->apiResponse(1,'分享成功!');
|
|
|
$postModel->where('id', $article_id)->setInc('post_share_wb', 1);
|
|
|
$this->apiResponse(1, '分享成功!');
|
|
|
}else{
|
|
|
$this->apiResponse(0, '请使用微博登录后操作!');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//取消授权
|
...
|
...
|
|