* Fix token name of API.

This commit is contained in:
zhujinyong
2021-07-19 16:32:05 +08:00
parent d75f650c7e
commit e3605bc30d
2 changed files with 19 additions and 1 deletions
+18
View File
@@ -5,5 +5,23 @@ class ProgramsEntry extends Entry
{
$program = $this->loadController('program', 'browse');
$program->browse();
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$programs = $data->data->programs;
$result = array();
foreach($programs as $program)
{
$result[] = $program;
}
return $this->send(200, $result);
}
if(isset($data->status) and $data->status == 'fail')
{
return $this->sendError(400, $data->message);
}
return $this->sendError(400, 'error');
}
}
+1 -1
View File
@@ -852,7 +852,7 @@ class baseRouter
if(!defined('SESSION_STARTED'))
{
/* If request header has token, use it as session for authentication. */
$this->sessionID = isset($_SERVER['HTTP_TOKEN']) ? session_id($_SERVER['HTTP_TOKEN']) : session_id();
$this->sessionID = isset($_SERVER['HTTP_AUTHORIZATION']) ? session_id($_SERVER['HTTP_AUTHORIZATION']) : session_id();
$sessionName = $this->config->sessionVar;
session_name($sessionName);