<?php
namespace Addons\QyWechat\Controller\Admin;

use Models\BaseModel as Model;
use Session;
use Addons\QyWechat\Helper;
use Addons\QyWechat\Services\QyWechatApi;
use Addons\QyWechat\Services\ProvidersApi;

class Providers extends \BaseController
{	
    public function finish_auth(){
		if(!$_GET['auth_code']){
			return '授权失败!';
		}
		$auth_code = $_GET['auth_code'];
		$ProvidersApi = ProvidersApi::getInstance();
		$get_permanent_code = $ProvidersApi->get_permanent_code($auth_code);
		
		if($get_permanent_code){
			return \Redirect::to('/admin/main.html');
		}else{
			return '授权失败!';
		}
	}	
}