ѡ̳

标题: 20180607 处理支付和第三方登录。 [打印本页]

作者: admin    时间: 2018-6-7 15:37
标题: 20180607 处理支付和第三方登录。
预计两天时间完成。也就是这周。 增加oa系统的邮箱。

作者: admin    时间: 2018-6-7 16:10
第三方登陆--QQ登陆
/member/login.php?lang=cn&a=doother&type=qq

        public function doother() {
                global $_M;
                $other = $this->other($_M['form']['type']);
                $other->set_state();
                $url = $other->get_login_url();
                okinfo($url);
        }
public function other($type) {
   global $_M;
   if(!$type){
      okinfo($_M['url']['login'], $_M['word']['membererror4']);
   }
   if($type == 'qq'){
      $other = load::mod_class('user/web/class/qq', 'new');
   }
   if($type == 'weibo'){
      $other = load::mod_class('user/web/class/weibo', 'new');
   }
   if($type == 'weixin'){
      $other = load::mod_class('user/web/class/weixin', 'new');
   }
   return $other;
}
public function set_state(){
   load::sys_class('session', 'new')->set('other_state', random(10));
}
public function get_login_url(){
   global $_M;

   $redirect_uri = $_M['url']['site'].'member/login.php?a=doother_login&type=qq';
   $url .= "https://graph.qq.com/oauth2.0/authorize?";
   $url .= "client_id={$this->appid}";
   $url .= "&redirect_uri=".urlencode($redirect_uri);
   $url .= "&response_type=code";
   $url .= "&scope=get_user_info";   
   $url .= "&state=".$this->get_state();  
   return $url;
}







欢迎光临 ѡ̳ (http://www.sunminxuan.cn/bbs/) Powered by Discuz! X3.4