前后分离项目使用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

<?php
/**
* 同步登录应用接口
* 2020.01 by xiaowei
*/
require 'idapi_config.php';
require 'idapi_function.php';
if(time() - $_GET['time'] > 3600) {
exit('Authracation has expiried');
}
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
if($_GET["type"]=='login' && $_GET["code"]){
$id_user = id_CKdecrypt($_GET["code"]);
$id_userinfo = $id_user['client'];
if(!$id_user['expires_time']){
exit('err');
}
set_idcookie('fr_id_auth',$_GET['code'],IDCookieOptions());
set_idcookie('fr_id_appname',$_GET['appname'],IDCookieOptions());
set_idcookie('fr_access_token',$id_user['access_token'],IDCookieOptions());
set_idcookie('fr_uid',$id_userinfo['uid'],IDCookieOptions());
set_idcookie('fr_appid',$id_userinfo['appid'],IDCookieOptions());
set_idcookie('fr_expires_time',$id_user['expires_time'],IDCookieOptions());
// 登录数字平台接口
digitLogin($_GET["code"]);
}
if($_GET["type"]=='logout'){
set_idcookie('fr_access_token','',IDCookieOptions(0));
set_idcookie('fr_id_auth','',IDCookieOptions(0));
set_idcookie('fr_id_appname','',IDCookieOptions(0));
set_idcookie('fr_id_userinfo','',IDCookieOptions(0));
set_idcookie('fr_id_addexist_time','',IDCookieOptions(0));
set_idcookie('fr_expires_time','',IDCookieOptions(0));
}
if($_GET["type"]=='userinfo'){
$id_user = id_CKdecrypt($_COOKIE["fr_id_auth"]);
$id_userinfo = $id_user['client'];
id_user_info($id_userinfo['uid'],$id_userinfo['appid'],$id_user['access_token']);
del_access_token();
}
echo 'idapi 3.1';
?>