From 61827726dc5c6fc9f282fd989561fc5aa9113548 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 4 Apr 2022 13:35:33 +0800 Subject: [PATCH] 1 --- webapp/controller/BcShopController.class.php | 2 - webapp/mt/BcShopBatch.php | 66 ++++++++++++++++++++ webapp/mt/BcShopGoods.php | 2 + 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 webapp/mt/BcShopBatch.php create mode 100644 webapp/mt/BcShopGoods.php 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 @@ +