diff --git a/webapp/controller/BcShopController.class.php b/webapp/controller/BcShopController.class.php index 43d24e2f..2e004c80 100644 --- a/webapp/controller/BcShopController.class.php +++ b/webapp/controller/BcShopController.class.php @@ -1,7 +1,5 @@ _getNowTime() > $meta['start_time']) { + return $meta; + } + } + return $currentMeta; + } + + public static function getCountdown($meta) + { + $countdown = max(0, $currBatchMeta['start_time'] - myself()->_getNowTime()); + return $countdown; + } + + protected static function getMetaList() + { + if (!self::$metaList) { + self::$metaList = getMetaTable('batch@bcshop.php'); + } + return self::$metaList; + } + + protected static function mustBeSortedList() + { + if (!self::$sortedList) { + self::$sortedList = array(); + foreach (self::getMetaList() as $meta) { + array_push(self::$sortedList, $meta); + } + usort(self::$sortedList, function ($a, $b) { + if ($a['start_time'] == $b['start_time']) { + die(json_encode(array( + 'errcode' => 500, + 'errmsg' => 'server internal error' + ))); + } + return $a['start_time'] < $b['start_time']; + }); + } + } + + protected static $metaList; + protected static $sortedList; + +} diff --git a/webapp/mt/BcShopGoods.php b/webapp/mt/BcShopGoods.php new file mode 100644 index 00000000..acb6c354 --- /dev/null +++ b/webapp/mt/BcShopGoods.php @@ -0,0 +1,2 @@ +