diff --git a/webapp/controller/DailySelectionController.class.php b/webapp/controller/DailySelectionController.class.php index ac3b678c..17f8e8e0 100644 --- a/webapp/controller/DailySelectionController.class.php +++ b/webapp/controller/DailySelectionController.class.php @@ -257,8 +257,7 @@ class DailySelectionController extends BaseAuthedController { private function load() { - $rawData = myself()->_getSelfRedis()->get( - DAILY_SELECTION_KEY . myself()->_getAccountId()); + $rawData = myself()->_getSelfRedis()->get($this->getRedisKey()); if (empty($rawData)) { $this->internalRefresh(false); $this->save(); @@ -272,12 +271,18 @@ class DailySelectionController extends BaseAuthedController { $remainSec = 3600 * 24 - (myself()->_getNowTime() - myself()->_getNowDaySeconds()); $remainSec = max(0, $remainSec); myself()->_getSelfRedis()->set( - DAILY_SELECTION_KEY . myself()->_getAccountId(), + $this->getRedisKey(), json_encode($this->data) ); myself()->_getSelfRedis()->pexpire( - DAILY_SELECTION_KEY . myself()->_getAccountId(), + $this->getRedisKey(), $remainSec * 1000); } + private function getRedisKey() + { + $key = DAILY_SELECTION_KEY . myself()->_getAccountId(); + return $key; + } + }