From eeb3b753f2104ccc5dae99549c74867b10a58534 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 26 Nov 2021 13:49:12 +0800 Subject: [PATCH] 1 --- .../controller/BaseAuthedController.class.php | 2 +- webapp/controller/BaseController.class.php | 22 +++++++++---------- webapp/index.php | 18 +-------------- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 0360966..6d2b8ef 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -10,7 +10,7 @@ class BaseAuthedController extends BaseController { private $sessionId = ''; private $mysqlConn = null; - public function handlePre() + public function _handlePre() { $this->accountId = $_REQUEST['account_id']; $this->sessionId = $_REQUEST['session_id']; diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index 63375c6..db19c8f 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -13,30 +13,30 @@ class BaseController { $this->nowtime = phpcommon\getNowTime(); } - public function handlePre() + public function _handlePre() { } - public function handlePost() + public function _handlePost() { } - public function getNowTime() + public function _getNowTime() { return $this->nowtime; } - public function getNowDaySeconds() + public function _getNowDaySeconds() { return phpcommon\getDaySeconds($this->nowtime); } - public function getTodayRemainSeconds() + public function _getTodayRemainSeconds() { return max(0, $this->getNowDaySeconds() + 3600 * 24 - $this->getNowTime()); } - public function rspErr($errcode, $errmsg) + public function _rspErr($errcode, $errmsg) { echo json_encode(array( 'errcode' => $errcode, @@ -44,7 +44,7 @@ class BaseController { )); } - public function rspOk() + public function _rspOk() { echo json_encode(array( 'errcode' => 0, @@ -52,7 +52,7 @@ class BaseController { )); } - public function rspDataOld($data) + public function _rspDataOld($data) { echo json_encode(array( 'errcode' => 0, @@ -61,7 +61,7 @@ class BaseController { )); } - public function rspData($data) + public function _rspData($data) { $rawData = array( 'errcode' => 0, @@ -73,12 +73,12 @@ class BaseController { echo json_encode($rawData); } - public function rspRawData($rawData) + public function _rspRawData($rawData) { echo json_encode($rawData); } - public function getExplode($string) + public function _getExplode($string) { $delim = "|"; $drop_multiply = explode($delim, $string); diff --git a/webapp/index.php b/webapp/index.php index ca9ae65..31c0274 100644 --- a/webapp/index.php +++ b/webapp/index.php @@ -15,22 +15,7 @@ function autoload_controller__($classname) } spl_autoload_register('autoload_controller__'); -function loginVerify($accountid, $sessionid) -{ - if (!phpcommon\isValidSessionId($accountid, $sessionid)) { - return false; - } - return true; -} - $rewriteRule = array( - 'NGun' => 'Gun', - 'Property' => 'Role', - 'NBag' => 'Bag', - 'NHero' => 'Hero', - 'NPlayer' => 'Role', - 'NPlayerInfo' => 'Role', - 'NRank' => 'Rank', ); function getRewriteClass($oldC) @@ -48,8 +33,7 @@ try{ $c = getRewriteClass($c); $classname = $c .'Controller'; $beginTick = phpcommon\getTickCount(); - $obj = eval('$obj = new $classname(); $obj->handlePre(); $obj->$a(); $obj->handlePost();'); - //error_log('c=' . $_REQUEST['c'] . ' a=' . $_REQUEST['a'] . ' costtime:' . (phpcommon\getTickCount() - $beginTick)); + $obj = eval('$obj = new $classname(); $obj->_handlePre(); $obj->$a(); $obj->_handlePost();'); } catch (Exception $e){ echo($e); }