diff --git a/backend/app.py b/backend/app.py index 9bed1ca..49fb4f4 100644 --- a/backend/app.py +++ b/backend/app.py @@ -3023,6 +3023,7 @@ def api_member_history(phone): 'mileage': None, 'purchases': [], # 전체 구매 이력 'prescriptions': [], # 조제 이력 + 'interests': [], # 관심 상품 (AI 업셀링) 'pos_customer': None } @@ -3083,6 +3084,28 @@ def api_member_history(phone): 'member_since': user['created_at'], 'transactions': tx_list } + + # 관심 상품 조회 (AI 업셀링에서 '관심있어요' 표시한 것) + cursor.execute(""" + SELECT + id, recommended_product, recommendation_message, + recommendation_reason, trigger_products, created_at + FROM ai_recommendations + WHERE user_id = ? AND status = 'interested' + ORDER BY created_at DESC + LIMIT 20 + """, (user_id,)) + interests = cursor.fetchall() + + result['interests'] = [{ + 'id': i['id'], + 'product': i['recommended_product'], + 'message': i['recommendation_message'], + 'reason': i['recommendation_reason'], + 'trigger_products': i['trigger_products'], + 'created_at': i['created_at'] + } for i in interests] + except Exception as e: logging.warning(f"마일리지 조회 실패: {e}") diff --git a/backend/templates/admin_members.html b/backend/templates/admin_members.html index 4d5718c..d9b650d 100644 --- a/backend/templates/admin_members.html +++ b/backend/templates/admin_members.html @@ -613,6 +613,7 @@