feat: 생년월일 필드 추가 + 카카오 스코프 확장 + 채널 연동 문서
- signup.html: 수집 목적 안내 카드, 생년월일(선택) 필드, 필수/선택 배지 - app.py: /api/signup에 birthday 처리, get_or_create_user birthday 파라미터 - mileage_schema.sql: users 테이블 birthday 컬럼 추가 - dbsetup.py: 기존 DB 마이그레이션 (ALTER TABLE ADD birthday) - kakao_client.py: scope에 phone_number,birthday,birthyear 추가 - privacy.html: 항목별 수집 목적 테이블, 필수/선택 구분, 9항 신설 - kakao-phone-request.md: 전화번호+생일 스코프 신청 사유 문서 - kakao-channel-integration.md: 채널 API 분석 및 알림톡 로드맵 - kakao-chanell-rest-api.md: 카카오 채널 REST API 원문 참고 문서 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -366,13 +366,14 @@ def verify_claim_token(transaction_id, nonce):
|
||||
return (False, f"토큰 검증 실패: {str(e)}", None)
|
||||
|
||||
|
||||
def get_or_create_user(phone, name):
|
||||
def get_or_create_user(phone, name, birthday=None):
|
||||
"""
|
||||
사용자 조회 또는 생성 (간편 적립용)
|
||||
|
||||
Args:
|
||||
phone (str): 전화번호
|
||||
name (str): 이름
|
||||
birthday (str, optional): 생년월일 (YYYY-MM-DD)
|
||||
|
||||
Returns:
|
||||
tuple: (user_id, is_new_user)
|
||||
@@ -388,13 +389,17 @@ def get_or_create_user(phone, name):
|
||||
user = cursor.fetchone()
|
||||
|
||||
if user:
|
||||
# 기존 유저: birthday가 제공되면 업데이트
|
||||
if birthday:
|
||||
cursor.execute("UPDATE users SET birthday = ? WHERE id = ?", (birthday, user['id']))
|
||||
conn.commit()
|
||||
return (user['id'], False)
|
||||
|
||||
# 신규 생성
|
||||
cursor.execute("""
|
||||
INSERT INTO users (nickname, phone, mileage_balance)
|
||||
VALUES (?, ?, 0)
|
||||
""", (name, phone))
|
||||
INSERT INTO users (nickname, phone, birthday, mileage_balance)
|
||||
VALUES (?, ?, ?, 0)
|
||||
""", (name, phone, birthday))
|
||||
|
||||
conn.commit()
|
||||
return (cursor.lastrowid, True)
|
||||
@@ -550,6 +555,7 @@ def api_signup():
|
||||
data = request.get_json()
|
||||
name = data.get('name', '').strip()
|
||||
phone = data.get('phone', '').strip().replace('-', '').replace(' ', '')
|
||||
birthday = data.get('birthday', '').strip() or None # 선택 항목
|
||||
|
||||
if not name or not phone:
|
||||
return jsonify({'success': False, 'message': '이름과 전화번호를 모두 입력해주세요.'}), 400
|
||||
@@ -557,7 +563,7 @@ def api_signup():
|
||||
if len(phone) < 10:
|
||||
return jsonify({'success': False, 'message': '올바른 전화번호를 입력해주세요.'}), 400
|
||||
|
||||
user_id, is_new = get_or_create_user(phone, name)
|
||||
user_id, is_new = get_or_create_user(phone, name, birthday=birthday)
|
||||
|
||||
# 세션에 유저 정보 저장
|
||||
session.permanent = True
|
||||
|
||||
Reference in New Issue
Block a user