mobile . themes
This commit is contained in:
38
app.py
38
app.py
@@ -4130,6 +4130,24 @@ def api_remove_chat_member(room_id, uid):
|
||||
socketio.emit('room_updated', {'room_id': room_id}, room=f'room_{room_id}')
|
||||
return jsonify({'success': True})
|
||||
|
||||
@app.route('/api/chat/rooms/<int:room_id>/dissolve', methods=['POST'])
|
||||
@login_required
|
||||
def api_dissolve_room(room_id):
|
||||
"""解散群聊(仅群主)"""
|
||||
user_id = session['user']['id']
|
||||
room = ChatRoom.query.get_or_404(room_id)
|
||||
if room.type == 'private':
|
||||
return jsonify({'success': False, 'message': '不能解散私聊'}), 400
|
||||
if room.creator_id != user_id:
|
||||
return jsonify({'success': False, 'message': '只有群主才能解散群聊'}), 403
|
||||
# 删除所有成员、消息、群聊
|
||||
ChatRoomMember.query.filter_by(room_id=room_id).delete()
|
||||
Message.query.filter_by(room_id=room_id).delete()
|
||||
db.session.delete(room)
|
||||
db.session.commit()
|
||||
socketio.emit('room_dissolved', {'room_id': room_id}, room=f'room_{room_id}')
|
||||
return jsonify({'success': True, 'message': '群聊已解散'})
|
||||
|
||||
@app.route('/api/chat/rooms/<int:room_id>/read', methods=['POST'])
|
||||
@login_required
|
||||
def api_mark_chat_read(room_id):
|
||||
@@ -4920,10 +4938,10 @@ def admin_export_users():
|
||||
users = User.query.order_by(User.created_at.desc()).all()
|
||||
output = export_users_to_excel(users)
|
||||
|
||||
filename = f"用户数据_{datetime.now().strftime('%Y%m%d_%H%M%S')}.xlsx"
|
||||
filename = f"用户数据_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv"
|
||||
return send_file(
|
||||
output,
|
||||
mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
mimetype='text/csv; charset=utf-8',
|
||||
as_attachment=True,
|
||||
download_name=filename
|
||||
)
|
||||
@@ -4938,10 +4956,10 @@ def admin_export_exams():
|
||||
exams = Exam.query.order_by(Exam.created_at.desc()).all()
|
||||
output = export_exams_to_excel(exams)
|
||||
|
||||
filename = f"考试数据_{datetime.now().strftime('%Y%m%d_%H%M%S')}.xlsx"
|
||||
filename = f"考试数据_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv"
|
||||
return send_file(
|
||||
output,
|
||||
mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
mimetype='text/csv; charset=utf-8',
|
||||
as_attachment=True,
|
||||
download_name=filename
|
||||
)
|
||||
@@ -4956,10 +4974,10 @@ def admin_export_submissions():
|
||||
submissions = Submission.query.order_by(Submission.submitted_at.desc()).all()
|
||||
output = export_submissions_to_excel(submissions)
|
||||
|
||||
filename = f"提交记录_{datetime.now().strftime('%Y%m%d_%H%M%S')}.xlsx"
|
||||
filename = f"提交记录_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv"
|
||||
return send_file(
|
||||
output,
|
||||
mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
mimetype='text/csv; charset=utf-8',
|
||||
as_attachment=True,
|
||||
download_name=filename
|
||||
)
|
||||
@@ -4974,10 +4992,10 @@ def admin_export_contests():
|
||||
contests = Contest.query.order_by(Contest.created_at.desc()).all()
|
||||
output = export_contests_to_excel(contests)
|
||||
|
||||
filename = f"杯赛数据_{datetime.now().strftime('%Y%m%d_%H%M%S')}.xlsx"
|
||||
filename = f"杯赛数据_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv"
|
||||
return send_file(
|
||||
output,
|
||||
mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
mimetype='text/csv; charset=utf-8',
|
||||
as_attachment=True,
|
||||
download_name=filename
|
||||
)
|
||||
@@ -4992,10 +5010,10 @@ def admin_export_posts():
|
||||
posts = Post.query.order_by(Post.created_at.desc()).all()
|
||||
output = export_posts_to_excel(posts)
|
||||
|
||||
filename = f"论坛帖子_{datetime.now().strftime('%Y%m%d_%H%M%S')}.xlsx"
|
||||
filename = f"论坛帖子_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv"
|
||||
return send_file(
|
||||
output,
|
||||
mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
mimetype='text/csv; charset=utf-8',
|
||||
as_attachment=True,
|
||||
download_name=filename
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user