From 1e9fa161f2fac9447aaf1964879b4a2856d6b18c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 21 Jan 2021 11:18:19 +0800 Subject: [PATCH] 1 --- .../controller/ActivityController.class.php | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index 52e8e6c..db0172b 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -5,6 +5,7 @@ require 'classes/AddReward.php'; class ActivityController{ + private $actTableCache = null; protected function getMysql($account_id) { $mysql_conf = getMysqlConfig(crc32($account_id)); @@ -87,8 +88,10 @@ class ActivityController{ protected function getLottery($lot_id) { - $g_conf_lot_cluster = require('../res/lottery@lottery.php'); - $lot_conf = getLotteryConfig($g_conf_lot_cluster, $lot_id); + if ($this->actTableCache == null) { + $this->actTableCache = require('../res/lottery@lottery.php'); + } + $lot_conf = getLotteryConfig($this->actTableCache, $lot_id); $l = array( 'id' => $lot_conf['id'], 'item_id' => $lot_conf['item_id'], @@ -350,23 +353,7 @@ class ActivityController{ )); } } - for ($i1 = 0; $i1 < count($lot_array); $i1++) { - $l = $this->getLottery($lot_array[$i1]['key']); - $weight_sum += $l['jilv']; - } - $random = Rand(0, 100); - if ($random >= 50) { - $key = $lot_array[0]['key']; - } else { - $key = $lot_array[1]['key']; - } - } else if ($row['free_times'] + $row['video_times'] + 1 == 6) { - foreach ($user_db['draw_list'] as $draw) { - if (isset($draw['status']) && $draw['status'] != 0) { - continue; - } - $key = $draw['key'] + 1; - } + $key = $lot_array[0]['key']; } else { foreach ($user_db['draw_list'] as $draw) { if (isset($draw['status']) && $draw['status'] != 0) {