Toyota.php 1.08 KB
<?php
use Action\HuodongAction;
class ToyotaController extends HuodongAction
{
    private $callbackurl = 'http://m.yohobuy.com/events/get?ref=';
    
    /**
     * 获取微信跳转地址
     * 
     * @return string
     */
    public function getwechaturlAction()
    {
    	$url = $this->get('url', '');
    	if(!empty($url))
    	{
    	    $host = parse_url($url);
            if(preg_match('@yoho.cn@i', $host['host']) || preg_match('@yohobuy.com@i', $host['host']) )
            {
                header('location:'.$this->callbackurl.urlencode($url));
            }
            else
            {
                header('location:http://m.yohobuy.com');
            }
    	}
    	exit();
    }
    
    /**
     * 获取微信信息
     * 
     * @return string
     */
    public function getwechatinfoAction()
    {
        $callback =  $this->get('callback', '');
        $wx_info = isset($_COOKIE['wxinfo']) ? $_COOKIE['wxinfo']: '';
        header('Content-Type: application/json; charset=utf-8;');
        echo $callback, '(';
        echo $wx_info;
        echo ')';
        exit();
    }
}