public function loginFromSocialMedia($type = null)
 {
     if (C('IS_DEV') == 'true') {
         $weiboId = "123451114";
         $user_info['type'] = 'SINA';
         $user_info['name'] = 'super002';
         $user_info['nick'] = '老王';
         $user_info['head'] = 'http://tva2.sinaimg.cn/crop.0.0.180.180.180/68302600jw1e8qgp5bmzyj2050050aa8.jpg';
         $this->checkExistingUserInformation($weiboId, $user_info);
     } else {
         if (is_weixin_browser() && $type == 'weixin') {
             //
             //如果是在微信浏览器点击通过微信登录
             $url = createOauthUrlForCode('http://' . $_SERVER['HTTP_HOST'] . U('Home/loginByWechatinMobile'));
             header('Location: ' . $url);
         } else {
             empty($type) && $this->error('参数错误');
             //加载ThinkOauth类并实例化一个对象
             import("Org.ThinkSDK.ThinkOauth");
             $sns = \ThinkOauth::getInstance($type);
             //跳转到授权页面
             redirect($sns->getRequestCodeURL());
         }
     }
 }
 public function wxMobile()
 {
     $url = createOauthUrlForCode('http://' . $_SERVER['HTTP_HOST'] . U('Payment/wxjsapi', 'orderNumber=' . I('orderNumber')));
     header('Location: ' . $url);
 }