Merge branch 'jihu'

This commit is contained in:
Guan Xiying
2021-07-14 09:48:58 +08:00
84 changed files with 3798 additions and 225 deletions
+7 -14
View File
@@ -18,7 +18,8 @@ define('RUN_MODE', 'api');
ob_start();
/* Load the framework. */
include '../framework/router.class.php';
include '../framework/api/router.class.php';
include '../framework/api/entry.class.php';
include '../framework/control.class.php';
include '../framework/model.class.php';
include '../framework/helper.class.php';
@@ -27,13 +28,13 @@ include '../framework/helper.class.php';
$startTime = getTime();
/* Instance the app. */
$app = router::createApp('pms', dirname(dirname(__FILE__)), 'router');
$app = router::createApp('pms', dirname(dirname(__FILE__)), 'api');
/* Run the app. */
$common = $app->loadCommon();
/* Check entry. */
$common->checkEntry();
if(!$app->version) $common->checkEntry();
$common->loadConfigFromDB();
/* Set default params. */
@@ -41,18 +42,10 @@ $config->requestType = 'GET';
$config->default->view = 'json';
$app->parseRequest();
$common->checkPriv();
if(!$app->version) $common->checkPriv();
$app->loadModule();
$output = json_decode(ob_get_clean());
$data = new stdClass();
$data->status = isset($output->status) ? $output->status : $output->result;
if(isset($output->message)) $data->message = $output->message;
if(isset($output->data)) $data->data = json_decode($output->data);
$output = json_encode($data);
unset($_SESSION['ENTRY_CODE']);
unset($_SESSION['VALID_ENTRY']);
$output = ob_get_clean();
/* Flush the buffer. */
echo helper::removeUTF8Bom($output);
echo helper::removeUTF8Bom($app->formatData($output));