diff --git a/backend/app.py b/backend/app.py index 7ae0edc..e3f8f7d 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1621,7 +1621,38 @@ def admin_user_detail(user_id): except Exception as interest_error: logging.warning(f"관심상품 조회 실패 (user {user_id}): {interest_error}") - # 8. 응답 생성 + # 8. 반려동물 조회 + pets = [] + try: + cursor.execute(""" + SELECT id, name, species, breed, gender, birth_date, age_months, + weight, photo_url, notes, created_at + FROM pets + WHERE user_id = ? AND is_active = TRUE + ORDER BY created_at DESC + """, (user_id,)) + for row in cursor.fetchall(): + species_label = '강아지 🐕' if row['species'] == 'dog' else ('고양이 🐈' if row['species'] == 'cat' else '기타') + gender_label = '♂ 남아' if row['gender'] == 'male' else ('♀ 여아' if row['gender'] == 'female' else '') + pets.append({ + 'id': row['id'], + 'name': row['name'], + 'species': row['species'], + 'species_label': species_label, + 'breed': row['breed'], + 'gender': row['gender'], + 'gender_label': gender_label, + 'birth_date': row['birth_date'], + 'age_months': row['age_months'], + 'weight': float(row['weight']) if row['weight'] else None, + 'photo_url': row['photo_url'], + 'notes': row['notes'], + 'created_at': utc_to_kst_str(row['created_at']) + }) + except Exception as pet_error: + logging.warning(f"반려동물 조회 실패 (user {user_id}): {pet_error}") + + # 9. 응답 생성 return jsonify({ 'success': True, 'user': { @@ -1647,7 +1678,8 @@ def admin_user_detail(user_id): 'purchases': purchases, 'prescriptions': prescriptions, 'pos_customer': pos_customer, - 'interests': interests + 'interests': interests, + 'pets': pets }) except Exception as e: diff --git a/backend/static/uploads/pets/pet_2_9919f990.jpg b/backend/static/uploads/pets/pet_2_9919f990.jpg new file mode 100644 index 0000000..978bd7f Binary files /dev/null and b/backend/static/uploads/pets/pet_2_9919f990.jpg differ diff --git a/backend/static/uploads/pets/pet_3_53b73509.png b/backend/static/uploads/pets/pet_3_53b73509.png new file mode 100644 index 0000000..8744122 Binary files /dev/null and b/backend/static/uploads/pets/pet_3_53b73509.png differ diff --git a/backend/templates/admin.html b/backend/templates/admin.html index bf0dbf5..d74b6a9 100644 --- a/backend/templates/admin.html +++ b/backend/templates/admin.html @@ -913,6 +913,9 @@ + @@ -1070,6 +1073,53 @@ html += '

💝 관심 상품이 없습니다
마일리지 적립 시 AI 추천에서 "관심있어요"를 누르면 여기에 표시됩니다

'; } + html += ` + + + + `; @@ -1727,6 +1777,13 @@ // KIMS 약물 상호작용 체크 // ═══════════════════════════════════════════════════ + function escapeHtml(text) { + if (!text) return ''; + const div = document.createElement('div'); + div.textContent = text; + return div.innerHTML; + } + async function checkDrugInteraction(drugCodes, preSerial) { // drugCodes가 문자열로 넘어올 수 있음 if (typeof drugCodes === 'string') {