Merge branch 'master' of git.yoho.cn:fe/YOHOBUYWAP
Showing
1 changed file
with
45 additions
and
0 deletions
1 | +<?php | ||
2 | +use Action\HuodongAction; | ||
3 | +class ToyotaController extends HuodongAction | ||
4 | +{ | ||
5 | + private $callbackurl = 'http://m.yohobuy.com/events/get?ref='; | ||
6 | + | ||
7 | + /** | ||
8 | + * 获取微信跳转地址 | ||
9 | + * | ||
10 | + * @return string | ||
11 | + */ | ||
12 | + public function getwechaturlAction() | ||
13 | + { | ||
14 | + $url = $this->get('url', ''); | ||
15 | + if(!empty($url)) | ||
16 | + { | ||
17 | + $host = parse_url($url); | ||
18 | + if(preg_match('@yoho.cn@i', $host['host']) || preg_match('@yohobuy.com@i', $host['host']) ) | ||
19 | + { | ||
20 | + header('location:'.$this->callbackurl.urlencode($url)); | ||
21 | + } | ||
22 | + else | ||
23 | + { | ||
24 | + header('location:http://m.yohobuy.com'); | ||
25 | + } | ||
26 | + } | ||
27 | + exit(); | ||
28 | + } | ||
29 | + | ||
30 | + /** | ||
31 | + * 获取微信信息 | ||
32 | + * | ||
33 | + * @return string | ||
34 | + */ | ||
35 | + public function getwechatinfoAction() | ||
36 | + { | ||
37 | + $callback = $this->get('callback', ''); | ||
38 | + $wx_info = isset($_COOKIE['wxinfo']) ? $_COOKIE['wxinfo']: ''; | ||
39 | + header('Content-Type: application/json; charset=utf-8;'); | ||
40 | + echo $callback, '('; | ||
41 | + echo $wx_info; | ||
42 | + echo ')'; | ||
43 | + exit(); | ||
44 | + } | ||
45 | +} |
-
Please register or login to post a comment