From a7f15e2f9bd9486485abe545461ff845b45b06d7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 1 Aug 2024 13:56:40 +0800 Subject: [PATCH] 1 --- .../controller/BigwheelController.class.php | 42 ++++++++++++++++++- webapp/mt/Bigwheel.php | 9 ++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/webapp/controller/BigwheelController.class.php b/webapp/controller/BigwheelController.class.php index c3452eda..196fb071 100644 --- a/webapp/controller/BigwheelController.class.php +++ b/webapp/controller/BigwheelController.class.php @@ -1,6 +1,7 @@ _getModelConstant('MidData', 'BIG_WHEEL_TYPE'); + $key = $this->getMidDataKey(); + $data = $this->getAndCreateData($key); + mt\Bigwheel::traverseMeta( + function ($meta) use(&$data) { + return true; + }); + myself()->_rspData($data); } public function drawS(){ + $key = $this->getMidDataKey(); + $data = $this->getAndCreateData($key); } public function buyS(){ + $key = $this->getMidDataKey(); + $data = $this->getAndCreateData($key); } private function getMidDataKey() { - return myself()->_getServiceConstant(); + return myself()->_getModelConstant('MidData', 'BIG_WHEEL_TYPE'); + } + + private function getAndCreateData($key) + { + $data = myself()->_callModelStatic('MidData', 'getData', $key); + if (!empty($data)) { + $data = json_decode($data, true); + } + if (empty($data)) { + $data = array( + "grid_list" => array() + ); + } + return $data; } } diff --git a/webapp/mt/Bigwheel.php b/webapp/mt/Bigwheel.php index fb7257f0..9d1900fe 100644 --- a/webapp/mt/Bigwheel.php +++ b/webapp/mt/Bigwheel.php @@ -20,5 +20,14 @@ class Bigwheel return self::$metaList; } + public static function traverseMeta($cb) + { + foreach (self::getMetaList() as $meta) { + if (!$cb($meta)) { + break; + } + } + } + protected static $metaList; }