更新增加统计【活动期间输赢总数据】

This commit is contained in:
2026-07-27 15:41:31 +08:00
parent f2543b9aa4
commit f91eb186ca
19 changed files with 375 additions and 122 deletions

View File

@@ -30,6 +30,7 @@ class PlayxConfig extends Backend
$payload = $row->toArray();
$payload['active_mall_open_date'] = MallPointsConversion::resolveActiveMallOpenDate($row);
$payload['active_event_end_date'] = MallPointsConversion::resolveActiveEventEndDate($row);
return $this->success('', [
'row' => $payload,
@@ -75,6 +76,10 @@ class PlayxConfig extends Backend
}
$mallOpenDate = MallPointsConversion::normalizeDate($data['mall_open_date'] ?? null);
$mallEventEndDate = MallPointsConversion::normalizeDate($data['mall_event_end_date'] ?? null);
if ($mallOpenDate !== null && $mallEventEndDate !== null && $mallEventEndDate < $mallOpenDate) {
return $this->error(__('Event end date cannot be earlier than start date'));
}
$row = MallBusinessConfig::order('id', 'asc')->find();
$now = time();
@@ -90,6 +95,9 @@ class PlayxConfig extends Backend
'mall_open_date' => $mallOpenDate,
'mall_open_date_previous' => null,
'mall_open_date_effective_on' => $effectiveOn,
'mall_event_end_date' => $mallEventEndDate,
'mall_event_end_date_previous' => null,
'mall_event_end_date_effective_on' => MallPointsConversion::nextCalendarDate(),
'create_time' => $now,
'update_time' => $now,
]);
@@ -98,6 +106,10 @@ class PlayxConfig extends Backend
$currentPending = MallPointsConversion::normalizeDate($row->mall_open_date ?? null);
$openDateChanged = $mallOpenDate !== $currentPending;
$previousEnd = MallPointsConversion::resolveActiveEventEndDate($row);
$currentPendingEnd = MallPointsConversion::normalizeDate($row->mall_event_end_date ?? null);
$endDateChanged = $mallEventEndDate !== $currentPendingEnd;
$row->return_ratio = $returnF;
$row->unlock_ratio = $unlockF;
$row->points_to_cash_ratio = $cashF;
@@ -111,6 +123,12 @@ class PlayxConfig extends Backend
$row->mall_open_date_effective_on = $mallOpenDate !== null ? MallPointsConversion::nextCalendarDate() : null;
}
if ($endDateChanged) {
$row->mall_event_end_date_previous = $previousEnd;
$row->mall_event_end_date = $mallEventEndDate;
$row->mall_event_end_date_effective_on = MallPointsConversion::nextCalendarDate();
}
$row->save();
}