Example #1
0
 /**
  * 开放平台用户绑定帐号
  *
  */
 public function bind()
 {
     $type = $_REQUEST['type'];
     if (!in_array($type, C('OPEN_PLATFORM'))) {
         $this->error('参数错误');
     }
     if (isset($_REQUEST['ac']) && $_REQUEST['ac'] == 'dobind') {
         if ($type == 'sina') {
             include_once DOC_ROOT_PATH . 'Addons/plugins/login/sina.class.php';
             $sina = new sina();
             //关注官方微博
             $sina->follow_office();
             $this->_on_sina_logined();
         } elseif ($type == 'qq') {
             $this->_on_qq_logined();
         } elseif ($type == 'taobao') {
             $this->_on_taobao_logined();
         }
     }
     $nick = '';
     if ($type == 'sina') {
         include_once DOC_ROOT_PATH . 'Addons/plugins/login/sina.class.php';
         $sina = new sina();
         $u_info = $sina->userInfo();
         $nick = $u_info['screen_name'];
     } elseif ($type == 'qq') {
         include_once DOC_ROOT_PATH . 'Addons/plugins/login/qq.class.php';
         $qq = new qq();
         $u_info = $qq->userInfo();
         $nick = $u_info['nickname'];
     } elseif ($type == 'taobao') {
         include_once DOC_ROOT_PATH . 'Addons/plugins/login/tb.class.php';
         $tb = new tb();
         $nick = $tb->get_openid();
     }
     $this->assign('nick', $nick);
     $this->assign('type', $type);
     $this->assign('_hash_', buildFormToken());
     $this->assign('hash', buildFormToken('hash'));
     $this->display();
 }