更新增加统计【活动期间输赢总数据】
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class UserAsset extends Backend
|
||||
'today_limit_date',
|
||||
'points_claim_cap',
|
||||
'total_points_claimed',
|
||||
'event_period_win_loss_net',
|
||||
'create_time',
|
||||
'update_time',
|
||||
];
|
||||
|
||||
@@ -27,6 +27,7 @@ return [
|
||||
'Added successfully' => 'Added successfully!',
|
||||
'Deleted successfully' => 'Deleted successfully!',
|
||||
'Parameter error' => 'Parameter error!',
|
||||
'Event end date cannot be earlier than start date' => 'Event end date cannot be earlier than start date',
|
||||
'Lifetime points source is disabled' => 'Lifetime points source is disabled',
|
||||
'Operation completed' => 'Operation completed!',
|
||||
'Lifetime points calculation completed' => 'Lifetime conversion done: %d processed, %d updated, %d skipped',
|
||||
|
||||
@@ -27,6 +27,7 @@ return [
|
||||
'Added successfully' => '添加成功!',
|
||||
'Deleted successfully' => '删除成功!',
|
||||
'Parameter error' => '参数错误!',
|
||||
'Event end date cannot be earlier than start date' => '活动结束日不能早于开始日',
|
||||
'Lifetime points source is disabled' => '终身总输赢积分来源未启用',
|
||||
'Operation completed' => '操作完成!',
|
||||
'Lifetime points calculation completed' => '终身总输赢积分折算完成:共处理 %d 条,更新 %d 条,跳过 %d 条',
|
||||
|
||||
Reference in New Issue
Block a user