feat(commission): 收益中心新增30天保活状态与秒级动态预警倒计时看板

这个提交包含在:
chen
2026-09-17 20:06:38 +08:00
父节点 29aeb63026
当前提交 7fc169fb6e
共有 3 个文件被更改,包括 673 次插入 和 32 次删除

查看文件

@@ -111,6 +111,35 @@ class IdentityService
}
$available = max(0, (float) $released - (float) $used);
$windowDays = PartnerConfig::activeDays();
$isActive = (new ActiveService())->isActive($agent);
$now = time();
$lastTime = $last ? intval($last) : 0;
$expireTime = 0;
$remainingSeconds = 0;
$daysRemaining = 0;
$activeStatus = 'inactive';
if ($isActive) {
if ($lastTime > 0) {
$orderDay = strtotime(date('Y-m-d 00:00:00', $lastTime));
$expireTime = $orderDay + $windowDays * 86400;
$remainingSeconds = max(0, $expireTime - $now);
$daysRemaining = intval(ceil($remainingSeconds / 86400));
$activeStatus = ($daysRemaining <= 5) ? 'expiring' : 'active';
} else {
$activeStatus = 'active';
$daysRemaining = $windowDays;
$expireTime = $now + $windowDays * 86400;
$remainingSeconds = $windowDays * 86400;
}
} else {
$activeStatus = 'inactive';
$daysRemaining = 0;
$remainingSeconds = 0;
}
$data = is_object($agent) ? $agent->toArray() : $agent;
return array_merge($data, $identity, [
'is_venue' => intval($data['is_venue'] ?? 0),
@@ -124,8 +153,12 @@ class IdentityService
'voucher_released' => self::formatMoney($released),
'voucher_used' => self::formatMoney($used),
'voucher_available' => self::formatMoney($available),
'active_30d' => (new ActiveService())->isActive($agent),
'last_self_order_time' => $last ? intval($last) : 0,
'active_30d' => $isActive,
'active_status' => $activeStatus,
'days_remaining' => $daysRemaining,
'expire_time' => $expireTime,
'expire_seconds' => $remainingSeconds,
'last_self_order_time' => $lastTime,
]);
}
@@ -147,6 +180,11 @@ class IdentityService
'madow_value' => '0.00',
'voucher_available' => '0.00',
'active_30d' => true,
'active_status' => 'inactive',
'days_remaining' => 0,
'expire_time' => 0,
'expire_seconds' => 0,
'last_self_order_time' => 0,
'agent_form' => self::agentFormEnabled(),
'partner_mode' => PartnerConfig::isPartnerMode(),
];
@@ -166,6 +204,11 @@ class IdentityService
'madow_value' => $full['madow_value'],
'voucher_available' => $full['voucher_available'],
'active_30d' => $full['active_30d'],
'active_status' => $full['active_status'] ?? 'inactive',
'days_remaining' => $full['days_remaining'] ?? 0,
'expire_time' => $full['expire_time'] ?? 0,
'expire_seconds' => $full['expire_seconds'] ?? 0,
'last_self_order_time' => $full['last_self_order_time'] ?? 0,
'agent_form' => self::agentFormEnabled(),
'partner_mode' => PartnerConfig::isPartnerMode(),
];