|
|
@@ -17,6 +17,8 @@ public static class ActivityTokenGranter
|
|
|
public const string PostReason = "ACTIVITY_POST";
|
|
|
public const string CommentReason = "ACTIVITY_COMMENT";
|
|
|
|
|
|
+ private static readonly TimeZoneInfo KstZone = ResolveKst();
|
|
|
+
|
|
|
public static string PostRefIDFor(int postID) => $"activity-post:{postID}";
|
|
|
public static string CommentRefIDFor(int commentID) => $"activity-comment:{commentID}";
|
|
|
|
|
|
@@ -61,7 +63,9 @@ public static class ActivityTokenGranter
|
|
|
// 별도 일일 카운터 엔티티가 없어(MemberDailyRewardCounter 부재) same-day 합계 방식으로 구현한다.
|
|
|
if (config.DailyTokenCap > 0)
|
|
|
{
|
|
|
- var todayStartUtc = DateTime.Now.Date.ToUniversalTime();
|
|
|
+ // 서버 TZ 무관하게 KST 일 경계(자정~익일 자정)를 UTC 범위로 환산해 오늘 지급분을 집계
|
|
|
+ var nowKst = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, KstZone);
|
|
|
+ var todayStartUtc = TimeZoneInfo.ConvertTimeToUtc(DateTime.SpecifyKind(nowKst.Date, DateTimeKind.Unspecified), KstZone);
|
|
|
var tomorrowStartUtc = todayStartUtc.AddDays(1);
|
|
|
|
|
|
var wallet = await db.Wallet.AsNoTracking().Select(c => new { c.WalletKey, c.MemberID }).FirstOrDefaultAsync(c => c.MemberID == memberID, ct);
|
|
|
@@ -113,4 +117,19 @@ public static class ActivityTokenGranter
|
|
|
|
|
|
return entity?.ActivityToken;
|
|
|
}
|
|
|
+
|
|
|
+ private static TimeZoneInfo ResolveKst()
|
|
|
+ {
|
|
|
+ if (TimeZoneInfo.TryFindSystemTimeZoneById("Asia/Seoul", out var tz))
|
|
|
+ {
|
|
|
+ return tz;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (TimeZoneInfo.TryFindSystemTimeZoneById("Korea Standard Time", out tz))
|
|
|
+ {
|
|
|
+ return tz;
|
|
|
+ }
|
|
|
+
|
|
|
+ return TimeZoneInfo.CreateCustomTimeZone("KST", TimeSpan.FromHours(9), "KST", "KST");
|
|
|
+ }
|
|
|
}
|