This commit is contained in:
aozhiwei 2022-02-08 11:36:44 +08:00
parent 0d321a3d82
commit ba3a85264e
2 changed files with 28 additions and 27 deletions

View File

@ -102,12 +102,6 @@ class MarketController extends BaseController {
$type = getReqVal('type', 0);
$sort = getReqVal('sort', '');
$currBatchMeta = mt\MarketBatch::getCurrentBatch();
if (!$currBatchMeta) {
myself()->_rspErr(500, 'server internal error');
return;
}
$perPage = 10000;
$rows = array();
$pageInfo = array(
@ -118,6 +112,15 @@ class MarketController extends BaseController {
'total_pages' => 0
);
$currBatchMeta = mt\MarketBatch::getCurrentBatch();
if (!$currBatchMeta) {
myself()->_rspData(array(
'rows' => $rows,
'page' => $pageInfo,
));
return;
}
$batchMetas = mt\MarketGoods::getBatchMetas($currBatchMeta['batch_id']);
if ($batchMetas) {
foreach ($batchMetas as $meta) {

View File

@ -1,6 +1,7 @@
<?php
require '../config/config.php';
require '../config/routes.php';
require 'bootstrap/init.php';
if (empty($_REQUEST['c']) || empty($_REQUEST['a'])) {
@ -8,12 +9,6 @@ if (empty($_REQUEST['c']) || empty($_REQUEST['a'])) {
return;
}
if ($_REQUEST['c'] != 'Market') {
die();
return;
}
function autoload_controller__($classname)
{
require_once "controller/$classname.class.php";
@ -21,25 +16,28 @@ function autoload_controller__($classname)
}
spl_autoload_register('autoload_controller__');
$rewriteRule = array(
);
function getRewriteClass($oldC)
{
global $rewriteRule;
if (isset($rewriteRule[$oldC])) {
return $rewriteRule[$oldC];
}
return $oldC;
}
try{
$c = $_REQUEST['c'];
$a = $_REQUEST['a'];
$c = getRewriteClass($c);
if (!empty($gOnlyRoutes) && !getXVal($gOnlyRoutes, $c, null)) {
die();
return;
}
if (!empty($gExcludeRoutes) && getXVal($gExcludeRoutes, $c, null)) {
die();
return;
}
$classname = $c .'Controller';
$beginTick = phpcommon\getTickCount();
$obj = eval('$obj = new $classname(); $obj->_handlePre(); $obj->$a(); $obj->_handlePost();');
$obj = eval('return new $classname();');
$method = new ReflectionMethod($classname, $a);
if ($method && $method->isPublic() &&
$a[0] != '_' &&
(!$method->isConstructor() && !$method->isDestructor())) {
$obj->_handlePre();
$method->invoke($obj);
$obj->_handlePost();
}
} catch (Exception $e){
echo($e);
error_log($e);
}