From 0af21b58cf56204ebe99db98894e739a82477af6 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 11 Oct 2024 10:57:29 +0800 Subject: [PATCH] 1 --- webapp/controller/BaseController.class.php | 10 ++++++++++ webapp/models/HashRateShopBuyRecord.php | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index ec521724..1df3c724 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -98,6 +98,16 @@ class BaseController { return phpcommon\getThisMonthFirstDaySeconds($time, $this->timeZone); } + public function _getNextMonthFirstDaySeconds() + { + return phpcommon\getNextMonthFirstDaySeconds($this->_getNowTime(), $this->timeZone); + } + + public function _getNextMonthFirstDaySecondsByTime($time) + { + return phpcommon\getNextMonthFirstDaySeconds($time, $this->timeZone); + } + public function _inTimeRangeStr($beginTimeStr, $endTimeStr) { $beginTimeOffset = myself()->_getDaySecondsOffset(strtotime("2024-6-22 ". $beginTimeStr)); diff --git a/webapp/models/HashRateShopBuyRecord.php b/webapp/models/HashRateShopBuyRecord.php index 95af6857..f194b448 100644 --- a/webapp/models/HashRateShopBuyRecord.php +++ b/webapp/models/HashRateShopBuyRecord.php @@ -41,7 +41,9 @@ class HashRateShopBuyRecord extends BaseModel $row['this_week_buy_times'] = 0; } $monthFirstDaySeconds = myself()->_getMonthFirstDaySeconds(); - if (!($row['last_buy_time'] >= $monthFirstDaySeconds && $row['last_buy_time'] <= $monthFirstDaySeconds)) { + $nextMonthFirstDaySeconds = myself()->_getNextMonthFirstDaySeconds(); + if (!($row['last_buy_time'] >= $monthFirstDaySeconds && + $row['last_buy_time'] <= $nextMonthFirstDaySeconds)) { $row['this_month_buy_times'] = 0; } return $row;