feat: 添加多个功能模块和工具脚本

- 新增websocket客户端和服务端实现
- 添加图片压缩工具和快速压缩脚本
- 实现学生信息处理相关API
- 添加MQTT客户端和消息处理功能
- 更新.gitignore忽略更多文件类型
- 添加数据库操作工具和示例
- 实现多个测试脚本和工具类
This commit is contained in:
2026-04-13 14:47:50 +08:00
parent 2cfd7c5a08
commit aac9f5934d
87 changed files with 216279 additions and 6519 deletions
+124
View File
@@ -0,0 +1,124 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "b82fd271",
"metadata": {},
"outputs": [],
"source": [
"import pymysql\n",
"import snowflake\n",
"from faker import Faker\n",
"fake = Faker('zh_CN')\n",
"import random\n",
"# 创建数据库连接\n",
"connection = pymysql.connect(\n",
"host='192.168.0.244',\n",
"port=3300,\n",
"user='root',\n",
"password='hxyd1109',\n",
"database='school_server',\n",
"charset='utf8'\n",
")\n",
"# 创建游标对象\n",
"cursor = connection.cursor()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "759c550a",
"metadata": {},
"outputs": [],
"source": [
"def create_table(cursor,result):\n",
" \n",
" data = []\n",
" for i in result:\n",
" list_list = list(i)\n",
" des=cursor.description # 获取表详情,字段名,长度,属性等\n",
" t = \",\".join([item[0] for item in des])\n",
" table_head = t.split(',') # # 查询表列名 用,分割\n",
" \n",
" dict_result = dict(zip(table_head, list_list)) # 打包为元组的列表 再转换为字典\n",
" data.append(dict_result) # 将字典添加到list_result中\n",
" return data"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "977b832d",
"metadata": {},
"outputs": [],
"source": [
"sql='select * from class_attend limit 0,10'"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "0318e673",
"metadata": {},
"outputs": [],
"source": [
"cursor.execute(sql)\n",
"result = cursor.fetchall()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "7af746d4",
"metadata": {},
"outputs": [],
"source": [
"result = create_table(cursor,result)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "5bb61d61",
"metadata": {},
"outputs": [],
"source": [
"sql='''\n",
"UPDATE class_attend \n",
"SET \n",
" class_s_time = DATE_ADD(class_s_time, INTERVAL 28 DAY),\n",
" class_e_time = DATE_ADD(class_e_time, INTERVAL 28 DAY),\n",
" start_time = DATE_ADD(start_time, INTERVAL 28 DAY),\n",
" end_time = DATE_ADD(end_time, INTERVAL 28 DAY),\n",
" attend_date = DATE_ADD(attend_date, INTERVAL 28 DAY),\n",
" class_s_times = DATE_ADD(class_s_times, INTERVAL 28 DAY),\n",
" class_e_times = DATE_ADD(class_e_times, INTERVAL 28 DAY);\n",
"'''\n",
"cursor.execute(sql)\n",
"connection.commit()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}