feat: 바텀시트 '관심있어요' 버튼 분리 — interested 상태 DB 저장 + 어드민 표시
- "관심있어요!" 클릭 → status='interested' (기존: dismissed와 동일했음) - "다음에요" / 드래그 닫기 → status='dismissed' - dismiss API에 action 파라미터 추가 - AI CRM 대시보드: interested 배지(주황) + 통계 카드 반영 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2012,15 +2012,21 @@ def api_get_recommendation(user_id):
|
||||
|
||||
@app.route('/api/recommendation/<int:rec_id>/dismiss', methods=['POST'])
|
||||
def api_dismiss_recommendation(rec_id):
|
||||
"""추천 닫기"""
|
||||
"""추천 닫기 / 관심 표시"""
|
||||
data = request.get_json(silent=True) or {}
|
||||
action = data.get('action', 'dismissed')
|
||||
if action not in ('dismissed', 'interested'):
|
||||
action = 'dismissed'
|
||||
|
||||
conn = db_manager.get_sqlite_connection()
|
||||
cursor = conn.cursor()
|
||||
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
cursor.execute("""
|
||||
UPDATE ai_recommendations SET status = 'dismissed', dismissed_at = ?
|
||||
UPDATE ai_recommendations SET status = ?, dismissed_at = ?
|
||||
WHERE id = ?
|
||||
""", (now, rec_id))
|
||||
""", (action, now, rec_id))
|
||||
conn.commit()
|
||||
logging.info(f"[AI추천] id={rec_id} → {action}")
|
||||
return jsonify({'success': True})
|
||||
|
||||
|
||||
@@ -2100,6 +2106,7 @@ def admin_ai_crm():
|
||||
SELECT
|
||||
COUNT(*) as total,
|
||||
SUM(CASE WHEN status = 'active' AND (expires_at IS NULL OR expires_at > datetime('now')) THEN 1 ELSE 0 END) as active_count,
|
||||
SUM(CASE WHEN status = 'interested' THEN 1 ELSE 0 END) as interested_count,
|
||||
SUM(CASE WHEN status = 'dismissed' THEN 1 ELSE 0 END) as dismissed_count,
|
||||
SUM(CASE WHEN displayed_count > 0 THEN 1 ELSE 0 END) as displayed_count
|
||||
FROM ai_recommendations
|
||||
|
||||
Reference in New Issue
Block a user