Authored by 2586703@qq.com

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohood into develop

Conflicts:
	res/css/index.css
	res/css/index.css.map
... ... @@ -646,7 +646,7 @@ define('yohood', function(require, exports) {
isVideo = (v.tag == '视频') ? 1 : 0;
isTitleStyle = (v.main_title_type == 1) ? 1 : 0;
recom += template(tools.limitWords(v.title, 48), common.getImages(v.thumb, '0230x0130', 'blogimg', '1'),
'/news/detail/id/' + v.id, isVideo, isTitleStyle, v.title, 'width:200px;height:130px;');
'/news/detail/id/' + v.id, isVideo, isTitleStyle, v.title, '');
});
//热门视频
... ...
... ... @@ -84,6 +84,8 @@ class Config_Defines
define('DATA_IMG01_THUMB', '/Data/img/www.yoho.cn/thumb01');
define('DATA_IMG02_THUMB', '/Data/img/www.yoho.cn/thumb02');
define('YOHOBUY_URL', 'http://yohobuy.com');
define('YOHO_WECHAT_APPID','wx984e31a227819392');
define('YOHO_WECHAT_APPSECRET','6e1e588a39b3327d711b48ed20d03ede');
}
/**
... ... @@ -109,7 +111,7 @@ class Config_Defines
// 主域名
define('SITE_DOMAIN', '.test.yoho.cn');
// 静态资源目录
define('SITE_RES', 'http://res.test.yohood.yoho.cn');
define('SITE_RES', 'http://res.yohood.test.yoho.cn');
// 主站
define('SITE_MAIN', 'http://yohood.test.yoho.cn');
define('QINIU_UPLOAD_STATE', true);
... ...
... ... @@ -214,7 +214,7 @@ EOT;
$news = array($temp['id'] => $temp);
}
$news = array_slice(array_filter($news + $temp2), 0, 3);
$this->_view['wechat'] = array();//Lib_Wechat_JSSDK::getSignPackage();
$this->_view['wechat'] = Lib_Wechat_JSSDK::getSignPackage();
}
$info['title'] = strip_tags($info['title']);
$info['pics'] = array_filter(explode('|', $info['pics']));
... ...
... ... @@ -11,7 +11,7 @@ class Lib_Wechat_JSSDK {
/* $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$url = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; */
// 确保你获取用来签名的url是动态获取的,动态页面可参见实例代码中php的实现方式。如果是html的静态页面在前端通过ajax将url传到后台签名,前端需要用js获取当前页面除去'#'hash部分的链接(可用location.href.split('#')[0]获取),因为页面一旦分享,微信客户端会在你的链接末尾加入其它参数,如果不是动态获取当前链接,将导致分享后的页面签名失败。
$url = $_REQUEST['pageurl'];
$url = '';
$timestamp = time();
$nonceStr = self::createNonceStr();
... ... @@ -70,7 +70,7 @@ class Lib_Wechat_JSSDK {
public static function getAccessToken()
{
$http_url = 'https://api.weixin.qq.com/cgi-bin/token?';
$params = array('appid'=> self::$appId,'secret' => self::$appSecret,'grant_type'=>'client_credential');
$params = array('appid'=> YOHO_WECHAT_APPID,'secret' => YOHO_WECHAT_APPSECRET,'grant_type'=>'client_credential');
$access_token = Lib_Utils_Cache_Data::get("WEICHAT_ACCESSTOKEN");
if(empty( $access_token ))
{
... ...
... ... @@ -44,6 +44,7 @@
</div>
<div class="overlay"></div>
</div>
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<?php $this->_js('index.js', array(
SITE_JS . '/lib/seajs.js'
));?>
... ...
... ... @@ -55,7 +55,7 @@
<ul>
<?php foreach($this->view->news as $news):?>
<li>
<a class="clearfix" href="/news/detail/id/<?php echo $news['id'];?>">
<a class="clearfix" href="/news/detail/id/<?php echo $news['id'];?>" target="_blank">
<div class="image-box">
<img src="<?php echo Lib_Images::getImageUrl($news['thumb'], 'source','fragmentimg');?>" alt="">
</div>
... ... @@ -70,7 +70,9 @@
<div id="share" class="share" cover-url="<?php
$thumb = empty($this->view->info['client_thumb']) ? $this->view->info['thumb'] : $this->view->info['client_thumb'];
echo Lib_Images::getImageUrl($thumb, 'source','fragmentimg');?>"
data-link="<?php echo SITE_MAIN.'/news/detail/id/'.$this->view->info['id'];?>" wechatAppId="" wechatTimestamp="" wechatNonceStr="" wechatSignature="">
data-link="<?php echo SITE_MAIN.'/news/detail/id/'.$this->view->info['id'];?>" wechatAppId="<?php echo $this->view->wechat['appId'];?>"
wechatTimestamp="<?php echo $this->view->wechat['timestamp'];?>" wechatNonceStr="<?php echo $this->view->wechat['nonceStr'];?>"
wechatSignature="<?php echo $this->view->wechat['signature'];?>">
<ul class="clearfix">
<li class="yohoo-share-button-sina"><a href="javascript:;"></a></li>
<li class="yohoo-share-button-qq"><a href="javascript:;"></a></li>
... ... @@ -79,37 +81,7 @@
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
var shareData = {
title: '',
desc: '',
imgUrl: '',
link: '',
};
// wx.config({
// debug: false,
// appId: '',
// timestamp: '',
// nonceStr: '',
// signature: '',
// jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ',
// 'onMenuShareWeibo','hideMenuItems','showMenuItems','hideAllNonBaseMenuItem','showAllNonBaseMenuItem',
// 'translateVoice','startRecord','stopRecord','onRecordEnd','playVoice','pauseVoice','stopVoice',
// 'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage','downloadImage',
// 'getNetworkType','openLocation','getLocation','hideOptionMenu','showOptionMenu','closeWindow',
// 'scanQRCode','chooseWXPay','openProductSpecificView','addCard','chooseCard','openCard'
// ]
// });
// // 2.1 “分享给朋友”
// wx.onMenuShareAppMessage(shareData);
// // 2.2 “分享到朋友圈”
// wx.onMenuShareTimeline(shareData);
// // 2.3 “分享到QQ”
// wx.onMenuShareQQ(shareData);
// // 2.4 “分享到微博”
// wx.onMenuShareWeibo(shareData);
seajs.use(['jquery', 'mobile'],function($, mobile) {
mobile.detail();
var shareUrl = $(".share").attr("data-link"),
... ... @@ -120,6 +92,36 @@
wechatTimestamp = $(".share").attr("wechatTimestamp"),
wechatNonceStr = $(".share").attr("wechatNonceStr"),
wechatSignature = $(".share").attr("wechatSignature");
wx.config({
debug: false,
appId: wechatAppId,
timestamp: wechatTimestamp,
nonceStr: wechatNonceStr,
signature: wechatSignature,
jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ',
'onMenuShareWeibo','hideMenuItems','showMenuItems','hideAllNonBaseMenuItem','showAllNonBaseMenuItem',
'translateVoice','startRecord','stopRecord','onRecordEnd','playVoice','pauseVoice','stopVoice',
'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage','downloadImage',
'getNetworkType','openLocation','getLocation','hideOptionMenu','showOptionMenu','closeWindow',
'scanQRCode','chooseWXPay','openProductSpecificView','addCard','chooseCard','openCard'
]
});
wx.ready(function () {
var shareData = {
title: detailTitle,
desc: '',
imgUrl: shareCover,
link: shareUrl
};
// 2.1 “分享给朋友”
wx.onMenuShareAppMessage(shareData);
// 2.2 “分享到朋友圈”
wx.onMenuShareTimeline(shareData);
// 2.3 “分享到QQ”
wx.onMenuShareQQ(shareData);
// 2.4 “分享到微博”
wx.onMenuShareWeibo(shareData);
});
});
</script>
<?php $this->_endblock();?>
... ...