feat: 회원 상세 - 관심 상품 탭 추가
- AI 업셀링에서 '관심있어요' 표시한 상품 조회
- status='interested'인 ai_recommendations 조회
- 상품명, 추천 메시지, 구매 상품(트리거) 표시
- 💝 관심 탭 UI 구현
This commit is contained in:
@@ -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}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user