feat: 카카오 인증일(kakao_verified_at) 필드 추가

- DB에 kakao_verified_at 컬럼 추가
- link_kakao_identity()에서 최초 연동 시 인증일 기록
- 대시보드 테이블에 실제 인증일 표시
- 기존 카카오 연동 사용자 마이그레이션 완료
This commit is contained in:
thug0bin 2026-02-27 16:31:31 +09:00
parent 159386942e
commit 04b0f3a8ca
2 changed files with 12 additions and 5 deletions

View File

@ -500,7 +500,9 @@ def link_kakao_identity(user_id, kakao_id, kakao_data):
WHERE provider = 'kakao' AND provider_user_id = ?
""", (kakao_id,))
if not cursor.fetchone():
is_new_link = cursor.fetchone() is None
if is_new_link:
# raw_data 제외 (세션 크기 절약)
store_data = {k: v for k, v in kakao_data.items() if k != 'raw_data'}
cursor.execute("""
@ -517,6 +519,11 @@ def link_kakao_identity(user_id, kakao_id, kakao_data):
if kakao_data.get('email'):
updates.append("email = ?")
params.append(kakao_data['email'])
# 카카오 인증일 기록 (최초 연동 시)
if is_new_link:
updates.append("kakao_verified_at = datetime('now')")
if updates:
params.append(user_id)
cursor.execute(f"UPDATE users SET {', '.join(updates)} WHERE id = ?", params)
@ -1840,7 +1847,7 @@ def admin():
# 최근 가입 사용자 (20명)
cursor.execute("""
SELECT id, nickname, phone, mileage_balance, created_at, updated_at
SELECT id, nickname, phone, mileage_balance, created_at, kakao_verified_at
FROM users
ORDER BY created_at DESC
LIMIT 20
@ -1852,7 +1859,7 @@ def admin():
for user in recent_users_raw:
user_dict = dict(user)
user_dict['created_at'] = utc_to_kst_str(user['created_at'])
user_dict['updated_at'] = utc_to_kst_str(user['updated_at']) if user['updated_at'] else None
user_dict['kakao_verified_at'] = utc_to_kst_str(user['kakao_verified_at']) if user['kakao_verified_at'] else None
recent_users.append(user_dict)
# 최근 적립 내역 (50건)

View File

@ -484,8 +484,8 @@
<td class="points-positive">{{ "{:,}".format(user.mileage_balance) }}P</td>
<td>{{ user.created_at[:16].replace('T', ' ') }}</td>
<td>
{% if user.nickname != '고객' %}
<span style="display: inline-flex; align-items: center; gap: 3px; background: #FEE500; color: #3C1E1E; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 10px;">💬 {{ user.updated_at[:10] if user.updated_at else '-' }}</span>
{% if user.kakao_verified_at %}
<span style="display: inline-flex; align-items: center; gap: 3px; background: #FEE500; color: #3C1E1E; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 10px;">💬 {{ user.kakao_verified_at[:10] }}</span>
{% else %}
<span style="display: inline-flex; align-items: center; background: #f1f3f5; color: #868e96; font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 10px;">미인증</span>
{% endif %}