Showing
9 changed files
with
11 additions
and
188 deletions
@@ -607,10 +607,10 @@ seajs._config = { | @@ -607,10 +607,10 @@ seajs._config = { | ||
607 | */ | 607 | */ |
608 | var YohoConfig = { | 608 | var YohoConfig = { |
609 | baseUrl: '/', | 609 | baseUrl: '/', |
610 | - domain: "yohood.yohobuy.com", | ||
611 | - resdomain: "res.yoho.cn", | ||
612 | - mainUrl: 'http://yohood.yohobuy.com', | ||
613 | - resUrl: "http://res.test.yohood.yoho.cn/", | 610 | + domain: "www.yohood.cn", |
611 | + resdomain: "res.yohood.cn", | ||
612 | + mainUrl: 'http://www.yohood.cn', | ||
613 | + resUrl: "http://res.yohood.cn/", | ||
614 | uploadUrl: "http://" + window.location.host + "/upload/upfile" | 614 | uploadUrl: "http://" + window.location.host + "/upload/upfile" |
615 | }; | 615 | }; |
616 | seajs.config({ | 616 | seajs.config({ |
1 | [memcache] | 1 | [memcache] |
2 | -servers = 192.168.0.187:12541,192.168.0.187:12542,192.168.0.187:12543,192.168.0.187:12544 | 2 | +servers = 10.162.218.209:12111,10.170.240.181:12111 |
3 | [memcached] | 3 | [memcached] |
4 | -servers = 192.168.0.187:12541,192.168.0.187:12542,192.168.0.187:12543,192.168.0.187:12544 | 4 | +servers = 10.162.218.209:12111,10.170.240.181:12111 |
1 | [mysql] | 1 | [mysql] |
2 | 2 | ||
3 | -yohood.username = root | ||
4 | -yohood.password = yohonj#mysql | ||
5 | -yohood.writers = 127.0.0.1:3310 | ||
6 | -yohood.readers = 127.0.0.1:3310 | ||
3 | +yohood.username = yoho96cn46 | ||
4 | +yohood.password = yoho548_njSuw52_SdwislP | ||
5 | +yohood.writers = rdsmf1mqqs1w8qc8fka9d.mysql.rds.aliyuncs.com:3306 | ||
6 | +yohood.readers = rdsmf1mqqs1w8qc8fka9d.mysql.rds.aliyuncs.com:3306 |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | ************************/ | 24 | ************************/ |
25 | require_once dirname(dirname(__FILE__)) . '/config/Defines.class.php'; | 25 | require_once dirname(dirname(__FILE__)) . '/config/Defines.class.php'; |
26 | // 定义APP当前环境 | 26 | // 定义APP当前环境 |
27 | -Config_Defines::setVaribles('test'); | 27 | +Config_Defines::setVaribles('release'); |
28 | // 引入应用配置文件 | 28 | // 引入应用配置文件 |
29 | $config = include(dirname(dirname(__FILE__)) . '/config/Boot.inc.php'); | 29 | $config = include(dirname(dirname(__FILE__)) . '/config/Boot.inc.php'); |
30 | // 引入框架入口文件 | 30 | // 引入框架入口文件 |
website/public/test/.jssdk.php.swp
deleted
100644 → 0
No preview for this file type
1 | -{"access_token":"","expire_time":0} |
1 | -{"jsapi_ticket":"","expire_time":0} |
website/public/test/jssdk.php
deleted
100644 → 0
1 | -<?php | ||
2 | -class JSSDK { | ||
3 | - private $appId; | ||
4 | - private $appSecret; | ||
5 | - | ||
6 | - public function __construct($appId, $appSecret) { | ||
7 | - $this->appId = $appId; | ||
8 | - $this->appSecret = $appSecret; | ||
9 | - } | ||
10 | - | ||
11 | - public function getSignPackage() { | ||
12 | - $jsapiTicket = $this->getJsApiTicket(); | ||
13 | - | ||
14 | - // 注意 URL 一定要动态获取,不能 hardcode. | ||
15 | - $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; | ||
16 | - $url = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; | ||
17 | - | ||
18 | - $timestamp = time(); | ||
19 | - $nonceStr = $this->createNonceStr(); | ||
20 | - | ||
21 | - // 这里参数的顺序要按照 key 值 ASCII 码升序排序 | ||
22 | - $string = "jsapi_ticket=$jsapiTicket&noncestr=$nonceStr×tamp=$timestamp&url=$url"; | ||
23 | - | ||
24 | - $signature = sha1($string); | ||
25 | - | ||
26 | - $signPackage = array( | ||
27 | - "appId" => $this->appId, | ||
28 | - "nonceStr" => $nonceStr, | ||
29 | - "timestamp" => $timestamp, | ||
30 | - "url" => $url, | ||
31 | - "signature" => $signature, | ||
32 | - "rawString" => $string | ||
33 | - ); | ||
34 | - return $signPackage; | ||
35 | - } | ||
36 | - | ||
37 | - private function createNonceStr($length = 16) { | ||
38 | - $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | ||
39 | - $str = ""; | ||
40 | - for ($i = 0; $i < $length; $i++) { | ||
41 | - $str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); | ||
42 | - } | ||
43 | - return $str; | ||
44 | - } | ||
45 | - | ||
46 | - private function getJsApiTicket() { | ||
47 | - // jsapi_ticket 应该全局存储与更新,以下代码以写入到文件中做示例 | ||
48 | - $data = json_decode(file_get_contents("jsapi_ticket.json")); | ||
49 | - if ($data->expire_time < time()) { | ||
50 | - $accessToken = $this->getAccessToken(); | ||
51 | - // 如果是企业号用以下 URL 获取 ticket | ||
52 | - // $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken"; | ||
53 | - $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=$accessToken"; | ||
54 | - $res = json_decode($this->httpGet($url)); | ||
55 | - $ticket = $res->ticket; | ||
56 | - if ($ticket) { | ||
57 | - $data->expire_time = time() + 7000; | ||
58 | - $data->jsapi_ticket = $ticket; | ||
59 | - $fp = fopen("jsapi_ticket.json", "w"); | ||
60 | - fwrite($fp, json_encode($data)); | ||
61 | - fclose($fp); | ||
62 | - } | ||
63 | - } else { | ||
64 | - $ticket = $data->jsapi_ticket; | ||
65 | - } | ||
66 | - | ||
67 | - return $ticket; | ||
68 | - } | ||
69 | - | ||
70 | - private function getAccessToken() { | ||
71 | - // access_token 应该全局存储与更新,以下代码以写入到文件中做示例 | ||
72 | - $data = json_decode(file_get_contents("access_token.json")); | ||
73 | - if ($data->expire_time < time()) { | ||
74 | - // 如果是企业号用以下URL获取access_token | ||
75 | - // $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$this->appId&corpsecret=$this->appSecret"; | ||
76 | - $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$this->appId&secret=$this->appSecret"; | ||
77 | - $res = json_decode($this->httpGet($url)); | ||
78 | - $access_token = $res->access_token; | ||
79 | - if ($access_token) { | ||
80 | - $data->expire_time = time() + 7000; | ||
81 | - $data->access_token = $access_token; | ||
82 | - $fp = fopen("access_token.json", "w"); | ||
83 | - fwrite($fp, json_encode($data)); | ||
84 | - fclose($fp); | ||
85 | - } | ||
86 | - } else { | ||
87 | - $access_token = $data->access_token; | ||
88 | - } | ||
89 | - return $access_token; | ||
90 | - } | ||
91 | - | ||
92 | - private function httpGet($url) { | ||
93 | - $curl = curl_init(); | ||
94 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | ||
95 | - curl_setopt($curl, CURLOPT_TIMEOUT, 500); | ||
96 | - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | ||
97 | - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); | ||
98 | - curl_setopt($curl, CURLOPT_URL, $url); | ||
99 | - | ||
100 | - $res = curl_exec($curl); | ||
101 | - curl_close($curl); | ||
102 | - | ||
103 | - return $res; | ||
104 | - } | ||
105 | -} | ||
106 | - |
website/public/test/sample.php
deleted
100644 → 0
1 | -<?php | ||
2 | -require_once "jssdk.php"; | ||
3 | -$jssdk = new JSSDK("wx984e31a227819392", "6e1e588a39b3327d711b48ed20d03ede"); | ||
4 | -$signPackage = $jssdk->GetSignPackage(); | ||
5 | -?> | ||
6 | -<!DOCTYPE html> | ||
7 | -<html lang="en"> | ||
8 | -<head> | ||
9 | - <meta charset="UTF-8"> | ||
10 | - <title></title> | ||
11 | -</head> | ||
12 | -<body> | ||
13 | - test wechat | ||
14 | -</body> | ||
15 | -<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> | ||
16 | -<script> | ||
17 | - /* | ||
18 | - * 注意: | ||
19 | - * 1. 所有的JS接口只能在公众号绑定的域名下调用,公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。 | ||
20 | - * 2. 如果发现在 Android 不能分享自定义内容,请到官网下载最新的包覆盖安装,Android 自定义分享接口需升级至 6.0.2.58 版本及以上。 | ||
21 | - * 3. 常见问题及完整 JS-SDK 文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html | ||
22 | - * | ||
23 | - * 开发中遇到问题详见文档“附录5-常见错误及解决办法”解决,如仍未能解决可通过以下渠道反馈: | ||
24 | - * 邮箱地址:weixin-open@qq.com | ||
25 | - * 邮件主题:【微信JS-SDK反馈】具体问题 | ||
26 | - * 邮件内容说明:用简明的语言描述问题所在,并交代清楚遇到该问题的场景,可附上截屏图片,微信团队会尽快处理你的反馈。 | ||
27 | - */ | ||
28 | - wx.config({ | ||
29 | - debug: true, | ||
30 | - appId: '<?php echo $signPackage["appId"];?>', | ||
31 | - timestamp: <?php echo $signPackage["timestamp"];?>, | ||
32 | - nonceStr: '<?php echo $signPackage["nonceStr"];?>', | ||
33 | - signature: '<?php echo $signPackage["signature"];?>', | ||
34 | - jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ', | ||
35 | - 'onMenuShareWeibo','hideMenuItems','showMenuItems','hideAllNonBaseMenuItem','showAllNonBaseMenuItem', | ||
36 | - 'translateVoice','startRecord','stopRecord','onRecordEnd','playVoice','pauseVoice','stopVoice', | ||
37 | - 'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage','downloadImage', | ||
38 | - 'getNetworkType','openLocation','getLocation','hideOptionMenu','showOptionMenu','closeWindow', | ||
39 | - 'scanQRCode','chooseWXPay','openProductSpecificView','addCard','chooseCard','openCard' | ||
40 | - ] | ||
41 | - }); | ||
42 | - wx.ready(function () { | ||
43 | - // 在这里调用 API | ||
44 | - wx.onMenuShareAppMessage({ | ||
45 | - title: '互联网之子', | ||
46 | - desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。', | ||
47 | - link: 'http://movie.douban.com/subject/25785114/', | ||
48 | - imgUrl: 'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg', | ||
49 | - trigger: function (res) { | ||
50 | - // 不要尝试在trigger中使用ajax异步请求修改本次分享的内容,因为客户端分享操作是一个同步操作,这时候使用ajax的回包会还没有返回 | ||
51 | - alert('用户点击发送给朋友'); | ||
52 | - }, | ||
53 | - success: function (res) { | ||
54 | - alert('已分享'); | ||
55 | - }, | ||
56 | - cancel: function (res) { | ||
57 | - alert('已取消'); | ||
58 | - }, | ||
59 | - fail: function (res) { | ||
60 | - alert(JSON.stringify(res)); | ||
61 | - } | ||
62 | - }); | ||
63 | - alert('aaa'); | ||
64 | - }); | ||
65 | - wx.error(function (res) { | ||
66 | - alert(res.errMsg); | ||
67 | - }); | ||
68 | -</script> | ||
69 | -</html> |
-
Please register or login to post a comment