From f88386bbb7df3feb75d133c00e98da5814b4d26f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 15 Jan 2021 14:16:29 +0800 Subject: [PATCH] 1 --- webapp/classes/AddReward.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webapp/classes/AddReward.php b/webapp/classes/AddReward.php index 49dccccc..efb75f7c 100644 --- a/webapp/classes/AddReward.php +++ b/webapp/classes/AddReward.php @@ -5,6 +5,9 @@ namespace classes; use phpcommon; class AddReward { + + private $itemTableCache = null; + protected function getMysql($account_id) { $mysql_conf = getMysqlConfig(crc32($account_id)); @@ -20,8 +23,10 @@ class AddReward { protected function getItem($item_id) { - $g_conf_item_cluster = require('../res/item@item.php'); - $item_conf = getItemConfig($g_conf_item_cluster, $item_id); + if ($this->itemTableCache == null) { + $this->itemTableCache = require('../res/item@item.php'); + } + $item_conf = getItemConfig($this->itemTableCache, $item_id); $it = array( 'id' => $item_conf['id'], 'diamond' => $item_conf['diamond'], @@ -95,6 +100,7 @@ class AddReward { if (!$i['type']) { return array(); } + error_log('type:' . $i['type']); if ($i['type'] == 1){ $this->addCoin($item['item_id'], $item['item_num'], $account_id); } else if ($i['type'] == 2) { @@ -356,6 +362,7 @@ class AddReward { protected function addweizhuang($item_id, $item_num, $accountid) { + $beginTick = phpcommon\getTickCount(); $conn = $this->getMysql($accountid); if (!$conn) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); @@ -424,6 +431,7 @@ class AddReward { die(); } } + error_log('weizhuan3:' . phpcommon\getTickCount() . ' costime:' . (phpcommon\getTickCount() - $beginTick)) ; } protected function addticket($item_id, $item_num, $accountid)