当前位置: 首页 > news >正文

fastapi+angular停车管理系统可跨域

说明:
我计划用fastapi+angular做一款停车管理系统,支持跨域
1.设计mysql数据库表,
2.建表,添加测试数据,多表查询,
3.在fastapi写接口查询数据,
4.用postman测试,
5.在angular前端展示

效果图:
在这里插入图片描述

用fastapi写4个查询接口
1.查询具体用户的所有停车记录
2.查询当前正在停车的记录,显示车牌,车主姓名,进入时间,车位位置
3.查询所有已结束停车的费用明细表,详细列举车型和费率
4.统计停车场车位的利用率和空闲率

step1:sql

-- 1. 建表语句(6张表)
-- --------------------------------------------------------
-- 用户表
CREATE TABLE users (user_id INT AUTO_INCREMENT PRIMARY KEY,name VARCHAR(50) NOT NULL,phone VARCHAR(20) UNIQUE,email VARCHAR(100) UNIQUE,reg_date DATETIME DEFAULT CURRENT_TIMESTAMP
);-- 车辆表
CREATE TABLE vehicles (vehicle_id INT AUTO_INCREMENT PRIMARY KEY,user_id INT NOT NULL,license_plate VARCHAR(20) UNIQUE NOT NULL,type ENUM('轿车','SUV','卡车','电动车','摩托车'),FOREIGN KEY (user_id) REFERENCES users(user_id)
);-- 车位表
CREATE TABLE parking_spaces (space_id INT AUTO_INCREMENT PRIMARY KEY,zone VARCHAR(10) NOT NULL,  -- 区域(A区/B区等)number VARCHAR(10) NOT NULL, -- 车位编号status ENUM('AVAILABLE','OCCUPIED','MAINTENANCE') DEFAULT 'AVAILABLE',UNIQUE(zone, number)
);-- 收费规则表
CREATE TABLE fee_rules (rule_id INT AUTO_INCREMENT PRIMARY KEY,vehicle_type ENUM('轿车','SUV','卡车','电动车','摩托车'),hourly_rate DECIMAL(8,2) NOT NULL,effective_date DATE NOT NULL
);-- 停车记录表
CREATE TABLE parking_records (record_id INT AUTO_INCREMENT PRIMARY KEY,vehicle_id INT NOT NULL,space_id INT NOT NULL,entry_time DATETIME NOT NULL,exit_time DATETIME,fee DECIMAL(10,2),FOREIGN KEY (vehicle_id) REFERENCES vehicles(vehicle_id),FOREIGN KEY (space_id) REFERENCES parking_spaces(space_id)
);-- 支付记录表(新增)
CREATE TABLE payment_records (payment_id INT AUTO_INCREMENT PRIMARY KEY,record_id INT NOT NULL,amount DECIMAL(10,2) NOT NULL,payment_time DATETIME DEFAULT CURRENT_TIMESTAMP,payment_method ENUM('支付宝','微信','现金','信用卡'),status ENUM('PAID','UNPAID'),FOREIGN KEY (record_id) REFERENCES parking_records(record_id)
);-- 2. 模拟数据(每表至少10条)
-- --------------------------------------------------------
-- 用户表数据
INSERT INTO users (name, phone, email) VALUES('张三', '13800010001', 'zhangsan@park.com'),('李四', '13800010002', 'lisi@park.com'),('王五', '13800010003', 'wangwu@park.com'),('赵六', '13800010004', 'zhaoliu@park.com'),('陈七', '13800010005', 'chenqi@park.com'),('刘八', '13800010006', 'liuba@park.com'),('周九', '13800010007', 'zhoujiu@park.com'),('吴十', '13800010008', 'wushi@park.com'),('郑十一', '13800010009', 'zheng11@park.com'),('孙十二', '13800010010', 'sun12@park.com');-- 车辆表数据
INSERT INTO vehicles (user_id, license_plate, type) VALUES(1, '川A12345', '轿车'),(1, '川A67890', 'SUV'),(2, '赣B12345', '卡车'),(3, '赣C12345', '电动车'),(4, '浙D12345', '摩托车'),(5, '苏E12345', '轿车'),(6, '川F12345', 'SUV'),(7, '湘G12345', '卡车'),(8, '鄂H12345', '电动车'),(9, '鲁J12345', '摩托车'),(10, '晋K12345', '轿车');-- 车位表数据
INSERT INTO parking_spaces (zone, number, status) VALUES('A', '001', 'AVAILABLE'),('A', '002', 'OCCUPIED'),('A', '003', 'MAINTENANCE'),('B', '101', 'AVAILABLE'),('B', '102', 'OCCUPIED'),('C', '201', 'AVAILABLE'),('C', '202', 'OCCUPIED'),('D', '301', 'AVAILABLE'),('D', '302', 'OCCUPIED'),('E', '401', 'MAINTENANCE');INSERT INTO parking_spaces (zone, number, status) VALUES    ('F', '402', 'AVAILABLE');-- 收费规则表数据
INSERT INTO fee_rules (vehicle_type, hourly_rate, effective_date) VALUES('轿车', 5.00, '2024-01-01'),('SUV', 7.50, '2024-01-01'),('卡车', 10.00, '2024-01-01'),('电动车', 3.00, '2024-01-01'),('摩托车', 2.50, '2024-01-01'),('轿车', 6.00, '2024-06-01'),  -- 费率调整('SUV', 8.50, '2024-06-01'),('卡车', 12.00, '2024-06-01'),('电动车', 3.50, '2024-06-01'),('摩托车', 3.00, '2024-06-01');-- 停车记录表数据
INSERT INTO parking_records (vehicle_id, space_id, entry_time, exit_time, fee) VALUES(1, 2, '2024-03-01 08:00:00', '2024-03-01 10:00:00', 10.00),(2, 4, '2024-03-01 09:00:00', '2024-03-01 12:00:00', 22.50),(3, 5, '2024-03-01 10:00:00', '2024-03-01 15:00:00', 50.00),(4, 6, NOW() - INTERVAL 2 HOUR, NULL, NULL),(5, 7, '2024-03-01 11:00:00', '2024-03-01 13:00:00', 5.00),(6, 8, NOW() - INTERVAL 1 HOUR, NULL, NULL),(7, 9, '2024-03-01 14:00:00', '2024-03-01 17:00:00', 25.50),(8, 10, '2024-03-01 15:00:00', '2024-03-01 18:00:00', 36.00),(9, 1, NOW() - INTERVAL 3 HOUR, NULL, NULL),(10, 3, '2024-03-01 16:00:00', '2024-03-01 19:00:00', 18.00);-- 支付记录表数据
INSERT INTO payment_records (record_id, amount, payment_method, status) VALUES(1, 10.00, '支付宝', 'PAID'),(2, 22.50, '微信', 'PAID'),(3, 50.00, '现金', 'PAID'),(5, 5.00, '信用卡', 'PAID'),(7, 25.50, '支付宝', 'PAID'),(8, 36.00, '微信', 'PAID'),(10, 18.00, '信用卡', 'PAID');-- 3. 查询语句(4个核心查询)
-- --------------------------------------------------------
-- 1. 查询具体用户的所有停车记录(例如:张三)
SELECTu.name AS 车主,v.license_plate AS 车牌,CONCAT(p.zone, '-', p.number) AS 车位,pr.entry_time AS 入场时间,pr.exit_time AS 离场时间,pr.fee AS 费用
FROM users uJOIN vehicles v ON u.user_id = v.user_idJOIN parking_records pr ON v.vehicle_id = pr.vehicle_idJOIN parking_spaces p ON pr.space_id = p.space_id
WHERE u.name = '张三';-- 2. 查询当前正在停车的记录
SELECTv.license_plate AS 车牌,u.name AS 车主姓名,pr.entry_time AS 进入时间,CONCAT(p.zone, '-', p.number) AS 车位位置
FROM parking_records prJOIN vehicles v ON pr.vehicle_id = v.vehicle_idJOIN users u ON v.user_id = u.user_idJOIN parking_spaces p ON pr.space_id = p.space_id
WHERE pr.exit_time IS NULL;-- 3. 已结束停车的费用明细表
SELECTv.type AS 车型,fr.hourly_rate AS 费率,TIMESTAMPDIFF(HOUR, pr.entry_time, pr.exit_time) AS 停车小时,pr.fee AS 总费用,py.payment_method AS 支付方式
FROM parking_records prJOIN vehicles v ON pr.vehicle_id = v.vehicle_idJOIN fee_rules fr ON v.type = fr.vehicle_typeAND pr.entry_time >= fr.effective_dateJOIN payment_records py ON pr.record_id = py.record_id
WHERE pr.exit_time IS NOT NULL;-- 4. 统计车位利用率(每日动态计算)
SELECTCOUNT(*) AS 总车位数,SUM(CASE WHEN status = 'OCCUPIED' THEN 1 ELSE 0 END) AS 已用车位,SUM(CASE WHEN status = 'AVAILABLE' THEN 1 ELSE 0 END) AS 空闲车位,CONCAT(ROUND(SUM(CASE WHEN status = 'OCCUPIED' THEN 1 ELSE 0 END)/COUNT(*)*100,2), '%') AS 利用率,CONCAT(ROUND(SUM(CASE WHEN status = 'AVAILABLE' THEN 1 ELSE 0 END)/COUNT(*)*100,2), '%') AS 空闲率
FROM parking_spaces;

step2: 写路由接口,支持跨域

from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
import pymysql.cursorsapp = FastAPI()# 添加CORS配置
app.add_middleware(CORSMiddleware,allow_origins=["http://localhost:4200"],  # 允许访问的前端域名allow_credentials=True,allow_methods=["*"],  # 允许所有HTTP方法allow_headers=["*"],  # 允许所有请求头
)
# 数据库连接配置(请根据实际情况修改)
DB_CONFIG = {'host': 'localhost','user': 'root','password': '123456','db': 'school_db',  # 修改为实际的数据库名称'charset': 'utf8mb4','cursorclass': pymysql.cursors.DictCursor
}def query_database(query: str, params=None):try:connection = pymysql.connect(**DB_CONFIG)with connection.cursor() as cursor:cursor.execute(query, params)result = cursor.fetchall()connection.close()return resultexcept Exception as e:raise HTTPException(status_code=500, detail=str(e))# 1. 查询具体用户的所有停车记录
@app.get("/user_parking_records/{user_id}")
async def get_user_parking_records(user_id: int):"""获取指定用户的所有停车记录- user_id: 用户ID"""query = """SELECT u.name AS owner,v.license_plate AS license_plate,CONCAT(p.zone, '-', p.number) AS space_location,pr.entry_time AS entry_time,pr.exit_time AS exit_time,pr.fee AS feeFROM users uJOIN vehicles v ON u.user_id = v.user_idJOIN parking_records pr ON v.vehicle_id = pr.vehicle_idJOIN parking_spaces p ON pr.space_id = p.space_idWHERE u.user_id = %s"""data = query_database(query, (user_id,))return {"data": data}# 2. 查询当前正在停车的记录
@app.get("/active_parking_records")
async def get_active_parking_records():"""获取所有正在进行的停车记录"""query = """SELECT v.license_plate AS license_plate,u.name AS owner_name,pr.entry_time AS entry_time,CONCAT(p.zone, '-', p.number) AS space_locationFROM parking_records prJOIN vehicles v ON pr.vehicle_id = v.vehicle_idJOIN users u ON v.user_id = u.user_idJOIN parking_spaces p ON pr.space_id = p.space_idWHERE pr.exit_time IS NULL"""data = query_database(query)return {"data": data}# 3. 查询已结束停车的费用明细
@app.get("/completed_parking_records")
async def get_completed_payments():"""获取所有已完成停车的费用明细"""query = """SELECT v.type AS vehicle_type,fr.hourly_rate AS rate,TIMESTAMPDIFF(HOUR, pr.entry_time, pr.exit_time) AS hours,pr.fee AS total_fee,py.payment_method AS payment_methodFROM parking_records prJOIN vehicles v ON pr.vehicle_id = v.vehicle_idJOIN fee_rules fr ON v.type = fr.vehicle_type AND pr.entry_time >= fr.effective_dateJOIN payment_records py ON pr.record_id = py.record_idWHERE pr.exit_time IS NOT NULL"""data = query_database(query)return {"data": data}# 4. 统计车位利用率
@app.get("/parking_space_utilization")
async def get_parking_space_stats():"""获取车位利用率统计"""query = """SELECT COUNT(*) AS total_spaces,SUM(CASE WHEN status = 'OCCUPIED' THEN 1 ELSE 0 END) AS occupied,SUM(CASE WHEN status = 'AVAILABLE' THEN 1 ELSE 0 END) AS available,ROUND(SUM(CASE WHEN status = 'OCCUPIED' THEN 1 ELSE 0 END)/COUNT(*)*100, 2) AS usage_rate,ROUND(SUM(CASE WHEN status = 'AVAILABLE' THEN 1 ELSE 0 END)/COUNT(*)*100, 2) AS free_rateFROM parking_spaces"""data = query_database(query)return {"data": data[0] if data else {}}if __name__ == "__main__":import uvicornuvicorn.run(app, host="0.0.0.0", port=8000)

step3:后端+mysql部分弄完了,接下来写angular前端部分,下面是postman测试

 查询具体用户的所有停车记录 
查询当前正在停车的记录,显示车牌,车主姓名,进入时间,车位位置
查询所有已结束停车的费用明细表,详细列举车型和费率
统计停车场车位的利用率和空闲率http://localhost:8000/user_parking_records/1{"data": [{"owner": "张三","license_plate": "A12345","space_location": "A-002","entry_time": "2024-03-01T08:00:00","exit_time": "2024-03-01T10:00:00","fee": 10.0},{"owner": "张三","license_plate": "A67890","space_location": "B-101","entry_time": "2024-03-01T09:00:00","exit_time": "2024-03-01T12:00:00","fee": 22.5}]
}http://localhost:8000/active_parking_records{"data": [{"license_plate": "粤C12345","owner_name": "王五","entry_time": "2025-03-07T13:15:43","space_location": "C-201"},{"license_plate": "苏E12345","owner_name": "陈七","entry_time": "2025-03-07T14:15:43","space_location": "D-301"},{"license_plate": "鄂H12345","owner_name": "吴十","entry_time": "2025-03-07T12:15:43","space_location": "A-001"}]
}http://localhost:8000/completed_parking_records
{"data": [{"vehicle_type": "轿车","rate": 5.0,"hours": 2,"total_fee": 10.0,"payment_method": "支付宝"},{"vehicle_type": "SUV","rate": 7.5,"hours": 3,"total_fee": 25.5,"payment_method": "支付宝"},{"vehicle_type": "SUV","rate": 7.5,"hours": 3,"total_fee": 22.5,"payment_method": "微信"},{"vehicle_type": "卡车","rate": 10.0,"hours": 3,"total_fee": 36.0,"payment_method": "微信"},{"vehicle_type": "卡车","rate": 10.0,"hours": 5,"total_fee": 50.0,"payment_method": "现金"},{"vehicle_type": "摩托车","rate": 2.5,"hours": 3,"total_fee": 18.0,"payment_method": "信用卡"},{"vehicle_type": "摩托车","rate": 2.5,"hours": 2,"total_fee": 5.0,"payment_method": "信用卡"}]
}http://localhost:8000/parking_space_utilization{"data": {"total_spaces": 11,"occupied": 4,"available": 5,"usage_rate": 36.36,"free_rate": 45.45}
}

step4:C:\Users\Administrator\WebstormProjects\untitled4\src\app\park\parking.service.ts

// parking.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';@Injectable({providedIn: 'root'
})
export class ParkingService {private apiUrl = 'http://localhost:8000';constructor(private http: HttpClient) { }getUserRecords(userId: number): Observable<any> {return this.http.get(`${this.apiUrl}/user_parking_records/${userId}`);}getActiveRecords(): Observable<any> {return this.http.get(`${this.apiUrl}/active_parking_records`);}getCompletedRecords(): Observable<any> {return this.http.get(`${this.apiUrl}/completed_parking_records`);}getParkingStats(): Observable<any> {return this.http.get(`${this.apiUrl}/parking_space_utilization`);}
}

step5:C:\Users\Administrator\WebstormProjects\untitled4\src\app\park\park.component.ts

import { Component ,OnInit} from '@angular/core';
import { ParkingService } from './parking.service';
import {FormsModule} from '@angular/forms';
import {CurrencyPipe, DatePipe, NgForOf, NgIf} from '@angular/common';@Component({selector: 'app-park',imports: [FormsModule,DatePipe,CurrencyPipe,NgForOf,NgIf],templateUrl: './park.component.html',styleUrl: './park.component.css'
})
export class ParkComponent implements OnInit {userRecords: any[] = [];activeRecords: any[] = [];completedRecords: any[] = [];parkingStats: any = {};selectedUserId: number = 1;constructor(private parkingService: ParkingService) {}ngOnInit() {this.loadAllData();}loadAllData() {this.loadUserRecords();this.loadActiveRecords();this.loadCompletedRecords();this.loadParkingStats();}loadUserRecords() {this.parkingService.getUserRecords(this.selectedUserId).subscribe((res: any) => this.userRecords = res.data);}loadActiveRecords() {this.parkingService.getActiveRecords().subscribe((res: any) => this.activeRecords = res.data);}loadCompletedRecords() {this.parkingService.getCompletedRecords().subscribe((res: any) => this.completedRecords = res.data);}loadParkingStats() {this.parkingService.getParkingStats().subscribe((res: any) => this.parkingStats = res.data);}
}

step6:C:\Users\Administrator\WebstormProjects\untitled4\src\app\park\park.component.html

<!-- app.component.html -->
<div class="container"><!-- 用户选择 --><div class="user-select"><label>选择用户ID: </label><input type="number" [(ngModel)]="selectedUserId" (change)="loadUserRecords()" min="1" max="10"></div><!-- 用户停车记录 --><section><h2>用户停车记录 (ID: {{selectedUserId}})</h2><table *ngIf="userRecords.length > 0"><thead><tr><th>车主</th><th>车牌号</th><th>车位位置</th><th>入场时间</th><th>离场时间</th><th>费用</th></tr></thead><tbody><tr *ngFor="let record of userRecords"><td>{{ record.owner }}</td><td>{{ record.license_plate }}</td><td>{{ record.space_location }}</td><td>{{ record.entry_time | date:'medium' }}</td><td>{{ record.exit_time | date:'medium' }}</td><td>{{ record.fee | currency:'CNY':'symbol' }}</td></tr></tbody></table><p *ngIf="userRecords.length === 0">暂无停车记录</p></section><!-- 当前停车记录 --><section><h2>当前停车记录</h2><table *ngIf="activeRecords.length > 0"><thead><tr><th>车牌号</th><th>车主姓名</th><th>进入时间</th><th>车位位置</th></tr></thead><tbody><tr *ngFor="let record of activeRecords"><td>{{ record.license_plate }}</td><td>{{ record.owner_name }}</td><td>{{ record.entry_time | date: 'yyyy-MM-dd HH:mm' }}</td><td>{{ record.space_location }}</td></tr></tbody></table><p *ngIf="activeRecords.length === 0">当前没有车辆停放</p></section><!-- 完成停车费用 --><section><h2>历史费用明细</h2><table *ngIf="completedRecords.length > 0"><thead><tr><th>车型</th><th>费率 (小时)</th><th>停车时长</th><th>总费用</th><th>支付方式</th></tr></thead><tbody><tr *ngFor="let record of completedRecords"><td>{{ record.vehicle_type }}</td><td>{{ record.rate | currency:'CNY':'symbol' }}</td><td>{{ record.hours }} 小时</td><td>{{ record.total_fee | currency:'CNY':'symbol' }}</td><td>{{ record.payment_method }}</td></tr></tbody></table><p *ngIf="completedRecords.length === 0">暂无历史费用记录</p></section><!-- 车位统计 --><section><h2>车位利用率统计</h2><div class="stats-container" *ngIf="parkingStats.total_spaces"><div class="stat-item"><span class="label">总车位数:</span><span class="value">{{ parkingStats.total_spaces }}</span></div><div class="stat-item"><span class="label">已用车位:</span><span class="value">{{ parkingStats.occupied }}</span></div><div class="stat-item"><span class="label">空闲车位:</span><span class="value">{{ parkingStats.available }}</span></div><div class="stat-item highlight"><span class="label">利用率:</span><span class="value">{{ parkingStats.usage_rate }}%</span></div><div class="stat-item highlight"><span class="label">空闲率:</span><span class="value">{{ parkingStats.free_rate }}%</span></div></div><p *ngIf="!parkingStats.total_spaces">加载统计数据中...</p></section>
</div>

step7:C:\Users\Administrator\WebstormProjects\untitled4\src\app\park\park.component.css

/* app.component.css */
.container {max-width: 1200px;margin: 20px auto;padding: 20px;
}section {margin-bottom: 40px;background: #fff;padding: 20px;border-radius: 8px;box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}h2 {color: #2c3e50;border-bottom: 2px solid #3498db;padding-bottom: 10px;margin-bottom: 20px;
}table {width: 100%;border-collapse: collapse;margin-top: 15px;
}th, td {padding: 12px;text-align: left;border-bottom: 1px solid #ecf0f1;
}th {background-color: #3498db;color: white;
}tr:hover {background-color: #f8f9fa;
}.user-select {margin-bottom: 30px;padding: 15px;background: #f8f9fa;border-radius: 6px;
}.user-select input {padding: 8px;border: 1px solid #ddd;border-radius: 4px;
}.stats-container {display: grid;grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));gap: 20px;margin-top: 20px;
}.stat-item {background: #f8f9fa;padding: 15px;border-radius: 6px;text-align: center;
}.stat-item .label {display: block;color: #7f8c8d;margin-bottom: 5px;
}.stat-item .value {font-size: 1.4em;color: #2c3e50;font-weight: 500;
}.highlight .value {color: #3498db;
}

end

相关文章:

fastapi+angular停车管理系统可跨域

说明&#xff1a; 我计划用fastapiangular做一款停车管理系统&#xff0c;支持跨域 1.设计mysql数据库表&#xff0c; 2.建表&#xff0c;添加测试数据&#xff0c;多表查询&#xff0c; 3.在fastapi写接口查询数据&#xff0c; 4.用postman测试&#xff0c; 5.在angular前端展…...

前端题目类型

HTMLCSS常见面试题 HTML标签有哪些行内元素 img、picture、span、input、textarea、select、label 说说你对元素语义化的理解 元素语义化就是用正确的元素做正确的事情。虽然理论上所有html元素都可通过css样式实现相同效果&#xff0c;但这样会使事情复杂化&#xff0c;所以需…...

openwrt路由系统------lua、uci的关系

1. Luci 的核心组成 (1) Lua 简介:Luci 的界面和逻辑几乎完全使用 Lua 脚本语言编写。Lua 是一种轻量级、高效的嵌入式脚本语言,适合在资源受限的路由器环境中运行。作用: 生成动态 Web 页面(与后端交互渲染 HTML)。处理用户提交的表单数据(如修改 Wi-Fi 密码)。调用系…...

Elastic:AI 会开始取代网络安全工作吗?

作者&#xff1a;来自 Elastic Joe DeFever 不会&#xff0c;但它正在从根本上改变这些工作。 生成式 AI (GenAI) 正迅速成为日常安全工作流程中的一个重要组成部分。那么&#xff0c;它是合作伙伴还是竞争对手&#xff1f; GenAI 技术在安全堆栈几乎每个方面的广泛应用&#…...

Linux安装升级docker

Linux 安装升级docker Linux 安装升级docker背景升级停止docker服务备份原docker数据目录移除旧版本docker安装docker ce恢复数据目录启动docker参考 安装找到docker官网找到docker文档删除旧版本docker配置docker yum源参考官网继续安装docker设置开机自启配置加速测试 Linux …...

【经验分享】Ubuntu20.04编译RK3568 AI模型报错问题(已解决)

【经验分享】Ubuntu20.04编译RK3568 AI模型报错问题&#xff08;已解决&#xff09; 前言问题现象问题分析解决方案总结 前言 这里使用的是Rockchip提供的rknn_model_zoo&#xff0c;https://github.com/airockchip/rknn_model_zoo/tree/main 此解决方案适用于Rockchip芯片在U…...

国产算力助力工业智能新范式

随着人工智能、智能制造以及边缘计算等技术趋势的发展&#xff0c;算力设备正逐渐从中心云向边缘机房乃至边缘现场下沉。在此背景下&#xff0c;以工控机为例的部署于各类边缘现场的算力设备市场&#xff0c;也正面临着新的变革。 根据IDC 2024研究报告显示&#xff1a;在能源制…...

学习笔记:利用OpenAI实现阅卷智能体

https://zhuanlan.zhihu.com/p/18047953492 ### 学习笔记&#xff1a;利用OpenAI实现阅卷智能体 #### 一、背景与需求 在各类考试中&#xff0c;选择题、判断题、填空题的阅卷相对简单&#xff0c;只需对比答案与作答是否一致。然而&#xff0c;简答题的阅卷较为复杂&#xff…...

第6届传智杯复赛第一场

A小红劈字符串 题目链接 题目链接&#xff1a;A-小红劈字符串&#xff08;B组&#xff09;_第6届传智杯复赛第一场&#xff08;补题&#xff09; (nowcoder.com) 题目描述 小红拿到了一个仅由小写字母组成的字符串&#xff0c;她希望将其分割成两个非空子串&#xff0c;使得第…...

CSDN博客:Markdown编辑语法教程总结教程(中)

❤个人主页&#xff1a;折枝寄北的博客 Markdown编辑语法教程总结 前言1. 列表1.1 无序列表1.2 有序列表1.3 待办事项列表1.4 自定义列表 2. 图片2.1 直接插入图片2.2 插入带尺寸的图片2.3 插入宽度确定&#xff0c;高度等比例的图片2.4 插入高度确定宽度等比例的图片2.5 插入居…...

Codeforces Round 258 (Div. 2) E. Devu and Flowers 生成函数

题目链接 题目大意 有 n n n ( 1 ≤ n ≤ 20 ) (1\leq n \leq 20) (1≤n≤20) 个花瓶&#xff0c;第 i i i 个花瓶里有 f i f_i fi​ ( 1 ≤ f i ≤ 1 0 12 ) (1\leq f_i \leq 10^{12}) (1≤fi​≤1012) 朵花。现在要选择 s s s ( 1 ≤ s ≤ 1 0 14 ) (1\leq s \leq 1…...

【高并发内存池】释放内存 + 申请和释放总结

高并发内存池 1. 释放内存1.1 thread cache1.2 central cache1.3 page cache 2. 申请和释放剩余补充 点赞&#x1f44d;&#x1f44d;收藏&#x1f31f;&#x1f31f;关注&#x1f496;&#x1f496; 你的支持是对我最大的鼓励&#xff0c;我们一起努力吧!&#x1f603;&#x…...

AutoGen学习笔记系列(九)Advanced - Selector Group Chat

这篇文章瞄的是AutoGen官方教学文档 Advanced 章节中的 Selector Group Chat 篇章&#xff0c;介绍了SelectorGroupChat对象如何从一个Team中选择其中一个Agent与LLM进行对话&#xff0c;并且在得到结果后进行二次规划&#xff0c;同时你也可以自定义选择函数。本质上还是对Tea…...

Stream特性(踩坑):惰性执行、不修改原始数据源

在日常开发中&#xff0c;Stream API 提供了一种高效且易于使用的工具集来处理集合数据。 本文主要讲解 Stream 的两个特性&#xff1a;惰性执行&#xff0c;不修改原始数据源。 为什么说这两个、而不讲下其他的特性呢&#xff1f;主要是因为在开发中如果忽略这两个特性的话&…...

springcloud sentinel教程

‌QPS&#xff08;Queries Per Second&#xff09;即每秒查询率 TPS&#xff0c;每秒处理的事务数目 PV&#xff08;page view&#xff09;即页面浏览量 UV 访问数&#xff08;Unique Visitor&#xff09;指独立访客访问数 一、初识Sentinel 什么是雪崩问题? 微服务之间相…...

像素的一生 Life of a Pixel - Steve Kobes 2020版

像素的一生 Life of a Pixel - Steve Kobes 2020版 《Life of a Pixel》 作者是Google大佬 Steve Kobes 2020年 介绍Chromium内核完整渲染流程的视频&#xff0c;介绍的非常好&#xff0c;想要学习了解chromium内核渲染必看&#xff01; 油管视频地址为&#xff1a;https://w…...

系统部署【信创名录】及其查询地址

一、信创类型 &#xff08;一&#xff09;服务器&#xff1a; 1.华为云 2.腾讯云 3.阿里云 &#xff08;二&#xff09;中央处理器&#xff08;CPU&#xff09;&#xff1a; 1.海思&#xff0c;鲲鹏920服务器 &#xff08;三&#xff09;中间件 1.人大金仓 &#xff0…...

VSCode 配置优化指南:打造高效的 uni-app、Vue2/3、JS/TS 开发环境

VSCode 配置优化指南,适用于 uni-app、Vue2、Vue3、JavaScript、TypeScript 开发,包括插件推荐、设置优化、代码片段、调试配置等,确保你的开发体验更加流畅高效。 1. 安装 VSCode 如果你还未安装 VSCode,可前往 VSCode 官网 下载最新版并安装。 2. 安装推荐插件 (1) Vue…...

C++中的析构函数

目录 一、什么是析构函数&#xff1a; 二、析构函数的特性&#xff1a; 一、什么是析构函数&#xff1a; C中的析构函数非常简单&#xff0c;它的功能无非是帮助我们自动归还堆区的空间给操作系统。当我们使用内存开辟函数&#xff08;如malloc()、realloc()&#xff09;等&a…...

同步,异步,并发,并行

同步: 任务按顺序执行&#xff0c;必须等待前一个任务完成后才能开始下一个任务。 任务之间是强依赖的&#xff0c;通过直接调用或阻塞等待实现。 示例&#xff1a;读取文件时&#xff0c;代码会阻塞直到文件读取完成。 异步&#xff1a; 任务无需等待前一个任务完成即可启…...

第19节 Node.js Express 框架

Express 是一个为Node.js设计的web开发框架&#xff0c;它基于nodejs平台。 Express 简介 Express是一个简洁而灵活的node.js Web应用框架, 提供了一系列强大特性帮助你创建各种Web应用&#xff0c;和丰富的HTTP工具。 使用Express可以快速地搭建一个完整功能的网站。 Expre…...

业务系统对接大模型的基础方案:架构设计与关键步骤

业务系统对接大模型&#xff1a;架构设计与关键步骤 在当今数字化转型的浪潮中&#xff0c;大语言模型&#xff08;LLM&#xff09;已成为企业提升业务效率和创新能力的关键技术之一。将大模型集成到业务系统中&#xff0c;不仅可以优化用户体验&#xff0c;还能为业务决策提供…...

XCTF-web-easyupload

试了试php&#xff0c;php7&#xff0c;pht&#xff0c;phtml等&#xff0c;都没有用 尝试.user.ini 抓包修改将.user.ini修改为jpg图片 在上传一个123.jpg 用蚁剑连接&#xff0c;得到flag...

Ubuntu系统下交叉编译openssl

一、参考资料 OpenSSL&&libcurl库的交叉编译 - hesetone - 博客园 二、准备工作 1. 编译环境 宿主机&#xff1a;Ubuntu 20.04.6 LTSHost&#xff1a;ARM32位交叉编译器&#xff1a;arm-linux-gnueabihf-gcc-11.1.0 2. 设置交叉编译工具链 在交叉编译之前&#x…...

python如何将word的doc另存为docx

将 DOCX 文件另存为 DOCX 格式&#xff08;Python 实现&#xff09; 在 Python 中&#xff0c;你可以使用 python-docx 库来操作 Word 文档。不过需要注意的是&#xff0c;.doc 是旧的 Word 格式&#xff0c;而 .docx 是新的基于 XML 的格式。python-docx 只能处理 .docx 格式…...

VTK如何让部分单位不可见

最近遇到一个需求&#xff0c;需要让一个vtkDataSet中的部分单元不可见&#xff0c;查阅了一些资料大概有以下几种方式 1.通过颜色映射表来进行&#xff0c;是最正规的做法 vtkNew<vtkLookupTable> lut; //值为0不显示&#xff0c;主要是最后一个参数&#xff0c;透明度…...

c#开发AI模型对话

AI模型 前面已经介绍了一般AI模型本地部署&#xff0c;直接调用现成的模型数据。这里主要讲述讲接口集成到我们自己的程序中使用方式。 微软提供了ML.NET来开发和使用AI模型&#xff0c;但是目前国内可能使用不多&#xff0c;至少实践例子很少看见。开发训练模型就不介绍了&am…...

ip子接口配置及删除

配置永久生效的子接口&#xff0c;2个IP 都可以登录你这一台服务器。重启不失效。 永久的 [应用] vi /etc/sysconfig/network-scripts/ifcfg-eth0修改文件内内容 TYPE"Ethernet" BOOTPROTO"none" NAME"eth0" DEVICE"eth0" ONBOOT&q…...

云原生玩法三问:构建自定义开发环境

云原生玩法三问&#xff1a;构建自定义开发环境 引言 临时运维一个古董项目&#xff0c;无文档&#xff0c;无环境&#xff0c;无交接人&#xff0c;俗称三无。 运行设备的环境老&#xff0c;本地环境版本高&#xff0c;ssh不过去。正好最近对 腾讯出品的云原生 cnb 感兴趣&…...

处理vxe-table 表尾数据是单独一个接口,表格tableData数据更新后,需要点击两下,表尾才是正确的

修改bug思路&#xff1a; 分别把 tabledata 和 表尾相关数据 console.log() 发现 更新数据先后顺序不对 settimeout延迟查询表格接口 ——测试可行 升级↑&#xff1a;async await 等接口返回后再开始下一个接口查询 ________________________________________________________…...