作者 景龙
1 个管道 的构建 通过 耗费 0 秒

测试微博

... ... @@ -448,14 +448,19 @@ class LoginController extends HomeBaseController
//微博分享
public function wb_share(){
$token = session('token');
$title = $this->request->post('title');//分享标题
$share_url = $this->request->post('share_url');//分享url
$url = 'https://api.weibo.com/2/statuses/share.json';
$data = [
'access_token' => $token,
'status' => URLencode('成功 http://www.starplanet.cn/portal/enjoy/getEnjoyDetail?id=52')
'status' => $title."  ".$share_url
];
$res = $this->http_post($url,$data);
$json_arr = json_decode($res,true);
var_dump($json_arr);exit;
if(isset($json_arr['error_code'])&&!empty($json_arr['error_code'])){
$this->apiResponse(0,'分享失败!');
}
$this->apiResponse(1,'分享成功!');
}
//取消授权
... ...
... ... @@ -183,7 +183,7 @@ $(function() {
var share_url = encodeURIComponent(location.href);
var share_title = encodeURIComponent(document.title);
//分享到微博
//分享到微博弃用
$('.weibo').click(function() {
var param = {
url: share_url,
... ... @@ -197,8 +197,9 @@ $(function() {
window.open('http://v.t.sina.com.cn/share/share.php?' + temp.join('&'));
});
$('.weibo_share').click(function() {
$('#wb_share').submit();
//微博分享
$('#wb_share').click(function() {
thirdShare('/portal/login/wb_share');
});
//微博登录
... ... @@ -207,6 +208,29 @@ $(function() {
});
});
//第三方分享
function thirdShare(url){
var title = $(document).attr("title");
var share_url = window.location.href;
$.ajax({
type: 'POST',
url: url,
data: {
'title': title,
'share_url': share_url
},
dataType: 'json',
async: false,
success: function(data) {
if (data.code == 1) {
mask(data.msg);
} else {
mask(data.msg);
}
}
});
}
//点赞收藏
function operation(url, id) {
if (id == '' || id == undefined) {
... ...
... ... @@ -22,14 +22,8 @@
<p>168</p>
</div>
<!-- wb分享 -->
<form action="/portal/login/wb_share" method="POST" id="wb_share">
<div class="wb_go weibo_share">
<div class="wb_go weibo_share" id="wb_share">
<img src="__TMPL__/public/assets/starImg/bicon_05.png" alt="">
<p>168</p>
</div>
<input type="hidden" name="client_id" value="737607150">
<input type="hidden" name="redirect_uri" value="http://www.xingqiu.cn/portal/login/wb_login">
<input type="hidden" name="flag" value="1">
</form>
</div>
\ No newline at end of file
... ...