This commit is contained in:
aozhiwei 2024-10-11 10:55:13 +08:00
parent f883d9c838
commit f2e30a4270
2 changed files with 9 additions and 1 deletions

View File

@ -36,7 +36,8 @@ class HashRateShopBuyRecord extends BaseModel
$row['this_day_buy_times'] = 0;
}
$mondaySeconds = myself()->_getMondaySeconds();
if (!($row['last_buy_time'] >= $mondaySeconds && $row['last_buy_time'] <= $mondaySeconds)) {
if (!($row['last_buy_time'] >= $mondaySeconds &&
$row['last_buy_time'] <= $mondaySeconds + 3600 * 24 * 7)) {
$row['this_week_buy_times'] = 0;
}
$monthFirstDaySeconds = myself()->_getMonthFirstDaySeconds();

View File

@ -80,6 +80,9 @@ class HashRateShopService {
case mt\HashRateShop::DAILY_BUY_LIMIT: {
$buyRecord = getXVal($buyRecordHash, $goodsId);
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + $goodsNum : 1;
error_log(json_encode(array(
'boughtTimes' => $boughtTimes
)));
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $goodsMeta['limit_num']) {
$errCode = 2;
$errMsg = 'Daily purchase limit';
@ -90,6 +93,10 @@ class HashRateShopService {
case mt\HashRateShop::WEEKLY_BUY_LIMIT: {
$buyRecord = getXVal($buyRecordHash, $goodsId);
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + $goodsNum : 1;
error_log(json_encode(array(
'buyRecordHash' =>$buyRecordHash,
'boughtTimes' => $boughtTimes
)));
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $goodsMeta['limit_num']) {
$errCode = 2;
$errMsg = 'Weekly purchase limit reached';