更新增加统计【活动期间输赢总数据】
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user