fix: /admin 사이드바 검색 SQLite 연결 에러 해결
- /admin/search/user: new_connection=True + finally close - /admin/search/product: new_connection=True + finally close - 에러 로깅 강화 (traceback 포함)
This commit is contained in:
parent
87a56d0f6c
commit
1414bb1432
@ -1416,10 +1416,10 @@ def admin_search_user():
|
||||
if not query:
|
||||
return jsonify({'success': False, 'message': '검색어를 입력하세요'}), 400
|
||||
|
||||
conn = db_manager.get_sqlite_connection()
|
||||
cursor = conn.cursor()
|
||||
|
||||
conn = None
|
||||
try:
|
||||
conn = db_manager.get_sqlite_connection(new_connection=True)
|
||||
cursor = conn.cursor()
|
||||
if search_type == 'phone_last':
|
||||
# 전화번호 뒷자리 검색
|
||||
cursor.execute("""
|
||||
@ -1472,10 +1472,18 @@ def admin_search_user():
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
logging.error(f"사용자 검색 실패: {e}\n{traceback.format_exc()}")
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'message': f'검색 실패: {str(e)}'
|
||||
}), 500
|
||||
finally:
|
||||
if conn:
|
||||
try:
|
||||
conn.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@app.route('/admin/search/product')
|
||||
@ -1486,10 +1494,10 @@ def admin_search_product():
|
||||
if not query:
|
||||
return jsonify({'success': False, 'message': '검색어를 입력하세요'}), 400
|
||||
|
||||
conn = db_manager.get_sqlite_connection()
|
||||
cursor = conn.cursor()
|
||||
|
||||
conn = None
|
||||
try:
|
||||
conn = db_manager.get_sqlite_connection(new_connection=True)
|
||||
cursor = conn.cursor()
|
||||
# 1. MSSQL에서 제품명으로 거래번호 찾기
|
||||
session = db_manager.get_session('PM_PRES')
|
||||
|
||||
@ -1560,10 +1568,18 @@ def admin_search_product():
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
logging.error(f"제품 검색 실패: {e}\n{traceback.format_exc()}")
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'message': f'검색 실패: {str(e)}'
|
||||
}), 500
|
||||
finally:
|
||||
if conn:
|
||||
try:
|
||||
conn.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@app.route('/admin/ai-analyze-user/<int:user_id>', methods=['POST'])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user