链接在新页面打开 @review by 王成龙
Showing
13 changed files
with
481 additions
and
278 deletions
@@ -15,5 +15,5 @@ return array( | @@ -15,5 +15,5 @@ return array( | ||
15 | // 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http | 15 | // 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http |
16 | 'transport' => 'http', | 16 | 'transport' => 'http', |
17 | // 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数) | 17 | // 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数) |
18 | - 'return_url' => SITE_MAIN . '/passport/login/alipaycallback', | 18 | + 'return_url' => SITE_MAIN . '/passport/autosign/alipaycallback', |
19 | ); | 19 | ); |
1 | <?php | 1 | <?php |
2 | -defined('DOMAIN') || define('DOMAIN', $_SERVER['HTTP_HOST']); | 2 | +defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); |
3 | 3 | ||
4 | return array( | 4 | return array( |
5 | - 'appId' => '09f4fa0661be14ec1ddeee13253a3ec4', | ||
6 | - 'appKey' => 'b4204e2055d63102', | ||
7 | - 'callback' => DOMAIN . '/passport/login/doubanback', | 5 | + 'appId' => '03b4e36bf13dc75a0b1eaa43d3b9560e', |
6 | + 'appKey' => 'f16d5913e8610672', | ||
7 | + 'callback' => SITE_MAIN . '/passport/autosign/doubanback', | ||
8 | 'scope' => 'douban_basic_common', | 8 | 'scope' => 'douban_basic_common', |
9 | ); | 9 | ); |
@@ -4,7 +4,7 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); | @@ -4,7 +4,7 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); | ||
4 | return array( | 4 | return array( |
5 | 'appid' => '100229394', | 5 | 'appid' => '100229394', |
6 | 'appkey' => 'c0af9c29e0900813028c2ccb42021792', | 6 | 'appkey' => 'c0af9c29e0900813028c2ccb42021792', |
7 | - 'callback' => SITE_MAIN . '/passport/login/qqcallback', | 7 | + 'callback' => SITE_MAIN . '/passport/autosign/qqcallback', |
8 | 'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist', | 8 | 'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist', |
9 | 'errorReport' => true, | 9 | 'errorReport' => true, |
10 | ); | 10 | ); |
1 | <?php | 1 | <?php |
2 | -defined('DOMAIN') || define('DOMAIN', $_SERVER['HTTP_HOST']); | 2 | +defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); |
3 | 3 | ||
4 | return array( | 4 | return array( |
5 | 'appId' => '783130c654c94a77ace97054ae266019', | 5 | 'appId' => '783130c654c94a77ace97054ae266019', |
6 | 'appKey' => '05e430de8c1e40d3a1f39ca8d3f8252c', | 6 | 'appKey' => '05e430de8c1e40d3a1f39ca8d3f8252c', |
7 | - 'callback' => DOMAIN . '/passport/login/renrenback', | 7 | + 'callback' => SITE_MAIN . '/passport/autosign/renrenback', |
8 | 'scope' => 'publish_feed,photo_upload', | 8 | 'scope' => 'publish_feed,photo_upload', |
9 | ); | 9 | ); |
@@ -4,5 +4,5 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); | @@ -4,5 +4,5 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); | ||
4 | return array( | 4 | return array( |
5 | 'appId' => '3739328910', | 5 | 'appId' => '3739328910', |
6 | 'appKey' => '9d44cded26d048e23089e5e975c93df1', | 6 | 'appKey' => '9d44cded26d048e23089e5e975c93df1', |
7 | - 'appCallbackUrl' => SITE_MAIN . '/passport/login/sinacallback', | 7 | + 'appCallbackUrl' => SITE_MAIN . '/passport/autosign/sinacallback', |
8 | ); | 8 | ); |
@@ -15,8 +15,8 @@ | @@ -15,8 +15,8 @@ | ||
15 | {{# list}} | 15 | {{# list}} |
16 | {{#unless @last}} | 16 | {{#unless @last}} |
17 | <li> | 17 | <li> |
18 | - <a href="{{href}}"> | ||
19 | - <img class="lazy" data-original="{{img}}" alt=""> | 18 | + <a href="{{href}}" target= "_blank"> |
19 | + <img class="lazy" data-original="{{img}}" alt="" > | ||
20 | </a> | 20 | </a> |
21 | </li> | 21 | </li> |
22 | {{/unless}} | 22 | {{/unless}} |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | {{# list}} | 26 | {{# list}} |
27 | {{#if @last}} | 27 | {{#if @last}} |
28 | <div class="last-item"> | 28 | <div class="last-item"> |
29 | - <a href="{{href}}"> | 29 | + <a href="{{href}}" target= "_blank"> |
30 | <img class="lazy" data-original="{{img}}" alt=""> | 30 | <img class="lazy" data-original="{{img}}" alt=""> |
31 | </a> | 31 | </a> |
32 | </div> | 32 | </div> |
@@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
43 | <ul class="img-list clearfix"> | 43 | <ul class="img-list clearfix"> |
44 | {{# imgBrand}} | 44 | {{# imgBrand}} |
45 | <li class="img-item"> | 45 | <li class="img-item"> |
46 | - <a href="{{href}}"> | 46 | + <a href="{{href}}" target= "_blank"> |
47 | <img src="{{img}}" alt=""> | 47 | <img src="{{img}}" alt=""> |
48 | </a> | 48 | </a> |
49 | </li> | 49 | </li> |
1 | +<!-- Google Tag Manager --> | ||
2 | +<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | ||
3 | +<script> | ||
4 | +var _hmt = _hmt || []; | ||
5 | +(function() { | ||
6 | + function async_load(){ | ||
7 | + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
8 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
9 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
10 | + '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
11 | + })(window,document,'script','dataLayer','GTM-W958MG'); | ||
12 | + (function() { | ||
13 | + var hm = document.createElement("script"); | ||
14 | + hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311"; | ||
15 | + hm.async = 1; | ||
16 | + var s = document.getElementsByTagName("script")[0]; | ||
17 | + s.parentNode.insertBefore(hm, s); | ||
18 | + })(); | ||
19 | + (function() { | ||
20 | + var hm = document.createElement("script"); | ||
21 | + hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; | ||
22 | + hm.async = 1; | ||
23 | + var s = document.getElementsByTagName("script")[0]; | ||
24 | + s.parentNode.insertBefore(hm, s); | ||
25 | + })(); | ||
26 | + (function() { | ||
27 | + var hm = document.createElement("script"); | ||
28 | + hm.src = "http://static.yohobuy.com/js/analytics/analysis.js"; | ||
29 | + hm.async = 1; | ||
30 | + var s = document.getElementsByTagName("script")[0]; | ||
31 | + s.parentNode.insertBefore(hm, s); | ||
32 | + })(); | ||
33 | + } | ||
34 | + window.addEventListener('load', async_load, false); | ||
35 | +})(); | ||
36 | +</script> | ||
37 | +<script> | ||
38 | + window._py = window._py||[]; | ||
39 | + window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']); | ||
40 | + window._py.push(['domain','stats.ipinyou.com']); | ||
41 | + window._py.push(['e','']); | ||
42 | + if(typeof _goodsData!='undefined'){ | ||
43 | + window._py.push(['pi',_goodsData]); | ||
44 | + } | ||
45 | + -function(d){ | ||
46 | + var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1; | ||
47 | + c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js'; | ||
48 | + var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h); | ||
49 | + }(document); | ||
50 | +</script> | ||
51 | +<script src="http://static.yohobuy.com/js/v3/o_code.js?v=20150420" async="async"></script> |
@@ -94,6 +94,34 @@ function getShoppingKey() { | @@ -94,6 +94,34 @@ function getShoppingKey() { | ||
94 | return JSON.parse(c).k; | 94 | return JSON.parse(c).k; |
95 | } | 95 | } |
96 | 96 | ||
97 | +//YAS统计代码 | ||
98 | +(function(w, d, s, j, f) { | ||
99 | + var a = d.createElement(s); | ||
100 | + var m = d.getElementsByTagName(s)[0]; | ||
101 | + | ||
102 | + w.YohoAcquisitionObject = f; | ||
103 | + | ||
104 | + w[f] = function() { | ||
105 | + w[f].p = arguments; | ||
106 | + }; | ||
107 | + | ||
108 | + a.async = 1; | ||
109 | + a.src = j; | ||
110 | + m.parentNode.insertBefore(a, m); | ||
111 | +})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas'); | ||
112 | + | ||
113 | +(function() { | ||
114 | + var uid = getUid(); | ||
115 | + | ||
116 | + uid = uid === 0 ? '' : uid; | ||
117 | + | ||
118 | + window._ozuid = uid;//暴露ozuid | ||
119 | + | ||
120 | + if (window._yas) { | ||
121 | + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_web', uid, '', ''); | ||
122 | + } | ||
123 | +}()); | ||
124 | + | ||
97 | window.cookie = cookie; | 125 | window.cookie = cookie; |
98 | 126 | ||
99 | window.setCookie = setCookie; | 127 | window.setCookie = setCookie; |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | +use LibModels\Web\Passport\RegData; | ||
5 | +use LibModels\Web\Passport\LoginData; | ||
6 | +use LibModels\Web\Home\IndexData; | ||
7 | +use Passport\PassportModel as PassportModel; | ||
8 | +use Plugin\Helpers; | ||
9 | +use Plugin\Images; | ||
10 | +use Plugin\Partner\Factory; | ||
11 | + | ||
12 | +class AutosignController extends AbstractAction | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * 支付宝登录:授权页面 | ||
17 | + */ | ||
18 | + public function alipayAction() | ||
19 | + { | ||
20 | + $this->setSession('_TOKEN', ''); | ||
21 | + | ||
22 | + Factory::create('alipay')->getAuthorizeUrl(); | ||
23 | + | ||
24 | + exit(); | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * QQ账号登录:授权页面 | ||
29 | + */ | ||
30 | + public function qqAction() | ||
31 | + { | ||
32 | + $this->setSession('_TOKEN', ''); | ||
33 | + | ||
34 | + Factory::create('qqconnect')->getAuthorizeUrl(); | ||
35 | + | ||
36 | + exit(); | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * 新浪微博账号登录:授权页面 | ||
41 | + */ | ||
42 | + public function sinaAction() | ||
43 | + { | ||
44 | + $this->setSession('_TOKEN', ''); | ||
45 | + | ||
46 | + $this->go(Factory::create('sinaweibo')->getAuthorizeUrl()); | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * 新浪微博账号登录:授权页面 | ||
51 | + */ | ||
52 | + public function renrenAction() | ||
53 | + { | ||
54 | + $this->setSession('_TOKEN', ''); | ||
55 | + | ||
56 | + $this->go(Factory::create('renren')->getAuthorizeUrl()); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * 豆瓣账号登录:授权页面 | ||
61 | + */ | ||
62 | + public function doubanAction() | ||
63 | + { | ||
64 | + $this->setSession('_TOKEN', ''); | ||
65 | + | ||
66 | + $this->go(Factory::create('douban')->getAuthorizeUrl()); | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 支付宝账号登录:回调方法 | ||
71 | + */ | ||
72 | + public function alipaycallbackAction() | ||
73 | + { | ||
74 | + $realName = $this->_request->get('real_name'); | ||
75 | + $email = $this->_request->get('email'); | ||
76 | + $userId = $this->_request->get('user_id'); | ||
77 | + | ||
78 | + $result = array(); | ||
79 | + if (isset($realName, $email, $userId)) { | ||
80 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
81 | + $result = LoginData::signinByOpenID($realName, $userId, 'alipay', $shoppingKey); | ||
82 | + } | ||
83 | + | ||
84 | + //判定是否需要绑定手机号 | ||
85 | + if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
86 | + $this->go(Helpers::url('/passport/bind/index', array('openId' => $userId, 'sourceType' => 'alipay', 'nickname' => $realName))); | ||
87 | + } | ||
88 | + | ||
89 | + $refer = $this->getCookie('refer'); | ||
90 | + if (empty($refer)) { | ||
91 | + $refer = SITE_MAIN . '/?go=1'; | ||
92 | + } | ||
93 | + else { | ||
94 | + $refer = rawurldecode($refer); | ||
95 | + } | ||
96 | + | ||
97 | + if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
98 | + $token = Helpers::makeToken($result['data']['uid']); | ||
99 | + $this->setSession('_TOKEN', $token); | ||
100 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
101 | + $this->setCookie('_TOKEN', $token); | ||
102 | + $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
103 | + } | ||
104 | + else { | ||
105 | + $this->go($refer); | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * QQ账号登录:回调方法 | ||
111 | + */ | ||
112 | + public function qqcallbackAction() | ||
113 | + { | ||
114 | + $qqconnect = Factory::create('qqconnect'); | ||
115 | + $access = $qqconnect->getAccessToken(); | ||
116 | + /* 获取QQ腾讯用户的详细信息 */ | ||
117 | + $partnerInfo = $qqconnect->getUserInfo($access); | ||
118 | + $result = array(); | ||
119 | + if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) { | ||
120 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
121 | + $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq', $shoppingKey); | ||
122 | + } | ||
123 | + | ||
124 | + //判定是否需要绑定手机号 | ||
125 | + if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
126 | + $this->go(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname']))); | ||
127 | + } | ||
128 | + | ||
129 | + $refer = $this->getCookie('refer'); | ||
130 | + if (empty($refer)) { | ||
131 | + $refer = SITE_MAIN . '/?go=1'; | ||
132 | + } | ||
133 | + else { | ||
134 | + $refer = rawurldecode($refer); | ||
135 | + } | ||
136 | + | ||
137 | + if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
138 | + $token = Helpers::makeToken($result['data']['uid']); | ||
139 | + $this->setSession('_TOKEN', $token); | ||
140 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
141 | + $this->setCookie('_TOKEN', $token); | ||
142 | + $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
143 | + } | ||
144 | + else { | ||
145 | + $this->go($refer); | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + /** | ||
150 | + * 新浪微博账号登录:回调方法 | ||
151 | + */ | ||
152 | + public function sinacallbackAction() | ||
153 | + { | ||
154 | + $sina = Factory::create('sinaweibo'); | ||
155 | + $access = $sina->getAccessToken(); | ||
156 | + /* 获取用户的详细信息 */ | ||
157 | + $partnerInfo = $sina->getUserInfo($access); | ||
158 | + | ||
159 | + $result = array(); | ||
160 | + if ($partnerInfo && is_array($partnerInfo)) { | ||
161 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
162 | + $result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina', $shoppingKey); | ||
163 | + } | ||
164 | + | ||
165 | + //判定是否需要绑定手机号 | ||
166 | + if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
167 | +// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name']))); | ||
168 | + } | ||
169 | + | ||
170 | + $refer = $this->getCookie('refer'); | ||
171 | + if (empty($refer)) { | ||
172 | + $refer = SITE_MAIN . '/?go=1'; | ||
173 | + } | ||
174 | + else { | ||
175 | + $refer = rawurldecode($refer); | ||
176 | + } | ||
177 | + | ||
178 | + if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
179 | + $token = Helpers::makeToken($result['data']['uid']); | ||
180 | + $this->setSession('_TOKEN', $token); | ||
181 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
182 | + $this->setCookie('_TOKEN', $token); | ||
183 | + $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
184 | + } | ||
185 | + else { | ||
186 | + $this->go($refer); | ||
187 | + } | ||
188 | + } | ||
189 | + | ||
190 | + /** | ||
191 | + * renren账号登录:回调方法 | ||
192 | + */ | ||
193 | + public function renrenbackAction() | ||
194 | + { | ||
195 | + $renren = Factory::create('renren'); | ||
196 | + $access = $renren->getAccessToken(); | ||
197 | + /* 获取用户的详细信息 */ | ||
198 | + $partnerInfo = $renren->getUserInfo($access); | ||
199 | + | ||
200 | + $result = array(); | ||
201 | + if ($partnerInfo && is_array($partnerInfo)) { | ||
202 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
203 | + $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'renren', $shoppingKey); | ||
204 | + } | ||
205 | + | ||
206 | + //判定是否需要绑定手机号 | ||
207 | + if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
208 | +// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['nick_name']))); | ||
209 | + } | ||
210 | + | ||
211 | + $refer = $this->getCookie('refer'); | ||
212 | + if (empty($refer)) { | ||
213 | + $refer = SITE_MAIN . '/?go=1'; | ||
214 | + } | ||
215 | + else { | ||
216 | + $refer = rawurldecode($refer); | ||
217 | + } | ||
218 | + | ||
219 | + if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
220 | + $token = Helpers::makeToken($result['data']['uid']); | ||
221 | + $this->setSession('_TOKEN', $token); | ||
222 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
223 | + $this->setCookie('_TOKEN', $token); | ||
224 | + $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
225 | + } | ||
226 | + else { | ||
227 | + $this->go($refer); | ||
228 | + } | ||
229 | + } | ||
230 | + | ||
231 | + /** | ||
232 | + * douban账号登录:回调方法 | ||
233 | + */ | ||
234 | + public function doubanbackAction() | ||
235 | + { | ||
236 | + $sina = Factory::create('douban'); | ||
237 | + $access = $sina->getAccessToken(); | ||
238 | + /* 获取用户的详细信息 */ | ||
239 | + $partnerInfo = $sina->getUserInfo($access); | ||
240 | + | ||
241 | + $result = array(); | ||
242 | + if ($partnerInfo && is_array($partnerInfo)) { | ||
243 | + $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
244 | + $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'douban', $shoppingKey); | ||
245 | + } | ||
246 | + | ||
247 | + //判定是否需要绑定手机号 | ||
248 | + if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
249 | +// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name']))); | ||
250 | + } | ||
251 | + | ||
252 | + $refer = $this->getCookie('refer'); | ||
253 | + if (empty($refer)) { | ||
254 | + $refer = SITE_MAIN . '/?go=1'; | ||
255 | + } | ||
256 | + else { | ||
257 | + $refer = rawurldecode($refer); | ||
258 | + } | ||
259 | + | ||
260 | + if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
261 | + $token = Helpers::makeToken($result['data']['uid']); | ||
262 | + $this->setSession('_TOKEN', $token); | ||
263 | + $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
264 | + $this->setCookie('_TOKEN', $token); | ||
265 | + $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
266 | + } | ||
267 | + else { | ||
268 | + $this->go($refer); | ||
269 | + } | ||
270 | + } | ||
271 | + | ||
272 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | +use LibModels\Web\Passport\RegData; | ||
5 | +use LibModels\Web\Passport\LoginData; | ||
6 | +use LibModels\Web\Home\IndexData; | ||
7 | +use Passport\PassportModel as PassportModel; | ||
8 | +use Plugin\Helpers; | ||
9 | +use Plugin\Images; | ||
10 | +use Plugin\Partner\Factory; | ||
11 | + | ||
12 | +class AutouserinfoController extends AbstractAction | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * 第三方登录完善个人信息: | ||
17 | + * 绑定手机号 | ||
18 | + */ | ||
19 | + public function indexAction() | ||
20 | + { | ||
21 | + $this->setTitle('联合登录补全信息'); | ||
22 | + $nickname = $this->get('nickname'); | ||
23 | + $openId = $this->get('openId'); | ||
24 | + $sourceType = $this->get('sourceType'); | ||
25 | + | ||
26 | + //登录后跳转页面 | ||
27 | + $refer = $this->getCookie('refer'); | ||
28 | + if (empty($refer)) { | ||
29 | + $refer = SITE_MAIN; | ||
30 | + } | ||
31 | + else { | ||
32 | + $refer = rawurldecode($refer); | ||
33 | + } | ||
34 | + | ||
35 | + //获取用户 | ||
36 | + $uid = $this->getUid(true); | ||
37 | + if (!$uid) { | ||
38 | + $isLogin = false; | ||
39 | + $username = ''; | ||
40 | + } | ||
41 | + else { | ||
42 | + $isLogin = true; | ||
43 | + $username = $this->_uname; | ||
44 | + } | ||
45 | + $simpleHeader = PassportModel::getSimpleHeader($isLogin, $username); | ||
46 | + | ||
47 | + //整合 | ||
48 | + $data = array( | ||
49 | + 'loginPage' => true, | ||
50 | + 'simpleHeader' => $simpleHeader, | ||
51 | + 'passport' => array( | ||
52 | + 'coverHref' => '', | ||
53 | + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190', | ||
54 | + ), | ||
55 | + ); | ||
56 | + | ||
57 | + $this->_view->display('index', $data); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * 完善信息页面 | ||
62 | + */ | ||
63 | + public function userInfoAction() | ||
64 | + { | ||
65 | + //获取用户 | ||
66 | + $uid = $this->getUid(true); | ||
67 | + $nickname = $this->get('nickname'); | ||
68 | + $openId = $this->get('openId'); | ||
69 | + $sourceType = $this->get('sourceType'); | ||
70 | + | ||
71 | + if (!$uid) { | ||
72 | + $isLogin = false; | ||
73 | + $username = ''; | ||
74 | + } | ||
75 | + else { | ||
76 | + $isLogin = true; | ||
77 | + $username = $this->_uname; | ||
78 | + } | ||
79 | + $simpleHeader = PassportModel::getSimpleHeader($isLogin, $username); | ||
80 | + //整合 | ||
81 | + $data = array( | ||
82 | + 'simpleHeader' => $simpleHeader, | ||
83 | + 'passport' => array( | ||
84 | + 'coverHref' => '', | ||
85 | + 'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190', | ||
86 | + 'goShoppingUrl' => SITE_MAIN, | ||
87 | + 'completeInfoUrl' => Helpers::url('/passport/autouserinfo/index', array('openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname)), | ||
88 | + ), | ||
89 | + ); | ||
90 | + | ||
91 | + $this->_view->display('userinfo', $data); | ||
92 | + } | ||
93 | + | ||
94 | + /* | ||
95 | + * 发送绑定验证吗 | ||
96 | + */ | ||
97 | + | ||
98 | + /* | ||
99 | + * 验证图形验证码 | ||
100 | + */ | ||
101 | + | ||
102 | + /* | ||
103 | + * 验证短信验证码 | ||
104 | + */ | ||
105 | + | ||
106 | + /* | ||
107 | + * 绑定手机号 | ||
108 | + */ | ||
109 | +} |
@@ -26,7 +26,7 @@ class LoginController extends AbstractAction | @@ -26,7 +26,7 @@ class LoginController extends AbstractAction | ||
26 | $this->setCookie('_TOKEN', ''); | 26 | $this->setCookie('_TOKEN', ''); |
27 | 27 | ||
28 | //登录后跳转页面 | 28 | //登录后跳转页面 |
29 | - $refer = $this->get('refer'); | 29 | + $refer = empty($_SERVER["HTTP_REFERER"])?'':$_SERVER["HTTP_REFERER"]; |
30 | if (!empty($refer)) { | 30 | if (!empty($refer)) { |
31 | $this->setCookie('refer', $refer); | 31 | $this->setCookie('refer', $refer); |
32 | } | 32 | } |
@@ -55,17 +55,17 @@ class LoginController extends AbstractAction | @@ -55,17 +55,17 @@ class LoginController extends AbstractAction | ||
55 | 'simpleHeader' => $simpleHeader, | 55 | 'simpleHeader' => $simpleHeader, |
56 | 'passport' => array( | 56 | 'passport' => array( |
57 | 'coverHref' => $coverHref, | 57 | 'coverHref' => $coverHref, |
58 | - 'coverImg' => $coverImg, | 58 | + 'coverImg' => !empty($coverImg)?$coverImg:'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190', |
59 | 'countryCode' => '+86', | 59 | 'countryCode' => '+86', |
60 | 'countryName' => '中国', | 60 | 'countryName' => '中国', |
61 | 'countryList' => RegData::getAreasData(), | 61 | 'countryList' => RegData::getAreasData(), |
62 | 'forgetPwd' => Helpers::url('/passport/back/index'), | 62 | 'forgetPwd' => Helpers::url('/passport/back/index'), |
63 | 'fastReg' => Helpers::url('/reg.html'), | 63 | 'fastReg' => Helpers::url('/reg.html'), |
64 | - 'qqLogin' => Helpers::url('/passport/login/qq'), | ||
65 | - 'weiboLogin' => Helpers::url('/passport/login/sina'), | ||
66 | - 'alipayLogin' => Helpers::url('/passport/login/alipay'), | ||
67 | - 'doubanLogin' => Helpers::url('/passport/login/douban'), | ||
68 | - 'renrenLogin' => Helpers::url('/passport/login/renren'), | 64 | + 'qqLogin' => Helpers::url('/passport/autosign/qq'), |
65 | + 'weiboLogin' => Helpers::url('/passport/autosign/sina'), | ||
66 | + 'alipayLogin' => Helpers::url('/passport/autosign/alipay'), | ||
67 | + 'doubanLogin' => Helpers::url('/passport/autosign/douban'), | ||
68 | + 'renrenLogin' => Helpers::url('/passport/autosign/renren'), | ||
69 | ), | 69 | ), |
70 | ); | 70 | ); |
71 | 71 | ||
@@ -160,262 +160,4 @@ class LoginController extends AbstractAction | @@ -160,262 +160,4 @@ class LoginController extends AbstractAction | ||
160 | $this->go($refer); | 160 | $this->go($refer); |
161 | } | 161 | } |
162 | 162 | ||
163 | - //第三方登录 | ||
164 | - /** | ||
165 | - * 支付宝登录:授权页面 | ||
166 | - */ | ||
167 | - public function alipayAction() | ||
168 | - { | ||
169 | - $this->setSession('_TOKEN', ''); | ||
170 | - | ||
171 | - Factory::create('alipay')->getAuthorizeUrl(); | ||
172 | - | ||
173 | - exit(); | ||
174 | - } | ||
175 | - | ||
176 | - /** | ||
177 | - * QQ账号登录:授权页面 | ||
178 | - */ | ||
179 | - public function qqAction() | ||
180 | - { | ||
181 | - $this->setSession('_TOKEN', ''); | ||
182 | - | ||
183 | - Factory::create('qqconnect')->getAuthorizeUrl(); | ||
184 | - | ||
185 | - exit(); | ||
186 | - } | ||
187 | - | ||
188 | - /** | ||
189 | - * 新浪微博账号登录:授权页面 | ||
190 | - */ | ||
191 | - public function sinaAction() | ||
192 | - { | ||
193 | - $this->setSession('_TOKEN', ''); | ||
194 | - | ||
195 | - $this->go(Factory::create('sinaweibo')->getAuthorizeUrl()); | ||
196 | - } | ||
197 | - | ||
198 | - /** | ||
199 | - * 新浪微博账号登录:授权页面 | ||
200 | - */ | ||
201 | - public function renrenAction() | ||
202 | - { | ||
203 | - $this->setSession('_TOKEN', ''); | ||
204 | - | ||
205 | - $this->go(Factory::create('renren')->getAuthorizeUrl()); | ||
206 | - } | ||
207 | - | ||
208 | - /** | ||
209 | - * 豆瓣账号登录:授权页面 | ||
210 | - */ | ||
211 | - public function doubanAction() | ||
212 | - { | ||
213 | - $this->setSession('_TOKEN', ''); | ||
214 | - | ||
215 | - $this->go(Factory::create('douban')->getAuthorizeUrl()); | ||
216 | - } | ||
217 | - | ||
218 | - /** | ||
219 | - * 支付宝账号登录:回调方法 | ||
220 | - */ | ||
221 | - public function alipaycallbackAction() | ||
222 | - { | ||
223 | - $realName = $this->_request->get('real_name'); | ||
224 | - $email = $this->_request->get('email'); | ||
225 | - $userId = $this->_request->get('user_id'); | ||
226 | - | ||
227 | - $result = array(); | ||
228 | - if (isset($realName, $email, $userId)) { | ||
229 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
230 | - $result = LoginData::signinByOpenID($realName, $userId, 'alipay', $shoppingKey); | ||
231 | - } | ||
232 | - | ||
233 | - //判定是否需要绑定手机号 | ||
234 | - if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
235 | - $this->go(Helpers::url('/passport/bind/index', array('openId' => $userId, 'sourceType' => 'alipay', 'nickname' => $realName))); | ||
236 | - } | ||
237 | - | ||
238 | - $refer = $this->getCookie('refer'); | ||
239 | - if (empty($refer)) { | ||
240 | - $refer = SITE_MAIN . '/?go=1'; | ||
241 | - } | ||
242 | - else { | ||
243 | - $refer = rawurldecode($refer); | ||
244 | - } | ||
245 | - | ||
246 | - if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
247 | - $token = Helpers::makeToken($result['data']['uid']); | ||
248 | - $this->setSession('_TOKEN', $token); | ||
249 | - $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
250 | - $this->setCookie('_TOKEN', $token); | ||
251 | - $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
252 | - } | ||
253 | - else { | ||
254 | - $this->go($refer); | ||
255 | - } | ||
256 | - } | ||
257 | - | ||
258 | - /** | ||
259 | - * QQ账号登录:回调方法 | ||
260 | - */ | ||
261 | - public function qqcallbackAction() | ||
262 | - { | ||
263 | - $qqconnect = Factory::create('qqconnect'); | ||
264 | - $access = $qqconnect->getAccessToken(); | ||
265 | - /* 获取QQ腾讯用户的详细信息 */ | ||
266 | - $partnerInfo = $qqconnect->getUserInfo($access); | ||
267 | - $result = array(); | ||
268 | - if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) { | ||
269 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
270 | - $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq', $shoppingKey); | ||
271 | - } | ||
272 | - | ||
273 | - //判定是否需要绑定手机号 | ||
274 | - if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
275 | -// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname']))); | ||
276 | - } | ||
277 | - | ||
278 | - $refer = $this->getCookie('refer'); | ||
279 | - if (empty($refer)) { | ||
280 | - $refer = SITE_MAIN . '/?go=1'; | ||
281 | - } | ||
282 | - else { | ||
283 | - $refer = rawurldecode($refer); | ||
284 | - } | ||
285 | - | ||
286 | - if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
287 | - $token = Helpers::makeToken($result['data']['uid']); | ||
288 | - $this->setSession('_TOKEN', $token); | ||
289 | - $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
290 | - $this->setCookie('_TOKEN', $token); | ||
291 | - $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
292 | - } | ||
293 | - else { | ||
294 | - $this->go($refer); | ||
295 | - } | ||
296 | - } | ||
297 | - | ||
298 | - /** | ||
299 | - * 新浪微博账号登录:回调方法 | ||
300 | - */ | ||
301 | - public function sinacallbackAction() | ||
302 | - { | ||
303 | - $sina = Factory::create('sinaweibo'); | ||
304 | - $access = $sina->getAccessToken(); | ||
305 | - /* 获取用户的详细信息 */ | ||
306 | - $partnerInfo = $sina->getUserInfo($access); | ||
307 | - | ||
308 | - $result = array(); | ||
309 | - if ($partnerInfo && is_array($partnerInfo)) { | ||
310 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
311 | - $result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina', $shoppingKey); | ||
312 | - } | ||
313 | - | ||
314 | - //判定是否需要绑定手机号 | ||
315 | - if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
316 | -// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name']))); | ||
317 | - } | ||
318 | - | ||
319 | - $refer = $this->getCookie('refer'); | ||
320 | - if (empty($refer)) { | ||
321 | - $refer = SITE_MAIN . '/?go=1'; | ||
322 | - } | ||
323 | - else { | ||
324 | - $refer = rawurldecode($refer); | ||
325 | - } | ||
326 | - | ||
327 | - if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
328 | - $token = Helpers::makeToken($result['data']['uid']); | ||
329 | - $this->setSession('_TOKEN', $token); | ||
330 | - $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
331 | - $this->setCookie('_TOKEN', $token); | ||
332 | - $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
333 | - } | ||
334 | - else { | ||
335 | - $this->go($refer); | ||
336 | - } | ||
337 | - } | ||
338 | - | ||
339 | - /** | ||
340 | - * renren账号登录:回调方法 | ||
341 | - */ | ||
342 | - public function renrenbackAction() | ||
343 | - { | ||
344 | - $renren = Factory::create('renren'); | ||
345 | - $access = $renren->getAccessToken(); | ||
346 | - /* 获取用户的详细信息 */ | ||
347 | - $partnerInfo = $renren->getUserInfo($access); | ||
348 | - | ||
349 | - $result = array(); | ||
350 | - if ($partnerInfo && is_array($partnerInfo)) { | ||
351 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
352 | - $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'renren', $shoppingKey); | ||
353 | - } | ||
354 | - | ||
355 | - //判定是否需要绑定手机号 | ||
356 | - if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
357 | -// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['nick_name']))); | ||
358 | - } | ||
359 | - | ||
360 | - $refer = $this->getCookie('refer'); | ||
361 | - if (empty($refer)) { | ||
362 | - $refer = SITE_MAIN . '/?go=1'; | ||
363 | - } | ||
364 | - else { | ||
365 | - $refer = rawurldecode($refer); | ||
366 | - } | ||
367 | - | ||
368 | - if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
369 | - $token = Helpers::makeToken($result['data']['uid']); | ||
370 | - $this->setSession('_TOKEN', $token); | ||
371 | - $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
372 | - $this->setCookie('_TOKEN', $token); | ||
373 | - $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
374 | - } | ||
375 | - else { | ||
376 | - $this->go($refer); | ||
377 | - } | ||
378 | - } | ||
379 | - | ||
380 | - /** | ||
381 | - * douban账号登录:回调方法 | ||
382 | - */ | ||
383 | - public function doubanbackAction() | ||
384 | - { | ||
385 | - $sina = Factory::create('douban'); | ||
386 | - $access = $sina->getAccessToken(); | ||
387 | - /* 获取用户的详细信息 */ | ||
388 | - $partnerInfo = $sina->getUserInfo($access); | ||
389 | - | ||
390 | - $result = array(); | ||
391 | - if ($partnerInfo && is_array($partnerInfo)) { | ||
392 | - $shoppingKey = Helpers::getShoppingKeyByCookie(); | ||
393 | - $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'douban', $shoppingKey); | ||
394 | - } | ||
395 | - | ||
396 | - //判定是否需要绑定手机号 | ||
397 | - if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') { | ||
398 | -// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name']))); | ||
399 | - } | ||
400 | - | ||
401 | - $refer = $this->getCookie('refer'); | ||
402 | - if (empty($refer)) { | ||
403 | - $refer = SITE_MAIN . '/?go=1'; | ||
404 | - } | ||
405 | - else { | ||
406 | - $refer = rawurldecode($refer); | ||
407 | - } | ||
408 | - | ||
409 | - if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) { | ||
410 | - $token = Helpers::makeToken($result['data']['uid']); | ||
411 | - $this->setSession('_TOKEN', $token); | ||
412 | - $this->setSession('_LOGIN_UID', $result['data']['uid']); | ||
413 | - $this->setCookie('_TOKEN', $token); | ||
414 | - $this->go(Helpers::syncUserSession($result['data']['uid'], $refer)); | ||
415 | - } | ||
416 | - else { | ||
417 | - $this->go($refer); | ||
418 | - } | ||
419 | - } | ||
420 | - | ||
421 | } | 163 | } |
-
Please register or login to post a comment