diff --git a/webapp/bootstrap/constant.php b/webapp/bootstrap/constant.php index aab950e3..76458d5d 100644 --- a/webapp/bootstrap/constant.php +++ b/webapp/bootstrap/constant.php @@ -3,6 +3,7 @@ define('TEAMID_KEY', 'team_uuid:'); define('RANKING_KEY', 'game2006api:'); define('DAILY_SELECTION_KEY', 'game2006api:daily_selection:'); +define('PLANET_BUY_KEY', 'game2006api:planet_buy:'); define('LAST_SESSION_KEY', 'last_session:'); diff --git a/webapp/controller/OutAppPlanetController.class.php b/webapp/controller/OutAppPlanetController.class.php index 69edda92..8c372057 100644 --- a/webapp/controller/OutAppPlanetController.class.php +++ b/webapp/controller/OutAppPlanetController.class.php @@ -50,4 +50,18 @@ class OutAppPlanetController extends BaseController { } + private function load($period) + { + $rawData = myself()->_getRedis('')->get(PLANET_BUY_KEY . $period); + if (empty($rawData)) { + return array(); + } + return json_decode($rawData, true); + } + + private function save($data) + { + myself()->_getRedis('')->get(PLANET_BUY_KEY . $period, json_encode($data)); + } + }