<?php
/*
 +----------------------------------------------------------------------
 | TEMMOKUMVC [ NO BEST, ONLY BETTER ]
 +----------------------------------------------------------------------
 | Copyright (c) 2018~2019 https://www.temmoku.cn All rights reserved.
 +----------------------------------------------------------------------
 | Author: 张宗强 Email:webmaster@temmoku.cn QQ:158726877 516669373 TEL:17895221001 微信:temmokumvc
 +---------------------------------------------------------------------- 
*/
namespace user\controller;
use temmoku\user;
class bind extends user{
	
	public function index(){
		$this->display(tpl('bind/index'));
		
		$this->display(tpl('foot'));
	}
	
	public function go_to(){
		$_GET['name']=strtolower($_GET['name']);
		if(!$_GET['name'] ){
			$this->err('缺少参数');
		}
		
		if($_GET['name']=='wechat'){
			header("location:".WEBURL."/wechat/bind/index");
			exit;
		}

		//加载配置
		$login_list_file=APP_PATH."plugin/login/conf/more_login_list.php";
		if(is_file($login_list_file)){
			extract(include_once $login_list_file);
		}
		$son_method=$_GET['login_m'] ? strtolower($_GET['login_m']) :'index';
		define('user_login_url',WEBURL.'/user/bind/go_to/name/'.$_GET['name']."/");
		
		$file= APP_PATH."plugin/login/vendor/".$_GET['name']."/user/bind.php";
	    if(!is_file($file)){
	    	$this->err('暂无绑定方法，等待开发1');
	    }
	    @include_once $file;
		$Modular_Class= "plugin\\login\\vendor\\".$_GET['name']."\\user\\bind";
		
		if (class_exists($Modular_Class)) {
			
		    //加载类
		    $Class=new $Modular_Class($more_login_list[$_GET['name']]);
		    //加载方法
		    Load_Method($Class,$son_method,$Modular_Class);
		}else{
			$this->err('暂无绑定方法，等待开发');
		}
	}
}
?>