feat(phase2): 사주 AI 해석 무료화 — 결제 게이트 → 로그인 게이트

- page.tsx: hasPaid를 orders 'saju_detail' paid 조회 대신 로그인 여부(!!user)로 산출
- SajuAISection: 미로그인 시 "개편 준비 중" 안내를 /login?next= 유도 CTA로 교체
- analyze fetch가 429(일일 무료 횟수 초과)를 받으면 전용 에러 메시지 표시(재시도 버튼 숨김)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-02 21:36:13 +09:00
parent 5fd7ab8872
commit 26fef53174
2 changed files with 49 additions and 21 deletions

View File

@@ -74,7 +74,8 @@ export default async function SajuResultPage({ searchParams }: PageProps) {
const solarTermIndex = getCurrentSolarTerm(yearNum, monthNum, dayNum);
const solarTermName = getSolarTermName(solarTermIndex);
// ── 결제 여부 + 저장된 AI 해석 + 로또 구독 확인 ─────────────────────
// ── 로그인 여부 + 저장된 AI 해석 + 로또 구독 확인 ─────────────────────
// Phase 2: AI 상세 해석은 결제 게이트 → 로그인 게이트로 전환(무료화, 일일 제한은 API에서 강제)
let hasPaid = false;
let savedInterpretation: string | null = null;
let hasLottoSubscription = false;
@@ -82,12 +83,7 @@ export default async function SajuResultPage({ searchParams }: PageProps) {
const supabase = await createClient();
const { data: { user } } = await supabase.auth.getUser();
if (user) {
// 사주 결제 확인 (anon client — 본인 orders는 RLS 허용 가정)
const { data: order } = await supabase
.from('orders').select('id')
.eq('user_id', user.id).eq('product_id', 'saju_detail').eq('status', 'paid')
.maybeSingle();
hasPaid = !!order;
hasPaid = !!user;
if (hasPaid) {
// 1차: birth_hour 포함 정확한 키로 조회