diff --git a/.env b/.env index 1e4c6a1..f80a92f 100644 --- a/.env +++ b/.env @@ -23,7 +23,7 @@ MYSQL_HOST="115.190.61.185" MYSQL_PORT="6033" MYSQL_USER="root" MYSQL_PASSWORD="liangfangxing123" -MYSQL_DATABASE="medical_assistant" +MYSQL_DATABASE="travel_rag" # ES配置 ES_HOST="https://115.190.61.185:9200" diff --git a/a2a_server/__init__.py b/a2a_server/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/conf.py b/conf.py index e590999..1197471 100644 --- a/conf.py +++ b/conf.py @@ -55,6 +55,9 @@ class Settings(BaseSettings): faq_threshold: float recall_threshold: float + # 日志配置 + log_file: str = str(APP_DIR / 'logs' / 'app.log') + # 映射配置文件的配置 model_config = ConfigDict( diff --git a/create_logger.py b/create_logger.py new file mode 100644 index 0000000..feea9a2 --- /dev/null +++ b/create_logger.py @@ -0,0 +1,36 @@ +import logging +import os +from conf import settings + + +def setup_logger(name, log_file='logs/app.log'): + # 创建日志文件夹 + os.makedirs(os.path.dirname(log_file), exist_ok=True) + + # 获取日志记录器 + logger = logging.getLogger(name) + logger.setLevel(logging.DEBUG) + # 防止重复输出的关键! + logger.propagate = False + + # 定义日志格式 + formatter = logging.Formatter('%(name)s - %(asctime)s - %(levelname)s - %(message)s') + + # 创建控制台处理器 + console_handler = logging.StreamHandler() + console_handler.setFormatter(formatter) + console_handler.setLevel(logging.INFO) # 每个日志处理器可以单独设置日志级别,但是这个日志级别必须高于或等于处理器级别 + + # 创建文件处理器 + file_handler = logging.FileHandler(filename=log_file, encoding="utf-8", mode="a") + file_handler.setFormatter(formatter) + file_handler.setLevel(logging.DEBUG) + + # 将处理器添加到日志记录器中 + if not logger.handlers: # 先进行判断,再进行添加。避免重复添加处理器 + logger.addHandler(console_handler) + logger.addHandler(file_handler) + + return logger + +logger = setup_logger('SmartVoage', settings.log_file) \ No newline at end of file diff --git a/database.sql b/database.sql new file mode 100644 index 0000000..3531fd0 --- /dev/null +++ b/database.sql @@ -0,0 +1,436 @@ +DROP DATABASE IF EXISTS travel_rag; +CREATE DATABASE travel_rag CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +USE travel_rag; + +CREATE TABLE train_tickets ( + id INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键,自增,唯一标识每条记录', + departure_city VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '出发城市(如“北京”)', + arrival_city VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '到达城市(如“上海”)', + departure_time DATETIME NOT NULL COMMENT '出发时间(如“2025-08-12 07:00:00”)', + arrival_time DATETIME NOT NULL COMMENT '到达时间(如“2025-08-12 11:30:00”)', + train_number VARCHAR(20) NOT NULL COMMENT '火车车次(如“G1001”)', + seat_type VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '座位类型(如“二等座”)', + total_seats INT NOT NULL COMMENT '总座位数(如 1000)', + remaining_seats INT NOT NULL COMMENT '剩余座位数(如 50)', + price DECIMAL(10, 2) NOT NULL COMMENT '票价(如 553.50)', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间,自动记录插入时间', + UNIQUE KEY unique_train (departure_time, train_number) -- 唯一约束,确保同一时间和车次不重复 +) COMMENT='火车票信息表'; + +CREATE TABLE flight_tickets ( + id INT AUTO_INCREMENT PRIMARY KEY COMMENT '主键,自增,唯一标识每条记录', + departure_city VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '出发城市(如“北京”)', + arrival_city VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '到达城市(如“上海”)', + departure_time DATETIME NOT NULL COMMENT '出发时间(如“2025-08-12 08:00:00”)', + arrival_time DATETIME NOT NULL COMMENT '到达时间(如“2025-08-12 10:30:00”)', + flight_number VARCHAR(20) NOT NULL COMMENT '航班号(如“CA1234”)', + cabin_type VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '舱位类型(如“经济舱”)', + total_seats INT NOT NULL COMMENT '总座位数(如 200)', + remaining_seats INT NOT NULL COMMENT '剩余座位数(如 10)', + price DECIMAL(10, 2) NOT NULL COMMENT '票价(如 1200.00)', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间,自动记录插入时间', + UNIQUE KEY unique_flight (departure_time, flight_number) -- 唯一约束,确保同一时间和航班号不重复 +) COMMENT='航班机票信息表'; + +CREATE TABLE concert_tickets ( + id INT AUTO_INCREMENT PRIMARY KEY, -- 主键,自增,唯一标识每条记录 + artist VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -- 艺人名称(如“周杰伦”) + city VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -- 举办城市(如“上海”) + venue VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -- 场馆(如“上海体育场”) + start_time DATETIME NOT NULL, -- 开始时间(如“2025-08-12 19:00:00”) + end_time DATETIME NOT NULL, -- 结束时间(如“2025-08-12 22:00:00”) + ticket_type VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, -- 票类型(如“VIP”) + total_seats INT NOT NULL, -- 总座位数(如 5000) + remaining_seats INT NOT NULL, -- 剩余座位数(如 100) + price DECIMAL(10, 2) NOT NULL, -- 票价(如 880.00) + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 创建时间,自动记录插入时间 + UNIQUE KEY unique_concert (start_time, artist, ticket_type) -- 唯一约束,确保同一时间、艺人和票类型不重复 +); + +CREATE TABLE IF NOT EXISTS weather_data ( + id INT AUTO_INCREMENT PRIMARY KEY, + city VARCHAR(50) NOT NULL COMMENT '城市名称', + fx_date DATE NOT NULL COMMENT '预报日期', + sunrise TIME COMMENT '日出时间', + sunset TIME COMMENT '日落时间', + moonrise TIME COMMENT '月升时间', + moonset TIME COMMENT '月落时间', + moon_phase VARCHAR(20) COMMENT '月相名称', + moon_phase_icon VARCHAR(10) COMMENT '月相图标代码', + temp_max INT COMMENT '最高温度', + temp_min INT COMMENT '最低温度', + icon_day VARCHAR(10) COMMENT '白天天气图标代码', + text_day VARCHAR(20) COMMENT '白天天气描述', + icon_night VARCHAR(10) COMMENT '夜间天气图标代码', + text_night VARCHAR(20) COMMENT '夜间天气描述', + wind360_day INT COMMENT '白天风向360角度', + wind_dir_day VARCHAR(20) COMMENT '白天风向', + wind_scale_day VARCHAR(10) COMMENT '白天风力等级', + wind_speed_day INT COMMENT '白天风速 (km/h)', + wind360_night INT COMMENT '夜间风向360角度', + wind_dir_night VARCHAR(20) COMMENT '夜间风向', + wind_scale_night VARCHAR(10) COMMENT '夜间风力等级', + wind_speed_night INT COMMENT '夜间风速 (km/h)', + precip DECIMAL(5,1) COMMENT '降水量 (mm)', + uv_index INT COMMENT '紫外线指数', + humidity INT COMMENT '相对湿度 (%)', + pressure INT COMMENT '大气压强 (hPa)', + vis INT COMMENT '能见度 (km)', + cloud INT COMMENT '云量 (%)', + update_time DATETIME COMMENT '数据更新时间', + UNIQUE KEY unique_city_date (city, fx_date) +) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='天气数据表'; + +INSERT INTO train_tickets ( + departure_city, arrival_city, departure_time, arrival_time, + train_number, seat_type, total_seats, remaining_seats, price +) VALUES +-- 第1-10条 +('广州', '上海', '2026-03-18 07:00:00', '2026-03-18 14:30:00', 'G1301', '二等座', 800, 120, 858.00), +('广州', '北京', '2026-03-18 08:15:00', '2026-03-18 18:45:00', 'G80', '一等座', 750, 85, 1380.50), +('上海', '北京', '2026-03-18 09:00:00', '2026-03-18 15:30:00', 'G1', '二等座', 1000, 200, 553.00), +('北京', '上海', '2026-03-18 10:00:00', '2026-03-18 16:40:00', 'G2', '商务座', 50, 8, 1873.50), +('上海', '广州', '2026-03-18 11:30:00', '2026-03-18 20:15:00', 'G1302', '二等座', 900, 350, 876.00), +('北京', '广州', '2026-03-18 13:00:00', '2026-03-19 00:20:00', 'G65', '二等座', 850, 180, 1031.00), +('广州', '上海', '2026-03-19 06:45:00', '2026-03-19 14:10:00', 'G1303', '一等座', 200, 45, 1373.00), +('上海', '北京', '2026-03-19 08:30:00', '2026-03-19 15:00:00', 'G3', '二等座', 1000, 420, 553.00), +('北京', '广州', '2026-03-19 09:40:00', '2026-03-20 00:10:00', 'G67', '商务座', 40, 5, 3280.00), +('广州', '北京', '2026-03-19 10:20:00', '2026-03-19 20:50:00', 'G82', '二等座', 800, 95, 1380.50), +-- 第11-20条 +('上海', '广州', '2026-03-19 12:00:00', '2026-03-19 20:45:00', 'G1304', '二等座', 950, 280, 865.50), +('北京', '上海', '2026-03-19 14:10:00', '2026-03-19 20:50:00', 'G4', '一等座', 250, 60, 885.00), +('广州', '上海', '2026-03-20 07:15:00', '2026-03-20 14:45:00', 'G1305', '二等座', 850, 150, 858.00), +('上海', '北京', '2026-03-20 08:45:00', '2026-03-20 15:15:00', 'G5', '二等座', 1000, 380, 553.00), +('北京', '广州', '2026-03-20 10:00:00', '2026-03-21 00:30:00', 'G69', '二等座', 800, 120, 1031.00), +('广州', '北京', '2026-03-20 11:30:00', '2026-03-20 22:00:00', 'G84', '一等座', 180, 30, 2208.80), +('上海', '广州', '2026-03-20 13:15:00', '2026-03-21 00:50:00', 'G1306', '商务座', 30, 2, 2780.00), +('北京', '上海', '2026-03-20 15:00:00', '2026-03-20 21:40:00', 'G6', '二等座', 1000, 450, 553.00), +('广州', '上海', '2026-03-21 06:30:00', '2026-03-21 14:00:00', 'G1307', '二等座', 900, 210, 858.00), +('上海', '北京', '2026-03-21 08:00:00', '2026-03-21 14:30:00', 'G7', '一等座', 220, 75, 885.00), +-- 第21-30条 +('北京', '广州', '2026-03-21 09:20:00', '2026-03-22 00:00:00', 'G71', '二等座', 850, 160, 1031.00), +('广州', '北京', '2026-03-21 10:45:00', '2026-03-21 21:15:00', 'G86', '商务座', 45, 7, 4350.00), +('上海', '广州', '2026-03-21 12:30:00', '2026-03-21 21:10:00', 'G1308', '二等座', 920, 320, 876.00), +('北京', '上海', '2026-03-21 14:00:00', '2026-03-21 20:40:00', 'G8', '二等座', 1000, 390, 553.00), +('广州', '上海', '2026-03-22 07:45:00', '2026-03-22 15:15:00', 'G1309', '一等座', 200, 40, 1373.00), +('上海', '北京', '2026-03-22 08:30:00', '2026-03-22 15:00:00', 'G9', '二等座', 1000, 280, 553.00), +('北京', '广州', '2026-03-22 10:10:00', '2026-03-23 00:40:00', 'G73', '二等座', 800, 110, 1031.00), +('广州', '北京', '2026-03-22 11:50:00', '2026-03-22 22:20:00', 'G88', '二等座', 850, 140, 1380.50), +('上海', '广州', '2026-03-22 13:20:00', '2026-03-22 22:00:00', 'G1310', '一等座', 190, 55, 1392.00), +('北京', '上海', '2026-03-22 15:30:00', '2026-03-22 22:10:00', 'G10', '商务座', 50, 9, 1873.50), +-- 第31-40条 +('广州', '上海', '2026-03-23 06:50:00', '2026-03-23 14:20:00', 'G1311', '二等座', 880, 190, 858.00), +('上海', '北京', '2026-03-23 08:15:00', '2026-03-23 14:45:00', 'G11', '二等座', 1000, 350, 553.00), +('北京', '广州', '2026-03-23 09:30:00', '2026-03-24 00:10:00', 'G75', '一等座', 180, 40, 1649.60), +('广州', '北京', '2026-03-23 10:50:00', '2026-03-23 21:20:00', 'G90', '二等座', 820, 85, 1380.50), +('上海', '广州', '2026-03-23 12:15:00', '2026-03-23 20:55:00', 'G1312', '二等座', 940, 270, 865.50), +('北京', '上海', '2026-03-23 14:20:00', '2026-03-23 21:00:00', 'G12', '二等座', 1000, 410, 553.00), +('广州', '上海', '2026-03-24 07:20:00', '2026-03-24 14:50:00', 'G1313', '商务座', 35, 4, 2725.00), +('上海', '北京', '2026-03-24 08:40:00', '2026-03-24 15:10:00', 'G13', '一等座', 230, 80, 885.00), +('北京', '广州', '2026-03-24 10:00:00', '2026-03-25 00:30:00', 'G77', '二等座', 860, 170, 1031.00), +('广州', '北京', '2026-03-24 11:30:00', '2026-03-24 22:00:00', 'G92', '一等座', 200, 50, 2208.80), +-- 第41-50条 +('上海', '广州', '2026-03-24 13:00:00', '2026-03-24 21:40:00', 'G1314', '二等座', 910, 300, 876.00), +('北京', '上海', '2026-03-24 15:10:00', '2026-03-24 21:50:00', 'G14', '二等座', 1000, 370, 553.00), +('广州', '上海', '2026-03-25 06:40:00', '2026-03-25 14:10:00', 'G1315', '二等座', 890, 220, 858.00), +('上海', '北京', '2026-03-25 08:20:00', '2026-03-25 14:50:00', 'G15', '商务座', 45, 6, 1873.50), +('北京', '广州', '2026-03-25 09:45:00', '2026-03-26 00:15:00', 'G79', '二等座', 830, 130, 1031.00), +('广州', '北京', '2026-03-25 10:55:00', '2026-03-25 21:25:00', 'G94', '二等座', 840, 90, 1380.50), +('上海', '广州', '2026-03-25 12:20:00', '2026-03-25 21:00:00', 'G1316', '一等座', 210, 65, 1392.00), +('北京', '上海', '2026-03-25 14:30:00', '2026-03-25 21:10:00', 'G16', '二等座', 1000, 430, 553.00), +('广州', '上海', '2026-03-25 16:00:00', '2026-03-25 23:30:00', 'G1317', '二等座', 870, 180, 858.00), +('上海', '北京', '2026-03-25 17:30:00', '2026-03-26 00:00:00', 'G17', '二等座', 1000, 310, 553.00); + + +INSERT INTO flight_tickets (departure_city, arrival_city, departure_time, arrival_time, flight_number, cabin_type, total_seats, remaining_seats, price) VALUES +-- 2026-03-18 +('北京', '上海', '2026-03-18 08:00:00', '2026-03-18 10:10:00', 'CA1501', '经济舱', 180, 45, 680.00), +('上海', '广州', '2026-03-18 08:30:00', '2026-03-18 11:00:00', 'MU5301', '经济舱', 200, 12, 750.00), +('广州', '北京', '2026-03-18 09:15:00', '2026-03-18 12:20:00', 'CZ3101', '公务舱', 30, 8, 2200.00), +('北京', '广州', '2026-03-18 10:20:00', '2026-03-18 13:40:00', 'CA1301', '经济舱', 200, 33, 850.00), +('上海', '北京', '2026-03-18 11:00:00', '2026-03-18 13:10:00', 'MU5101', '经济舱', 180, 67, 720.00), +('广州', '上海', '2026-03-18 12:10:00', '2026-03-18 14:20:00', 'CZ3501', '经济舱', 200, 89, 580.00), +('北京', '上海', '2026-03-18 13:45:00', '2026-03-18 15:55:00', 'CA1517', '公务舱', 28, 3, 1800.00), +('上海', '广州', '2026-03-18 14:30:00', '2026-03-18 16:50:00', 'HO1111', '经济舱', 180, 105, 690.00), +('广州', '北京', '2026-03-18 16:00:00', '2026-03-18 19:10:00', 'CZ3099', '经济舱', 200, 56, 920.00), +('北京', '广州', '2026-03-18 18:20:00', '2026-03-18 21:40:00', 'HU7801', '经济舱', 200, 47, 810.00), + +-- 2026-03-19 +('上海', '北京', '2026-03-19 07:50:00', '2026-03-19 10:00:00', 'MU5127', '经济舱', 180, 23, 700.00), +('广州', '上海', '2026-03-19 08:40:00', '2026-03-19 10:50:00', '9C8830', '经济舱', 180, 78, 520.00), +('北京', '上海', '2026-03-19 10:10:00', '2026-03-19 12:20:00', 'CA1549', '经济舱', 200, 112, 650.00), +('上海', '广州', '2026-03-19 11:30:00', '2026-03-19 13:50:00', 'MU5305', '公务舱', 32, 5, 1950.00), +('广州', '北京', '2026-03-19 13:15:00', '2026-03-19 16:20:00', 'CZ3103', '经济舱', 200, 41, 880.00), +('北京', '广州', '2026-03-19 15:00:00', '2026-03-19 18:20:00', 'CA1321', '经济舱', 200, 90, 830.00), +('上海', '北京', '2026-03-19 16:45:00', '2026-03-19 18:55:00', 'CA1850', '经济舱', 180, 34, 760.00), +('广州', '上海', '2026-03-19 18:20:00', '2026-03-19 20:30:00', 'MU5308', '经济舱', 200, 123, 600.00), +('北京', '上海', '2026-03-19 20:00:00', '2026-03-19 22:10:00', 'MU5150', '公务舱', 30, 7, 1750.00), +('上海', '广州', '2026-03-19 21:30:00', '2026-03-19 23:50:00', 'CZ3522', '经济舱', 180, 56, 720.00), + +-- 2026-03-20 +('广州', '北京', '2026-03-20 08:20:00', '2026-03-20 11:30:00', 'CZ3105', '经济舱', 200, 67, 900.00), +('北京', '广州', '2026-03-20 10:00:00', '2026-03-20 13:20:00', 'CA1305', '经济舱', 200, 45, 870.00), +('上海', '北京', '2026-03-20 12:00:00', '2026-03-20 14:10:00', 'MU5115', '经济舱', 180, 88, 710.00), +('北京', '上海', '2026-03-20 13:30:00', '2026-03-20 15:40:00', 'CA1553', '公务舱', 28, 4, 1900.00), +('广州', '上海', '2026-03-20 15:10:00', '2026-03-20 17:20:00', 'HO1115', '经济舱', 180, 102, 540.00), +('上海', '广州', '2026-03-20 16:50:00', '2026-03-20 19:10:00', 'CZ3505', '经济舱', 200, 78, 680.00), +('北京', '广州', '2026-03-20 18:30:00', '2026-03-20 21:50:00', 'HU7805', '经济舱', 200, 33, 890.00), +('广州', '北京', '2026-03-20 20:00:00', '2026-03-20 23:10:00', 'CA1331', '经济舱', 200, 91, 940.00), +('上海', '北京', '2026-03-20 21:40:00', '2026-03-20 23:50:00', 'MU5131', '公务舱', 30, 6, 2000.00), +('北京', '上海', '2026-03-20 22:20:00', '2026-03-21 00:30:00', '9C8890', '经济舱', 180, 120, 620.00), + +-- 2026-03-21 +('广州', '上海', '2026-03-21 08:00:00', '2026-03-21 10:10:00', 'CZ3507', '经济舱', 200, 55, 560.00), +('北京', '广州', '2026-03-21 09:30:00', '2026-03-21 12:50:00', 'CA1309', '经济舱', 200, 47, 860.00), +('上海', '北京', '2026-03-21 11:00:00', '2026-03-21 13:10:00', 'MU5109', '经济舱', 180, 77, 730.00), +('广州', '北京', '2026-03-21 12:40:00', '2026-03-21 15:50:00', 'CZ3107', '公务舱', 32, 9, 2100.00), +('北京', '上海', '2026-03-21 14:20:00', '2026-03-21 16:30:00', 'HO1119', '经济舱', 180, 134, 600.00), +('上海', '广州', '2026-03-21 16:00:00', '2026-03-21 18:20:00', 'MU5311', '经济舱', 200, 82, 710.00), +('广州', '上海', '2026-03-21 17:30:00', '2026-03-21 19:40:00', 'CA1561', '经济舱', 200, 96, 590.00), +('北京', '广州', '2026-03-21 19:00:00', '2026-03-21 22:20:00', 'HU7809', '公务舱', 28, 5, 1850.00), +('上海', '北京', '2026-03-21 20:30:00', '2026-03-21 22:40:00', 'CZ3526', '经济舱', 180, 43, 780.00), +('广州', '北京', '2026-03-21 22:00:00', '2026-03-22 01:10:00', 'CA1335', '经济舱', 200, 109, 910.00), + +-- 2026-03-22 +('北京', '上海', '2026-03-22 08:10:00', '2026-03-22 10:20:00', 'MU5103', '经济舱', 180, 65, 670.00), +('上海', '广州', '2026-03-22 09:20:00', '2026-03-22 11:40:00', 'CZ3509', '经济舱', 200, 114, 650.00), +('广州', '北京', '2026-03-22 10:50:00', '2026-03-22 14:00:00', 'CA1303', '公务舱', 30, 7, 2250.00), +('北京', '广州', '2026-03-22 12:30:00', '2026-03-22 15:50:00', 'HO1123', '经济舱', 200, 52, 840.00), +('上海', '北京', '2026-03-22 14:00:00', '2026-03-22 16:10:00', 'MU5111', '经济舱', 180, 89, 740.00), +('广州', '上海', '2026-03-22 15:30:00', '2026-03-22 17:40:00', 'CZ3511', '经济舱', 200, 101, 570.00), +('北京', '上海', '2026-03-22 17:00:00', '2026-03-22 19:10:00', 'CA1565', '经济舱', 200, 76, 630.00), +('上海', '广州', '2026-03-22 18:30:00', '2026-03-22 20:50:00', 'HU7813', '公务舱', 28, 4, 1950.00), +('广州', '北京', '2026-03-22 20:00:00', '2026-03-22 23:10:00', 'CA1337', '经济舱', 200, 118, 870.00), +('北京', '广州', '2026-03-22 21:30:00', '2026-03-23 00:50:00', 'MU5315', '经济舱', 180, 29, 820.00), + +-- 2026-03-23 +('上海', '北京', '2026-03-23 08:30:00', '2026-03-23 10:40:00', 'CZ3528', '经济舱', 180, 95, 690.00), +('广州', '上海', '2026-03-23 10:00:00', '2026-03-23 12:10:00', 'CA1567', '经济舱', 200, 142, 550.00), +('北京', '广州', '2026-03-23 11:30:00', '2026-03-23 14:50:00', 'HO1127', '公务舱', 32, 6, 2050.00), +('上海', '广州', '2026-03-23 13:00:00', '2026-03-23 15:20:00', 'MU5317', '经济舱', 200, 61, 700.00), +('广州', '北京', '2026-03-23 14:30:00', '2026-03-23 17:40:00', 'CZ3111', '经济舱', 200, 84, 930.00), +('北京', '上海', '2026-03-23 16:00:00', '2026-03-23 18:10:00', 'CA1569', '经济舱', 180, 37, 610.00), +('上海', '北京', '2026-03-23 17:30:00', '2026-03-23 19:40:00', 'MU5117', '经济舱', 180, 126, 770.00), +('广州', '上海', '2026-03-23 19:00:00', '2026-03-23 21:10:00', 'CZ3513', '公务舱', 30, 8, 1800.00), +('北京', '广州', '2026-03-23 20:30:00', '2026-03-23 23:50:00', 'HU7817', '经济舱', 200, 53, 800.00), +('上海', '广州', '2026-03-23 22:00:00', '2026-03-24 00:20:00', 'CA1339', '经济舱', 200, 97, 670.00), + +-- 2026-03-24 +('广州', '北京', '2026-03-24 08:40:00', '2026-03-24 11:50:00', 'CA1307', '经济舱', 200, 44, 950.00), +('北京', '上海', '2026-03-24 10:10:00', '2026-03-24 12:20:00', 'MU5105', '经济舱', 180, 102, 640.00), +('上海', '广州', '2026-03-24 11:40:00', '2026-03-24 14:00:00', 'CZ3515', '经济舱', 200, 79, 720.00), +('广州', '北京', '2026-03-24 13:10:00', '2026-03-24 16:20:00', 'HO1131', '公务舱', 28, 5, 2150.00), +('北京', '广州', '2026-03-24 14:40:00', '2026-03-24 18:00:00', 'CA1311', '经济舱', 200, 68, 880.00), +('上海', '北京', '2026-03-24 16:10:00', '2026-03-24 18:20:00', 'MU5119', '经济舱', 180, 113, 760.00), +('广州', '上海', '2026-03-24 17:40:00', '2026-03-24 19:50:00', 'CZ3517', '经济舱', 200, 87, 600.00), +('北京', '上海', '2026-03-24 19:10:00', '2026-03-24 21:20:00', 'CA1571', '经济舱', 180, 51, 590.00), +('上海', '广州', '2026-03-24 20:40:00', '2026-03-24 23:00:00', 'HU7821', '公务舱', 32, 4, 1900.00), +('广州', '北京', '2026-03-24 22:10:00', '2026-03-25 01:20:00', 'CA1341', '经济舱', 200, 136, 920.00), + +-- 2026-03-25 +('北京', '上海', '2026-03-25 08:50:00', '2026-03-25 11:00:00', 'MU5107', '经济舱', 180, 59, 660.00), +('上海', '广州', '2026-03-25 10:20:00', '2026-03-25 12:40:00', 'CZ3519', '经济舱', 200, 108, 690.00), +('广州', '北京', '2026-03-25 11:50:00', '2026-03-25 15:00:00', 'CA1313', '经济舱', 200, 72, 890.00), +('北京', '广州', '2026-03-25 13:20:00', '2026-03-25 16:40:00', 'HO1135', '公务舱', 30, 7, 2000.00), +('上海', '北京', '2026-03-25 14:50:00', '2026-03-25 17:00:00', 'MU5121', '经济舱', 180, 94, 710.00), +('广州', '上海', '2026-03-25 16:20:00', '2026-03-25 18:30:00', 'CZ3521', '经济舱', 200, 121, 570.00), +('北京', '上海', '2026-03-25 17:50:00', '2026-03-25 20:00:00', 'CA1573', '经济舱', 180, 48, 640.00), +('上海', '广州', '2026-03-25 19:20:00', '2026-03-25 21:40:00', 'HU7825', '经济舱', 200, 83, 730.00), +('广州', '北京', '2026-03-25 20:50:00', '2026-03-25 23:50:00', 'CA1345', '公务舱', 28, 3, 1850.00), +('北京', '广州', '2026-03-25 22:20:00', '2026-03-26 01:40:00', 'MU5319', '经济舱', 200, 99, 810.00); + +INSERT INTO concert_tickets (artist, city, venue, start_time, end_time, ticket_type, total_seats, remaining_seats, price) VALUES +-- 注意:根据唯一约束 unique_concert (start_time, artist, ticket_type), +-- 同一时间、同一艺人、同一票类型只能有一条记录 +-- 2026-03-18 +('周杰伦', '北京', '国家体育场(鸟巢)', '2026-03-18 19:00:00', '2026-03-18 22:00:00', 'VIP', 500, 50, 1880.00), +('周杰伦', '北京', '国家体育场(鸟巢)', '2026-03-18 20:30:00', '2026-03-18 23:30:00', '看台', 15000, 2340, 580.00), +('吴岳峰', '上海', '梅赛德斯-奔驰文化中心', '2026-03-18 20:00:00', '2026-03-18 23:00:00', '内场', 2000, 156, 980.00), +('邓秋月', '广州', '广州体育馆', '2026-03-18 19:30:00', '2026-03-18 22:30:00', 'VIP', 300, 45, 1280.00), +('毛建龙', '北京', '五棵松体育馆', '2026-03-18 20:30:00', '2026-03-18 23:00:00', '看台', 10000, 3200, 380.00), +('周杰伦', '上海', '上海体育场', '2026-03-18 20:00:00', '2026-03-18 23:00:00', '内场', 3000, 120, 1580.00), +('周杰伦', '上海', '上海体育场', '2026-03-18 21:00:00', '2026-03-19 00:00:00', '看台', 20000, 4500, 680.00), +('吴岳峰', '广州', '广州宝能观致文化中心', '2026-03-18 20:00:00', '2026-03-18 23:00:00', 'VIP', 400, 89, 1080.00), +('邓秋月', '北京', '凯迪拉克中心', '2026-03-18 20:00:00', '2026-03-18 22:30:00', '内场', 1500, 230, 880.00), +('毛建龙', '上海', '静安体育中心', '2026-03-18 20:00:00', '2026-03-18 22:30:00', '看台', 8000, 1200, 280.00), + +-- 2026-03-19 +('周杰伦', '广州', '广州大学城体育中心体育场', '2026-03-19 19:00:00', '2026-03-19 22:00:00', 'VIP', 600, 78, 1780.00), +('周杰伦', '广州', '广州大学城体育中心体育场', '2026-03-19 20:00:00', '2026-03-19 23:00:00', '看台', 18000, 3100, 550.00), +('吴岳峰', '北京', '国家体育馆', '2026-03-19 20:00:00', '2026-03-19 23:00:00', '内场', 2500, 198, 1020.00), +('邓秋月', '上海', '上海大舞台', '2026-03-19 19:30:00', '2026-03-19 22:30:00', 'VIP', 350, 56, 1180.00), +('毛建龙', '广州', '广州中山纪念堂', '2026-03-19 20:30:00', '2026-03-19 23:00:00', '看台', 5000, 850, 350.00), +('周杰伦', '北京', '工人体育场', '2026-03-19 20:00:00', '2026-03-19 23:00:00', '内场', 3500, 145, 1680.00), +('周杰伦', '北京', '工人体育场', '2026-03-19 21:00:00', '2026-03-20 00:00:00', '看台', 22000, 5200, 620.00), +('吴岳峰', '上海', '虹口足球场', '2026-03-19 20:00:00', '2026-03-19 23:00:00', 'VIP', 450, 92, 1120.00), +('邓秋月', '广州', '广州国际体育演艺中心', '2026-03-19 20:00:00', '2026-03-19 22:30:00', '内场', 1800, 310, 920.00), +('毛建龙', '北京', '北展剧场', '2026-03-19 20:00:00', '2026-03-19 22:30:00', '看台', 6000, 1450, 320.00), + +-- 2026-03-20 +('周杰伦', '上海', '东方体育中心', '2026-03-20 19:00:00', '2026-03-20 22:00:00', 'VIP', 550, 65, 1920.00), +('周杰伦', '上海', '东方体育中心', '2026-03-20 20:00:00', '2026-03-20 23:00:00', '看台', 16000, 2800, 590.00), +('吴岳峰', '广州', '天河体育场', '2026-03-20 20:00:00', '2026-03-20 23:00:00', '内场', 2200, 167, 1050.00), +('邓秋月', '北京', '首都体育馆', '2026-03-20 19:30:00', '2026-03-20 22:30:00', 'VIP', 320, 48, 1250.00), +('毛建龙', '上海', '上海音乐厅', '2026-03-20 20:30:00', '2026-03-20 23:00:00', '看台', 3000, 520, 420.00), +('周杰伦', '广州', '广东省人民体育场', '2026-03-20 20:00:00', '2026-03-20 23:00:00', '内场', 3200, 132, 1620.00), +('周杰伦', '广州', '广东省人民体育场', '2026-03-20 21:00:00', '2026-03-21 00:00:00', '看台', 19000, 4100, 650.00), +('吴岳峰', '北京', '朝阳体育馆', '2026-03-20 20:00:00', '2026-03-20 23:00:00', 'VIP', 380, 75, 1150.00), +('邓秋月', '上海', '上海交响乐团音乐厅', '2026-03-20 20:00:00', '2026-03-20 22:30:00', '内场', 1200, 190, 950.00), +('毛建龙', '广州', '星海音乐厅', '2026-03-20 20:00:00', '2026-03-20 22:30:00', '看台', 4500, 920, 380.00), + +-- 2026-03-21 +('周杰伦', '北京', '国家游泳中心(水立方)', '2026-03-21 19:00:00', '2026-03-21 22:00:00', 'VIP', 480, 55, 1950.00), +('周杰伦', '北京', '国家游泳中心(水立方)', '2026-03-21 20:00:00', '2026-03-21 23:00:00', '看台', 14000, 2600, 610.00), +('吴岳峰', '上海', '上海文化广场', '2026-03-21 20:00:00', '2026-03-21 23:00:00', '内场', 1800, 145, 990.00), +('邓秋月', '广州', '广州友谊剧院', '2026-03-21 19:30:00', '2026-03-21 22:30:00', 'VIP', 280, 40, 1320.00), +('毛建龙', '北京', '天桥艺术中心', '2026-03-21 20:30:00', '2026-03-21 23:00:00', '看台', 3500, 680, 410.00), +('周杰伦', '上海', '上海世博文化中心', '2026-03-21 20:00:00', '2026-03-21 23:00:00', '内场', 2800, 118, 1720.00), +('周杰伦', '上海', '上海世博文化中心', '2026-03-21 21:00:00', '2026-03-22 00:00:00', '看台', 17000, 3800, 720.00), +('吴岳峰', '广州', '广州白云国际会议中心', '2026-03-21 20:00:00', '2026-03-21 23:00:00', 'VIP', 330, 60, 1220.00), +('邓秋月', '北京', '国家大剧院', '2026-03-21 20:00:00', '2026-03-21 22:30:00', '内场', 1000, 175, 1020.00), +('毛建龙', '上海', '上海国际舞蹈中心', '2026-03-21 20:00:00', '2026-03-21 22:30:00', '看台', 2500, 450, 360.00), + +-- 2026-03-22 +('周杰伦', '广州', '广州海心沙亚运公园', '2026-03-22 19:00:00', '2026-03-22 22:00:00', 'VIP', 520, 70, 1850.00), +('周杰伦', '广州', '广州海心沙亚运公园', '2026-03-22 20:00:00', '2026-03-22 23:00:00', '看台', 15000, 2900, 540.00), +('吴岳峰', '北京', '北京展览馆剧场', '2026-03-22 20:00:00', '2026-03-22 23:00:00', '内场', 2100, 180, 1010.00), +('邓秋月', '上海', '上海音乐谷', '2026-03-22 19:30:00', '2026-03-22 22:30:00', 'VIP', 300, 52, 1350.00), +('毛建龙', '广州', '广州大剧院', '2026-03-22 20:30:00', '2026-03-22 23:00:00', '看台', 4000, 780, 390.00), +('周杰伦', '北京', '北京大学生体育馆', '2026-03-22 20:00:00', '2026-03-22 23:00:00', '内场', 3000, 125, 1780.00), +('周杰伦', '北京', '北京大学生体育馆', '2026-03-22 21:00:00', '2026-03-23 00:00:00', '看台', 18000, 4300, 670.00), +('吴岳峰', '上海', '上海儿童艺术剧场', '2026-03-22 20:00:00', '2026-03-22 23:00:00', 'VIP', 370, 68, 1180.00), +('邓秋月', '广州', '广州艺术博物院', '2026-03-22 20:00:00', '2026-03-22 22:30:00', '内场', 1300, 220, 980.00), +('毛建龙', '北京', '北京喜剧院', '2026-03-22 20:00:00', '2026-03-22 22:30:00', '看台', 2800, 510, 340.00), + +-- 2026-03-23 +('周杰伦', '上海', '上海国际体操中心', '2026-03-23 19:00:00', '2026-03-23 22:00:00', 'VIP', 470, 62, 1980.00), +('周杰伦', '上海', '上海国际体操中心', '2026-03-23 20:00:00', '2026-03-23 23:00:00', '看台', 13000, 2400, 630.00), +('吴岳峰', '广州', '广州体育馆二号馆', '2026-03-23 20:00:00', '2026-03-23 23:00:00', '内场', 1900, 155, 960.00), +('邓秋月', '北京', '北京剧院', '2026-03-23 19:30:00', '2026-03-23 22:30:00', 'VIP', 260, 38, 1420.00), +('毛建龙', '上海', '上海话剧艺术中心', '2026-03-23 20:30:00', '2026-03-23 23:00:00', '看台', 2200, 390, 400.00), +('周杰伦', '广州', '广州体育学院体育馆', '2026-03-23 20:00:00', '2026-03-23 23:00:00', '内场', 2900, 110, 1680.00), +('周杰伦', '广州', '广州体育学院体育馆', '2026-03-23 21:00:00', '2026-03-24 00:00:00', '看台', 16000, 3600, 590.00), +('吴岳峰', '北京', '北京音乐厅', '2026-03-23 20:00:00', '2026-03-23 23:00:00', 'VIP', 350, 72, 1250.00), +('邓秋月', '上海', '上海木偶剧团仙乐斯演艺厅', '2026-03-23 20:00:00', '2026-03-23 22:30:00', '内场', 1100, 185, 1050.00), +('毛建龙', '广州', '广州蓓蕾剧院', '2026-03-23 20:00:00', '2026-03-23 22:30:00', '看台', 3200, 610, 370.00), + +-- 2026-03-24 +('周杰伦', '北京', '北京工人体育馆', '2026-03-24 19:00:00', '2026-03-24 22:00:00', 'VIP', 450, 58, 2050.00), +('周杰伦', '北京', '北京工人体育馆', '2026-03-24 20:00:00', '2026-03-24 23:00:00', '看台', 12000, 2200, 660.00), +('吴岳峰', '上海', '上海国际时尚中心', '2026-03-24 20:00:00', '2026-03-24 23:00:00', '内场', 1700, 142, 920.00), +('邓秋月', '广州', '广州少年宫蓓蕾剧院', '2026-03-24 19:30:00', '2026-03-24 22:30:00', 'VIP', 240, 35, 1550.00), +('毛建龙', '北京', '北京民族文化宫大剧院', '2026-03-24 20:30:00', '2026-03-24 23:00:00', '看台', 2000, 380, 430.00), +('周杰伦', '上海', '上海长宁体操中心', '2026-03-24 20:00:00', '2026-03-24 23:00:00', '内场', 2600, 105, 1820.00), +('周杰伦', '上海', '上海长宁体操中心', '2026-03-24 21:00:00', '2026-03-25 00:00:00', '看台', 14000, 3200, 740.00), +('吴岳峰', '广州', '广州黄花岗剧院', '2026-03-24 20:00:00', '2026-03-24 23:00:00', 'VIP', 310, 65, 1350.00), +('邓秋月', '北京', '北京国图艺术中心', '2026-03-24 20:00:00', '2026-03-24 22:30:00', '内场', 900, 160, 1120.00), +('毛建龙', '上海', '上海人民大舞台', '2026-03-24 20:00:00', '2026-03-24 22:30:00', '看台', 1800, 340, 450.00), + +-- 2026-03-25 +('周杰伦', '广州', '广州天河体育馆', '2026-03-25 19:00:00', '2026-03-25 22:00:00', 'VIP', 490, 68, 1880.00), +('周杰伦', '广州', '广州天河体育馆', '2026-03-25 20:00:00', '2026-03-25 23:00:00', '看台', 17000, 3900, 570.00), +('吴岳峰', '北京', '北京世纪剧院', '2026-03-25 20:00:00', '2026-03-25 23:00:00', '内场', 1600, 130, 940.00), +('邓秋月', '上海', '上海东方艺术中心', '2026-03-25 19:30:00', '2026-03-25 22:30:00', 'VIP', 220, 30, 1620.00), +('毛建龙', '广州', '广州星海音乐厅(交响乐厅)', '2026-03-25 20:30:00', '2026-03-25 23:00:00', '看台', 1500, 290, 480.00), +('周杰伦', '北京', '北京天桥剧场', '2026-03-25 20:00:00', '2026-03-25 23:00:00', '内场', 2400, 98, 1920.00), +('周杰伦', '北京', '北京天桥剧场', '2026-03-25 21:00:00', '2026-03-26 00:00:00', '看台', 15000, 3400, 690.00), +('吴岳峰', '上海', '上海商城剧院', '2026-03-25 20:00:00', '2026-03-25 23:00:00', 'VIP', 290, 55, 1280.00), +('邓秋月', '广州', '广州大剧院实验剧场', '2026-03-25 20:00:00', '2026-03-25 22:30:00', '内场', 800, 140, 1180.00), +('毛建龙', '北京', '北京保利剧院', '2026-03-25 20:00:00', '2026-03-25 22:30:00', '看台', 1200, 230, 520.00); + + + + +truncate weather_data; + +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (1, '北京', '2026-03-18', '06:23:00', '18:24:00', '05:46:00', '17:38:00', '残月', '807', 12, 0, '100', '晴', '150', '晴', 225, '西南风', '1-3', 3, 225, '西南风', '1-3', 3, 0.0, 5, 20, 1013, 25, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (2, '北京', '2026-03-19', '06:21:00', '18:25:00', '06:09:00', '18:48:00', '新月', '800', 16, 2, '100', '晴', '150', '晴', 225, '西南风', '1-3', 3, 45, '东北风', '1-3', 3, 0.0, 4, 19, 1015, 25, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (3, '北京', '2026-03-20', '06:20:00', '18:26:00', '06:34:00', '20:00:00', '蛾眉月', '801', 15, 2, '100', '晴', '150', '晴', 135, '东南风', '1-3', 3, 90, '东风', '1-3', 3, 0.0, 5, 39, 1015, 25, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (4, '北京', '2026-03-21', '06:18:00', '18:27:00', '06:59:00', '21:14:00', '蛾眉月', '801', 18, 3, '101', '多云', '151', '多云', 225, '西南风', '1-3', 3, 315, '西北风', '1-3', 3, 0.0, 5, 25, 1010, 25, 3, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (5, '北京', '2026-03-22', '06:16:00', '18:28:00', '07:30:00', '22:31:00', '蛾眉月', '801', 18, 4, '100', '晴', '151', '多云', 0, '北风', '1-3', 16, 45, '东北风', '1-3', 3, 0.0, 5, 29, 1017, 25, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (6, '北京', '2026-03-23', '06:15:00', '18:29:00', '08:06:00', '23:49:00', '蛾眉月', '801', 16, 4, '101', '多云', '150', '晴', 180, '南风', '1-3', 3, 180, '南风', '1-3', 3, 0.0, 2, 33, 1013, 25, 1, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (7, '北京', '2026-03-24', '06:13:00', '18:30:00', '08:53:00', '00:00:00', '蛾眉月', '801', 18, 5, '100', '晴', '150', '晴', 180, '南风', '1-3', 3, 180, '南风', '1-3', 3, 0.0, 5, 53, 1007, 25, 1, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (8, '北京', '2026-03-25', '06:11:00', '18:31:00', '09:50:00', '01:03:00', '蛾眉月', '801', 22, 10, '101', '多云', '151', '多云', 0, '北风', '1-3', 3, 315, '西北风', '1-3', 3, 0.0, 5, 36, 1005, 25, 1, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (9, '北京', '2026-03-26', '06:10:00', '18:32:00', '10:57:00', '02:08:00', '上弦月', '802', 21, 7, '100', '晴', '104', '阴', 180, '南风', '1-3', 3, 180, '南风', '1-3', 3, 0.0, 5, 12, 1012, 25, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (10, '北京', '2026-03-27', '06:08:00', '18:33:00', '12:12:00', '03:02:00', '盈凸月', '803', 18, 7, '101', '多云', '150', '晴', 315, '西北风', '1-3', 3, 225, '西南风', '1-3', 3, 0.0, 6, 11, 1016, 25, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (11, '北京', '2026-03-28', '06:07:00', '18:34:00', '13:28:00', '03:44:00', '盈凸月', '803', 21, 9, '104', '阴', '104', '阴', 180, '南风', '1-3', 3, 0, '北风', '1-3', 16, 0.0, 6, 13, 1015, 25, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (12, '北京', '2026-03-29', '06:05:00', '18:35:00', '14:42:00', '04:17:00', '盈凸月', '803', 17, 7, '101', '多云', '151', '多云', 0, '北风', '1-3', 16, 315, '西北风', '1-3', 16, 0.1, 6, 13, 1016, 25, 40, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (13, '北京', '2026-03-30', '06:03:00', '18:36:00', '15:53:00', '04:45:00', '盈凸月', '803', 16, 8, '104', '阴', '104', '阴', 315, '西北风', '1-3', 3, 0, '北风', '1-3', 16, 0.0, 2, 22, 1008, 25, 4, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (14, '北京', '2026-03-31', '06:02:00', '18:37:00', '17:00:00', '05:09:00', '盈凸月', '803', 16, 6, '101', '多云', '151', '多云', 0, '北风', '1-3', 3, 0, '北风', '1-3', 16, 0.0, 6, 53, 999, 21, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (15, '北京', '2026-04-01', '06:00:00', '18:38:00', '18:05:00', '05:30:00', '盈凸月', '803', 15, 6, '101', '多云', '150', '晴', 0, '北风', '1-3', 16, 0, '北风', '1-3', 3, 0.0, 2, 25, 1006, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (16, '北京', '2026-04-02', '05:58:00', '18:39:00', '19:09:00', '05:52:00', '满月', '804', 13, 3, '100', '晴', '150', '晴', 276, '西风', '5-6', 39, 304, '西北风', '5-6', 39, 0.0, 6, 28, 995, 25, 20, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (17, '北京', '2026-04-03', '05:57:00', '18:40:00', '20:12:00', '06:13:00', '亏凸月', '805', 17, 4, '101', '多云', '151', '多云', 309, '西北风', '1-3', 19, 276, '西风', '1-3', 17, 0.0, 4, 24, 1010, 24, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (18, '北京', '2026-04-04', '05:55:00', '18:41:00', '21:15:00', '06:38:00', '亏凸月', '805', 19, 4, '100', '晴', '150', '晴', 329, '西北风', '1-3', 19, 336, '西北风', '1-3', 17, 0.0, 6, 25, 1009, 25, 20, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (19, '北京', '2026-04-05', '05:54:00', '18:42:00', '22:18:00', '07:05:00', '亏凸月', '805', 20, 6, '100', '晴', '153', '晴间多云', 51, '东北风', '1-3', 7, 56, '东北风', '1-3', 7, 0.0, 6, 25, 1009, 24, 20, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (20, '北京', '2026-04-06', '05:52:00', '18:43:00', '23:18:00', '07:37:00', '亏凸月', '805', 20, 7, '100', '晴', '153', '晴间多云', 63, '东北风', '1-3', 15, 156, '东南风', '1-3', 15, 0.0, 7, 24, 1012, 23, 10, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (21, '北京', '2026-04-07', '05:50:00', '18:44:00', '00:00:00', '08:16:00', '亏凸月', '805', 21, 9, '101', '多云', '350', '阵雨', 330, '西北风', '1-3', 17, 277, '西风', '1-3', 17, 0.0, 2, 25, 1011, 24, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (22, '北京', '2026-04-08', '05:49:00', '18:45:00', '00:15:00', '09:04:00', '亏凸月', '805', 20, 8, '302', '雷阵雨', '153', '晴间多云', 6, '北风', '4-5', 37, 320, '西北风', '1-3', 19, 1.7, 2, 27, 1012, 25, 62, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (23, '北京', '2026-04-09', '05:47:00', '18:46:00', '01:05:00', '09:59:00', '亏凸月', '805', 15, 6, '100', '晴', '150', '晴', 311, '西北风', '4-5', 33, 347, '西北风', '3-4', 28, 0.0, 7, 24, 1012, 25, 20, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (24, '北京', '2026-04-10', '05:46:00', '18:47:00', '01:49:00', '10:59:00', '下弦月', '806', 18, 4, '100', '晴', '150', '晴', 298, '西北风', '1-3', 19, 219, '西南风', '1-3', 19, 0.0, 7, 26, 1011, 25, 20, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (25, '北京', '2026-04-11', '05:44:00', '18:48:00', '02:26:00', '12:03:00', '残月', '807', 20, 6, '100', '晴', '151', '多云', 34, '东北风', '1-3', 17, 71, '东北风', '1-3', 17, 0.0, 7, 27, 1010, 24, 20, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (26, '北京', '2026-04-12', '05:43:00', '18:49:00', '02:56:00', '13:09:00', '残月', '807', 22, 10, '101', '多云', '153', '晴间多云', 11, '北风', '1-3', 7, 128, '东南风', '1-3', 6, 0.0, 2, 24, 1011, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (27, '北京', '2026-04-13', '05:41:00', '18:50:00', '03:24:00', '14:16:00', '残月', '807', 21, 8, '102', '少云', '150', '晴', 100, '东风', '3-4', 20, 131, '东南风', '3-4', 20, 0.0, 4, 24, 1009, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (28, '北京', '2026-04-14', '05:40:00', '18:51:00', '03:48:00', '15:23:00', '残月', '807', 22, 10, '101', '多云', '151', '多云', 89, '东风', '1-3', 19, 87, '东风', '1-3', 19, 0.0, 2, 24, 1011, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (29, '北京', '2026-04-15', '05:38:00', '18:52:00', '04:11:00', '16:32:00', '残月', '807', 22, 9, '300', '阵雨', '350', '阵雨', 38, '东北风', '1-3', 19, 46, '东北风', '1-3', 19, 1.8, 2, 25, 1012, 24, 56, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (30, '北京', '2026-04-16', '05:37:00', '18:53:00', '04:35:00', '17:42:00', '残月', '807', 17, 8, '101', '多云', '151', '多云', 4, '北风', '1-3', 19, 13, '东北风', '1-3', 17, 0.0, 2, 25, 1010, 23, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (31, '上海', '2026-03-18', '06:02:00', '18:04:00', '05:19:00', '17:20:00', '残月', '807', 13, 6, '305', '小雨', '305', '小雨', 315, '西北风', '1-3', 16, 45, '东北风', '1-3', 3, 4.9, 2, 87, 1022, 24, 91, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (32, '上海', '2026-03-19', '06:01:00', '18:05:00', '05:49:00', '18:23:00', '新月', '800', 13, 6, '101', '多云', '151', '多云', 45, '东北风', '1-3', 3, 90, '东风', '1-3', 3, 0.0, 5, 74, 1021, 24, 3, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (33, '上海', '2026-03-20', '06:00:00', '18:06:00', '06:19:00', '19:28:00', '蛾眉月', '801', 15, 7, '305', '小雨', '104', '阴', 45, '东北风', '1-3', 3, 90, '东风', '1-3', 3, 0.0, 7, 74, 1024, 25, 1, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (34, '上海', '2026-03-21', '05:58:00', '18:06:00', '06:52:00', '20:36:00', '蛾眉月', '801', 16, 10, '101', '多云', '151', '多云', 90, '东风', '1-3', 3, 135, '东南风', '1-3', 3, 0.0, 7, 88, 1020, 25, 1, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (35, '上海', '2026-03-22', '05:57:00', '18:07:00', '07:29:00', '21:47:00', '蛾眉月', '801', 18, 12, '104', '阴', '305', '小雨', 180, '南风', '1-3', 3, 45, '东北风', '1-3', 3, 0.0, 3, 95, 1018, 21, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (36, '上海', '2026-03-23', '05:56:00', '18:08:00', '08:11:00', '22:59:00', '蛾眉月', '801', 16, 10, '305', '小雨', '306', '中雨', 90, '东风', '1-3', 3, 45, '东北风', '1-3', 3, 7.7, 2, 94, 1017, 21, 80, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (37, '上海', '2026-03-24', '05:54:00', '18:08:00', '09:01:00', '00:00:00', '蛾眉月', '801', 13, 10, '305', '小雨', '305', '小雨', 45, '东北风', '1-3', 3, 0, '北风', '1-3', 3, 1.3, 2, 92, 1017, 24, 59, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (38, '上海', '2026-03-25', '05:53:00', '18:09:00', '10:01:00', '00:09:00', '蛾眉月', '801', 16, 11, '305', '小雨', '104', '阴', 45, '东北风', '1-3', 3, 90, '东风', '1-3', 3, 2.4, 2, 95, 1016, 25, 56, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (39, '上海', '2026-03-26', '05:52:00', '18:09:00', '11:07:00', '01:14:00', '上弦月', '802', 16, 10, '305', '小雨', '104', '阴', 180, '南风', '1-3', 3, 45, '东北风', '1-3', 3, 0.0, 8, 97, 1016, 24, 0, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (40, '上海', '2026-03-27', '05:51:00', '18:10:00', '12:18:00', '02:11:00', '盈凸月', '803', 21, 10, '104', '阴', '104', '阴', 90, '东风', '1-3', 3, 135, '东南风', '1-3', 3, 0.0, 3, 63, 1021, 25, 1, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (41, '上海', '2026-03-28', '05:49:00', '18:11:00', '13:29:00', '03:00:00', '盈凸月', '803', 18, 13, '104', '阴', '305', '小雨', 135, '东南风', '1-3', 16, 135, '东南风', '1-3', 16, 0.0, 4, 56, 1020, 25, 1, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (42, '上海', '2026-03-29', '05:48:00', '18:11:00', '14:37:00', '03:39:00', '盈凸月', '803', 17, 12, '305', '小雨', '305', '小雨', 315, '西北风', '1-3', 3, 315, '西北风', '1-3', 16, 1.3, 2, 87, 1023, 23, 55, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (43, '上海', '2026-03-30', '05:47:00', '18:12:00', '15:41:00', '04:13:00', '盈凸月', '803', 16, 9, '104', '阴', '151', '多云', 0, '北风', '1-3', 16, 180, '南风', '1-3', 3, 2.3, 4, 68, 1023, 25, 68, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (44, '上海', '2026-03-31', '05:46:00', '18:13:00', '16:42:00', '04:43:00', '盈凸月', '803', 20, 12, '104', '阴', '104', '阴', 180, '南风', '1-3', 3, 180, '南风', '1-3', 3, 0.0, 4, 80, 1015, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (45, '上海', '2026-04-01', '05:44:00', '18:13:00', '17:41:00', '05:10:00', '盈凸月', '803', 20, 11, '104', '阴', '104', '阴', 225, '西南风', '1-3', 3, 0, '北风', '1-3', 16, 0.6, 2, 63, 1017, 25, 55, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (46, '上海', '2026-04-02', '05:43:00', '18:14:00', '18:39:00', '05:37:00', '满月', '804', 18, 10, '101', '多云', '305', '小雨', 4, '北风', '4-5', 32, 12, '东北风', '3-4', 20, 0.5, 2, 65, 1012, 25, 55, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (47, '上海', '2026-04-03', '05:42:00', '18:15:00', '19:36:00', '06:05:00', '亏凸月', '805', 16, 8, '300', '阵雨', '151', '多云', 259, '西风', '1-3', 6, 167, '东南风', '1-3', 11, 0.8, 2, 81, 1019, 25, 56, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (48, '上海', '2026-04-04', '05:41:00', '18:15:00', '20:34:00', '06:34:00', '亏凸月', '805', 17, 10, '101', '多云', '151', '多云', 160, '东南风', '1-3', 7, 148, '东南风', '1-3', 13, 0.0, 5, 80, 1019, 22, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (49, '上海', '2026-04-05', '05:39:00', '18:16:00', '21:31:00', '07:07:00', '亏凸月', '805', 18, 12, '101', '多云', '305', '小雨', 142, '东南风', '3-4', 20, 116, '东南风', '1-3', 19, 0.0, 2, 79, 1018, 23, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (50, '上海', '2026-04-06', '05:38:00', '18:16:00', '22:28:00', '07:44:00', '亏凸月', '805', 17, 11, '305', '小雨', '153', '晴间多云', 76, '东北风', '5-6', 43, 53, '东北风', '4-5', 32, 8.8, 2, 81, 1018, 25, 62, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (51, '上海', '2026-04-07', '05:37:00', '18:17:00', '23:22:00', '08:26:00', '亏凸月', '805', 15, 10, '100', '晴', '153', '晴间多云', 84, '东风', '4-5', 37, 137, '东南风', '5-6', 39, 0.0, 9, 82, 1018, 22, 20, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (52, '上海', '2026-04-08', '05:36:00', '18:18:00', '00:00:00', '09:14:00', '亏凸月', '805', 18, 13, '305', '小雨', '153', '晴间多云', 185, '南风', '5-6', 39, 267, '西风', '4-5', 32, 9.4, 2, 82, 1018, 25, 63, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (53, '上海', '2026-04-09', '05:34:00', '18:18:00', '00:13:00', '10:08:00', '亏凸月', '805', 19, 12, '103', '晴间多云', '151', '多云', 308, '西北风', '4-5', 37, 294, '西北风', '3-4', 28, 0.0, 6, 80, 1020, 24, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (54, '上海', '2026-04-10', '05:33:00', '18:19:00', '00:58:00', '11:05:00', '下弦月', '806', 19, 12, '101', '多云', '151', '多云', 274, '西风', '1-3', 7, 202, '西南风', '1-3', 6, 0.0, 2, 79, 1019, 22, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (55, '上海', '2026-04-11', '05:32:00', '18:20:00', '01:40:00', '12:05:00', '残月', '807', 19, 10, '101', '多云', '153', '晴间多云', 199, '西南风', '1-3', 13, 197, '西南风', '1-3', 15, 0.0, 2, 79, 1017, 24, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (56, '上海', '2026-04-12', '05:31:00', '18:20:00', '02:16:00', '13:06:00', '残月', '807', 17, 9, '100', '晴', '305', '小雨', 166, '东南风', '4-5', 30, 158, '东南风', '4-5', 32, 0.0, 9, 79, 1018, 23, 5, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (57, '上海', '2026-04-13', '05:30:00', '18:21:00', '02:49:00', '14:07:00', '残月', '807', 20, 13, '100', '晴', '150', '晴', 268, '西风', '3-4', 28, 62, '东北风', '1-3', 19, 0.0, 9, 79, 1019, 23, 5, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (58, '上海', '2026-04-14', '05:29:00', '18:22:00', '03:19:00', '15:08:00', '残月', '807', 20, 13, '100', '晴', '151', '多云', 117, '东南风', '4-5', 30, 134, '东南风', '4-5', 30, 0.0, 10, 81, 1019, 25, 10, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (59, '上海', '2026-04-15', '05:27:00', '18:22:00', '03:49:00', '16:10:00', '残月', '807', 20, 14, '305', '小雨', '305', '小雨', 141, '东南风', '4-5', 37, 152, '东南风', '4-5', 35, 5.5, 2, 82, 1017, 23, 60, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (60, '上海', '2026-04-16', '05:26:00', '18:23:00', '04:18:00', '17:13:00', '残月', '807', 20, 15, '305', '小雨', '350', '阵雨', 162, '东南风', '1-3', 19, 196, '西南风', '4-5', 37, 9.1, 2, 80, 1019, 25, 63, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (61, '广州', '2026-03-18', '06:34:00', '18:38:00', '05:49:00', '17:57:00', '残月', '807', 28, 17, '101', '多云', '151', '多云', 0, '北风', '1-3', 3, 0, '北风', '1-3', 3, 0.0, 8, 64, 1012, 25, 16, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (62, '广州', '2026-03-19', '06:33:00', '18:38:00', '06:23:00', '18:55:00', '新月', '800', 27, 19, '101', '多云', '151', '多云', 0, '北风', '1-3', 3, 0, '北风', '1-3', 3, 0.0, 2, 69, 1012, 25, 12, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (63, '广州', '2026-03-20', '06:32:00', '18:38:00', '06:57:00', '19:55:00', '蛾眉月', '801', 27, 19, '101', '多云', '151', '多云', 0, '北风', '1-3', 3, 0, '北风', '1-3', 3, 1.0, 3, 73, 1015, 25, 80, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (64, '广州', '2026-03-21', '06:31:00', '18:39:00', '07:36:00', '20:58:00', '蛾眉月', '801', 27, 18, '101', '多云', '151', '多云', 0, '北风', '1-3', 3, 0, '北风', '1-3', 3, 0.0, 6, 73, 1014, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (65, '广州', '2026-03-22', '06:30:00', '18:39:00', '08:17:00', '22:03:00', '蛾眉月', '801', 28, 19, '101', '多云', '151', '多云', 180, '南风', '1-3', 16, 0, '北风', '1-3', 3, 0.0, 3, 68, 1013, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (66, '广州', '2026-03-23', '06:29:00', '18:39:00', '09:04:00', '23:11:00', '蛾眉月', '801', 28, 20, '101', '多云', '151', '多云', 180, '南风', '1-3', 16, 0, '北风', '1-3', 3, 0.0, 3, 68, 1010, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (67, '广州', '2026-03-24', '06:28:00', '18:40:00', '09:58:00', '00:00:00', '蛾眉月', '801', 29, 21, '100', '晴', '151', '多云', 0, '北风', '1-3', 3, 0, '北风', '1-3', 3, 0.0, 3, 67, 1010, 25, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (68, '广州', '2026-03-25', '06:27:00', '18:40:00', '10:59:00', '00:20:00', '蛾眉月', '801', 28, 18, '100', '晴', '150', '晴', 180, '南风', '1-3', 3, 180, '南风', '1-3', 3, 0.0, 10, 66, 1011, 25, 3, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (69, '广州', '2026-03-26', '06:26:00', '18:41:00', '12:05:00', '01:25:00', '上弦月', '802', 29, 19, '100', '晴', '150', '晴', 180, '南风', '1-3', 3, 135, '东南风', '1-3', 3, 0.0, 9, 61, 1011, 25, 7, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (70, '广州', '2026-03-27', '06:25:00', '18:41:00', '13:13:00', '02:23:00', '盈凸月', '803', 30, 21, '101', '多云', '151', '多云', 180, '南风', '1-3', 3, 180, '南风', '1-3', 3, 0.0, 10, 65, 1011, 25, 7, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (71, '广州', '2026-03-28', '06:24:00', '18:41:00', '14:20:00', '03:14:00', '盈凸月', '803', 30, 20, '101', '多云', '104', '阴', 180, '南风', '1-3', 16, 180, '南风', '1-3', 16, 0.0, 10, 67, 1012, 25, 4, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (72, '广州', '2026-03-29', '06:23:00', '18:42:00', '15:22:00', '03:59:00', '盈凸月', '803', 31, 21, '104', '阴', '104', '阴', 135, '东南风', '1-3', 16, 180, '南风', '1-3', 3, 0.0, 10, 64, 1012, 25, 4, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (73, '广州', '2026-03-30', '06:22:00', '18:42:00', '16:22:00', '04:38:00', '盈凸月', '803', 32, 18, '305', '小雨', '305', '小雨', 0, '北风', '1-3', 3, 0, '北风', '1-3', 16, 0.3, 4, 66, 1014, 23, 55, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (74, '广州', '2026-03-31', '06:21:00', '18:42:00', '17:18:00', '05:12:00', '盈凸月', '803', 23, 19, '104', '阴', '104', '阴', 90, '东风', '1-3', 3, 135, '东南风', '1-3', 3, 1.3, 4, 64, 1014, 25, 61, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (75, '广州', '2026-04-01', '06:20:00', '18:43:00', '18:12:00', '05:44:00', '盈凸月', '803', 28, 20, '305', '小雨', '305', '小雨', 135, '东南风', '1-3', 3, 0, '北风', '1-3', 3, 0.0, 4, 59, 1012, 24, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (76, '广州', '2026-04-02', '06:19:00', '18:43:00', '19:05:00', '06:16:00', '满月', '804', 26, 20, '101', '多云', '153', '晴间多云', 140, '东南风', '1-3', 17, 163, '东南风', '1-3', 19, 1.0, 4, 60, 1010, 24, 55, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (77, '广州', '2026-04-03', '06:19:00', '18:43:00', '19:58:00', '06:48:00', '亏凸月', '805', 27, 20, '101', '多云', '151', '多云', 160, '东南风', '1-3', 15, 171, '南风', '1-3', 17, 1.0, 4, 68, 1010, 25, 55, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (78, '广州', '2026-04-04', '06:18:00', '18:44:00', '20:52:00', '07:21:00', '亏凸月', '805', 27, 19, '101', '多云', '151', '多云', 164, '东南风', '1-3', 19, 174, '南风', '1-3', 19, 0.0, 3, 67, 1013, 23, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (79, '广州', '2026-04-05', '06:17:00', '18:44:00', '21:46:00', '07:58:00', '亏凸月', '805', 27, 20, '300', '阵雨', '350', '阵雨', 168, '东南风', '3-4', 24, 166, '东南风', '3-4', 24, 0.8, 3, 67, 1011, 23, 57, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (80, '广州', '2026-04-06', '06:16:00', '18:44:00', '22:40:00', '08:38:00', '亏凸月', '805', 27, 20, '302', '雷阵雨', '350', '阵雨', 178, '南风', '1-3', 19, 150, '东南风', '1-3', 17, 1.8, 3, 68, 1011, 25, 64, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (81, '广州', '2026-04-07', '06:15:00', '18:45:00', '23:33:00', '09:22:00', '亏凸月', '805', 27, 20, '302', '雷阵雨', '151', '多云', 143, '东南风', '3-4', 24, 170, '南风', '3-4', 24, 1.7, 3, 65, 1011, 25, 64, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (82, '广州', '2026-04-08', '06:14:00', '18:45:00', '00:00:00', '10:11:00', '亏凸月', '805', 27, 21, '302', '雷阵雨', '153', '晴间多云', 201, '西南风', '4-5', 30, 172, '南风', '4-5', 30, 2.1, 4, 68, 1013, 25, 64, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (83, '广州', '2026-04-09', '06:13:00', '18:46:00', '00:24:00', '11:05:00', '亏凸月', '805', 27, 21, '302', '雷阵雨', '302', '雷阵雨', 108, '东南风', '1-3', 7, 124, '东南风', '1-3', 11, 15.9, 3, 66, 1012, 25, 70, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (84, '广州', '2026-04-10', '06:12:00', '18:46:00', '01:11:00', '12:01:00', '下弦月', '806', 26, 20, '302', '雷阵雨', '302', '雷阵雨', 167, '东南风', '1-3', 19, 303, '西北风', '1-3', 15, 16.2, 3, 68, 1013, 23, 70, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (85, '广州', '2026-04-11', '06:11:00', '18:46:00', '01:55:00', '12:57:00', '残月', '807', 27, 18, '103', '晴间多云', '150', '晴', 354, '北风', '3-4', 20, 16, '东北风', '1-3', 15, 0.0, 5, 65, 1010, 23, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (86, '广州', '2026-04-12', '06:10:00', '18:47:00', '02:35:00', '13:54:00', '残月', '807', 27, 19, '101', '多云', '153', '晴间多云', 327, '西北风', '1-3', 6, 177, '南风', '1-3', 11, 0.0, 7, 65, 1013, 24, 25, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (87, '广州', '2026-04-13', '06:09:00', '18:47:00', '03:11:00', '14:50:00', '残月', '807', 26, 21, '302', '雷阵雨', '302', '雷阵雨', 63, '东北风', '1-3', 6, 85, '东风', '1-3', 6, 15.1, 4, 66, 1011, 25, 69, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (88, '广州', '2026-04-14', '06:08:00', '18:47:00', '03:47:00', '15:46:00', '残月', '807', 27, 21, '300', '阵雨', '350', '阵雨', 131, '东南风', '4-5', 30, 167, '东南风', '4-5', 30, 2.6, 3, 67, 1014, 25, 65, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (89, '广州', '2026-04-15', '06:07:00', '18:48:00', '04:21:00', '16:43:00', '残月', '807', 28, 21, '300', '阵雨', '151', '多云', 173, '南风', '5-6', 39, 170, '南风', '5-6', 39, 1.1, 5, 66, 1011, 25, 60, '2026-03-18 17:02:00'); +INSERT INTO travel_rag.weather_data (id, city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, temp_max, temp_min, icon_day, text_day, icon_night, text_night, wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, precip, uv_index, humidity, pressure, vis, cloud, update_time) VALUES (90, '广州', '2026-04-16', '06:06:00', '18:48:00', '04:55:00', '17:42:00', '残月', '807', 28, 22, '300', '阵雨', '153', '晴间多云', 174, '南风', '5-6', 39, 162, '东南风', '4-5', 37, 0.6, 6, 65, 1013, 25, 56, '2026-03-18 17:02:00'); +commit; \ No newline at end of file diff --git a/demo_a2a_protocol/a2a_agent_network.py b/demo/a2a_protocol/a2a_agent_network.py similarity index 100% rename from demo_a2a_protocol/a2a_agent_network.py rename to demo/a2a_protocol/a2a_agent_network.py diff --git a/demo_a2a_protocol/a2a_agent_router.py b/demo/a2a_protocol/a2a_agent_router.py similarity index 100% rename from demo_a2a_protocol/a2a_agent_router.py rename to demo/a2a_protocol/a2a_agent_router.py diff --git a/demo_a2a_protocol/a2a_client.py b/demo/a2a_protocol/a2a_client.py similarity index 100% rename from demo_a2a_protocol/a2a_client.py rename to demo/a2a_protocol/a2a_client.py diff --git a/demo_a2a_protocol/a2a_server.py b/demo/a2a_protocol/a2a_server.py similarity index 100% rename from demo_a2a_protocol/a2a_server.py rename to demo/a2a_protocol/a2a_server.py diff --git a/demo_agent/muiti_agent.py b/demo/agent/muiti_agent.py similarity index 100% rename from demo_agent/muiti_agent.py rename to demo/agent/muiti_agent.py diff --git a/demo_agent/planning_agent.py b/demo/agent/planning_agent.py similarity index 100% rename from demo_agent/planning_agent.py rename to demo/agent/planning_agent.py diff --git a/demo_agent/react_agent.py b/demo/agent/react_agent.py similarity index 100% rename from demo_agent/react_agent.py rename to demo/agent/react_agent.py diff --git a/demo_agent/reflection_agent.py b/demo/agent/reflection_agent.py similarity index 100% rename from demo_agent/reflection_agent.py rename to demo/agent/reflection_agent.py diff --git a/demo_agent/tool_calling_agent.py b/demo/agent/tool_calling_agent.py similarity index 100% rename from demo_agent/tool_calling_agent.py rename to demo/agent/tool_calling_agent.py diff --git a/demo_function_call/_@tool.py b/demo/function_call/_@tool.py similarity index 100% rename from demo_function_call/_@tool.py rename to demo/function_call/_@tool.py diff --git a/demo_function_call/_pydantic.py b/demo/function_call/_pydantic.py similarity index 100% rename from demo_function_call/_pydantic.py rename to demo/function_call/_pydantic.py diff --git a/demo_function_call/agent.py b/demo/function_call/agent.py similarity index 100% rename from demo_function_call/agent.py rename to demo/function_call/agent.py diff --git a/demo_function_call/json_schema.py b/demo/function_call/json_schema.py similarity index 100% rename from demo_function_call/json_schema.py rename to demo/function_call/json_schema.py diff --git a/demo_mcp/a2a_agent.py b/demo/mcp/a2a_agent.py similarity index 100% rename from demo_mcp/a2a_agent.py rename to demo/mcp/a2a_agent.py diff --git a/demo_mcp/a2a_client.py b/demo/mcp/a2a_client.py similarity index 100% rename from demo_mcp/a2a_client.py rename to demo/mcp/a2a_client.py diff --git a/demo_mcp/a2a_server.py b/demo/mcp/a2a_server.py similarity index 100% rename from demo_mcp/a2a_server.py rename to demo/mcp/a2a_server.py diff --git a/demo_mcp/sse_agent.py b/demo/mcp/sse_agent.py similarity index 100% rename from demo_mcp/sse_agent.py rename to demo/mcp/sse_agent.py diff --git a/demo_mcp/sse_client.py b/demo/mcp/sse_client.py similarity index 100% rename from demo_mcp/sse_client.py rename to demo/mcp/sse_client.py diff --git a/demo_mcp/sse_server.py b/demo/mcp/sse_server.py similarity index 100% rename from demo_mcp/sse_server.py rename to demo/mcp/sse_server.py diff --git a/demo_mcp/stdio_agent.py b/demo/mcp/stdio_agent.py similarity index 100% rename from demo_mcp/stdio_agent.py rename to demo/mcp/stdio_agent.py diff --git a/demo_mcp/stdio_client.py b/demo/mcp/stdio_client.py similarity index 100% rename from demo_mcp/stdio_client.py rename to demo/mcp/stdio_client.py diff --git a/demo_mcp/stdio_server.py b/demo/mcp/stdio_server.py similarity index 100% rename from demo_mcp/stdio_server.py rename to demo/mcp/stdio_server.py diff --git a/demo_mcp/streamable_agent.py b/demo/mcp/streamable_agent.py similarity index 100% rename from demo_mcp/streamable_agent.py rename to demo/mcp/streamable_agent.py diff --git a/demo_mcp/streamable_client.py b/demo/mcp/streamable_client.py similarity index 100% rename from demo_mcp/streamable_client.py rename to demo/mcp/streamable_client.py diff --git a/demo_mcp/streamable_server.py b/demo/mcp/streamable_server.py similarity index 100% rename from demo_mcp/streamable_server.py rename to demo/mcp/streamable_server.py diff --git a/mcp_server/__init__.py b/mcp_server/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mcp_server/_mcp_client_test.py b/mcp_server/_mcp_client_test.py new file mode 100644 index 0000000..43c9382 --- /dev/null +++ b/mcp_server/_mcp_client_test.py @@ -0,0 +1,143 @@ +import asyncio +import json + +from langchain.agents import create_tool_calling_agent, AgentExecutor +from langchain_core.prompts import ChatPromptTemplate +from langchain_mcp_adapters.tools import load_mcp_tools +from langchain_openai import ChatOpenAI +from mcp import ClientSession +from mcp.client.streamable_http import streamablehttp_client + +from conf import settings +from create_logger import logger + +# 初始化LLM +llm = ChatOpenAI( + model=settings.model_name, + base_url=settings.base_url, + api_key=settings.api_key, + temperature=0.1 +) + + +async def test_ticket_mcp(): + try: + # 启动 MCP server,通过streamable建立连接 + async with streamablehttp_client("http://127.0.0.1:8001/mcp") as (read, write, _): + # 使用读写通道创建 MCP 会话 + async with ClientSession(read, write) as session: + try: + await session.initialize() + print("会话初始化成功,可以开始调用工具。") + + # 从 session 自动获取 MCP server 提供的工具列表。 + tools = await load_mcp_tools(session) + print(f"tools-->{tools}") + + # 调用远程工具 + # 测试1: 查询机票 + sql_flights = "SELECT * FROM flight_tickets WHERE departure_city = '上海' AND arrival_city = '北京' AND DATE(departure_time) = '2025-10-28' AND cabin_type = '公务舱'" + result_flights = await session.call_tool("query_tickets", {"sql": sql_flights}) + result_flights_data = json.loads(result_flights) if isinstance(result_flights, str) else result_flights + print(f"机票查询结果:{result_flights_data}") + + # 测试2: 查询火车票 + sql_trains = "SELECT * FROM train_tickets WHERE departure_city = '北京' AND arrival_city = '上海' AND DATE(departure_time) = '2025-10-22' AND seat_type = '二等座'" + result_trains = await session.call_tool("query_tickets", {"sql": sql_trains}) + result_trains_data = json.loads(result_trains) if isinstance(result_trains, str) else result_trains + print(f"火车票查询结果:{result_trains_data}") + + # 测试3: 查询演唱会票 + sql_concerts = "SELECT * FROM concert_tickets WHERE city = '北京' AND artist = '刀郎' AND DATE(start_time) = '2025-10-31' AND ticket_type = '看台'" + result_concerts = await session.call_tool("query_tickets", {"sql": sql_concerts}) + result_concerts_data = json.loads(result_concerts) if isinstance(result_concerts, str) else result_concerts + print(f"演唱会票查询结果:{result_concerts_data}") + except Exception as e: + print(f"票务 MCP 测试出错:{str(e)}") + except Exception as e: + print(f"连接或会话初始化时发生错误: {e}") + print("请确认服务端脚本已启动并运行在 http://127.0.0.1:8001/mcp") + + +async def test_weather_mcp(): + try: + # 启动 MCP server,通过streamable建立连接 + async with streamablehttp_client("http://127.0.0.1:8002/mcp") as (read, write, _): + # 使用读写通道创建 MCP 会话 + async with ClientSession(read, write) as session: + try: + await session.initialize() + print("会话初始化成功,可以开始调用工具。") + + # 从 session 自动获取 MCP server 提供的工具列表。 + tools = await load_mcp_tools(session) + print(f"tools-->{tools}") + + # 测试1: 查询指定日期天气 + sql = "SELECT * FROM weather_data WHERE city = '北京' AND fx_date = '2025-10-28'" + result = await session.call_tool("query_weather", {"sql": sql}) + result_data = json.loads(result) if isinstance(result, str) else result + print(f"指定日期天气结果:{result_data}") + + # 测试2: 查询未来3天天气 + sql_range = "SELECT * FROM weather_data WHERE city = '北京' AND fx_date BETWEEN '2025-10-28' AND '2025-10-30'" + result_range = await session.call_tool("query_weather", {"sql": sql_range}) + result_range_data = json.loads(result_range) if isinstance(result_range, str) else result_range + print(f"天气范围查询结果:{result_range_data}") + except Exception as e: + print(f"天气 MCP 测试出错:{str(e)}") + except Exception as e: + print(f"连接或会话初始化时发生错误: {e}") + print("请确认服务端脚本已启动并运行在 http://127.0.0.1:8002/mcp") + + +async def order_tickets(query): + try: + # 启动 MCP server,通过streamable建立连接 + async with streamablehttp_client("http://127.0.0.1:8003/mcp") as (read, write, _): + # 使用读写通道创建 MCP 会话 + async with ClientSession(read, write) as session: + try: + await session.initialize() + + # 从 session 自动获取 MCP server 提供的工具列表。 + tools = await load_mcp_tools(session) + # print(f"tools-->{tools}") + + # 创建 agent 的提示模板 + prompt = ChatPromptTemplate.from_messages([ + ("system", + "你是一个票务预定助手,能够调用工具来完成火车票、飞机票或演出票的预定。你需要仔细分析工具需要的参数,然后从用户提供的信息中提取信息。如果用户提供的信息不足以提取到调用工具所有必要参数,则向用户追问,以获取该信息。不能自己编撰参数。"), + ("human", "{input}"), + ("placeholder", "{agent_scratchpad}"), + ]) + + # 构建工具调用代理 + agent = create_tool_calling_agent(llm, tools, prompt) + + # 创建代理执行器 + agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True) + + # 代理调用 + response = await agent_executor.ainvoke({"input": query}) + + return response['output'] + except Exception as e: + logger.info(f"票务 MCP 测试出错:{str(e)}") + return f"票务 MCP 查询出错:{str(e)}" + except Exception as e: + logger.error(f"连接或会话初始化时发生错误: {e}") + return "连接或会话初始化时发生错误" + + +if __name__ == "__main__": + + asyncio.run(test_ticket_mcp()) + + asyncio.run(test_weather_mcp()) + + while True: + query = input("请输入查询:") + if query == "exit": + break + print(asyncio.run(order_tickets(query))) \ No newline at end of file diff --git a/mcp_server/order_server.py b/mcp_server/order_server.py new file mode 100644 index 0000000..1a4a614 --- /dev/null +++ b/mcp_server/order_server.py @@ -0,0 +1,81 @@ +from mcp.server.fastmcp import FastMCP + +from conf import settings +from create_logger import logger + +# 创建FastMCP实例 +order_mcp = FastMCP(name="OrderTools", + instructions="票务预定工具,通过调用API完成火车票、飞机票和演唱会票的预定。", + log_level="ERROR", + host="127.0.0.1", port=8003) + + +@order_mcp.tool( + name="order_train", + description="根据时间、车次、座位类型、数量预定火车票" +) +def order_train(departure_date: str, train_number: str, seat_type: str, number: int) -> str: + ''' + Args: + departure_date (str): 出发日期,如 '2025-10-30' + train_number (str): 火车车次,如 'G346' + seat_type (str): 座位类型,如 '二等座' + number (int): 订购张数 + ''' + logger.info(f"正在订购火车票: {departure_date}, {train_number}, {seat_type}, {number}") + logger.info(f"恭喜,火车票预定成功!") + return "恭喜,火车票预定成功!" + +@order_mcp.tool( + name="order_flight", + description="根据时间、班次、座位类型、数量预定飞机票" +) +def order_flight(departure_date: str, flight_number: str, seat_type: str, number: int) -> str: + ''' + Args: + departure_date (str): 出发日期,如 '2025-10-30' + flight_number (str): 飞机班次,如 'CA6557' + seat_type (str): 座位类型,如 '经济舱' + number (int): 订购张数 + ''' + logger.info(f"正在订购飞机票: {departure_date}, {flight_number}, {seat_type}, {number}") + logger.info(f"恭喜,飞机票预定成功!") + return "恭喜,飞机票预定成功!" + + +@order_mcp.tool( + name="order_concert", + description="根据时间、明星、场地、座位类型、数量预定演出票" +) +def order_concert(start_date: str, aritist: str, venue: str, seat_type: str, number: int) -> str: + ''' + Args: + start_date (str): 开始日期,如 '2025-10-30' + aritist (str): 明星,如 '刀郎' + venue (str): 场地,如 '上海体育馆' + seat_type (str): 座位类型,如 '看台' + number (int): 订购张数 + ''' + logger.info(f"正在订购演出票: {start_date}, {aritist}, {venue}, {seat_type}, {number}") + logger.info(f"恭喜,演出票预定成功!") + return "恭喜,演出票预定成功!" + + +# 创建票务预定MCP服务器 +def create_order_mcp_server(): + # 打印服务器信息 + logger.info("=== 票务预定MCP服务器信息 ===") + logger.info(f"名称: {order_mcp.name}") + logger.info(f"描述: {order_mcp.instructions}") + + # 运行服务器 + try: + print("服务器已启动,请访问 http://127.0.0.1:8003/mcp") + order_mcp.run(transport="streamable-http") # 使用 streamable-http 传输方式 + except Exception as e: + print(f"服务器启动失败: {e}") + + +if __name__ == "__main__": + # 调用创建服务器函数 + create_order_mcp_server() \ No newline at end of file diff --git a/mcp_server/ticket_server.py b/mcp_server/ticket_server.py new file mode 100644 index 0000000..91ceb85 --- /dev/null +++ b/mcp_server/ticket_server.py @@ -0,0 +1,38 @@ +from services.sql_service import SqlService +from mcp.server.fastmcp import FastMCP +from create_logger import logger + +# 创建票务MCP服务器 +def create_ticket_mcp_server(): + # 创建FastMCP实例 + ticket_mcp = FastMCP(name="TicketTools", + instructions="票务查询工具,基于 train_tickets, flight_tickets, concert_tickets 表。只支持查询。", + log_level="ERROR", + host="127.0.0.1", port=8001) + + # 实例化票务服务对象 + service = SqlService("票务查询") + + @ticket_mcp.tool( + name="query_tickets", + description="查询票务数据,输入 SQL,如 'SELECT * FROM train_tickets WHERE departure_city = \"北京\" AND arrival_city = \"上海\"'" + ) + def query_tickets(sql: str) -> str: + logger.info(f"执行票务查询: {sql}") + return service.execute_query(sql) + + # 打印服务器信息 + logger.info("=== 票务MCP服务器信息 ===") + logger.info(f"名称: {ticket_mcp.name}") + logger.info(f"描述: {ticket_mcp.instructions}") + + # 运行服务器 + try: + print("服务器已启动,请访问 http://127.0.0.1:8001/mcp") + ticket_mcp.run(transport="streamable-http") # 使用 streamable-http 传输方式 + except Exception as e: + print(f"服务器启动失败: {e}") + + +if __name__ == "__main__": + create_ticket_mcp_server() \ No newline at end of file diff --git a/mcp_server/weather_server.py b/mcp_server/weather_server.py new file mode 100644 index 0000000..80b64e8 --- /dev/null +++ b/mcp_server/weather_server.py @@ -0,0 +1,38 @@ +from services.sql_service import SqlService +from mcp.server.fastmcp import FastMCP +from create_logger import logger + +# 创建天气MCP服务器 +def create_weather_mcp_server(): + # 创建FastMCP实例 + weather_mcp = FastMCP(name="WeatherTools", + instructions="天气查询工具,基于 weather_data 表。", + log_level="ERROR", + host="127.0.0.1", port=8002) + + # 实例化sql查询服务 + service = SqlService("天气查询") + + @weather_mcp.tool( + name="query_weather", + description="查询天气数据,输入 SQL,如 'SELECT * FROM weather_data WHERE city = \"北京\" AND fx_date = \"2025-07-30\"'" + ) + def query_weather(sql: str) -> str: + logger.info(f"执行天气查询: {sql}") + return service.execute_query(sql) + + # 打印服务器信息 + logger.info("=== 天气MCP服务器信息 ===") + logger.info(f"名称: {weather_mcp.name}") + logger.info(f"描述: {weather_mcp.instructions}") + + # 运行服务器 + try: + print("服务器已启动,请访问 http://127.0.0.1:8002/mcp") + weather_mcp.run(transport="streamable-http") # 使用 streamable-http 传输方式 + except Exception as e: + print(f"服务器启动失败: {e}")# 创建天气MCP服务器 + + +if __name__ == "__main__": + create_weather_mcp_server() \ No newline at end of file diff --git a/services/__init__.py b/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/services/sql_service.py b/services/sql_service.py new file mode 100644 index 0000000..a01036a --- /dev/null +++ b/services/sql_service.py @@ -0,0 +1,45 @@ +import mysql.connector +import json +from datetime import date, datetime, timedelta +from decimal import Decimal +from create_logger import logger +from utils.format import DateEncoder, default_encoder +from conf import settings + + +class SqlService: + def __init__(self, service_name="数据库查询"): + # 连接数据库 + self.conn = mysql.connector.connect( + host=settings.mysql_host, + port=settings.mysql_port, + user=settings.mysql_user, + password=settings.mysql_password, + database=settings.mysql_database + ) + self.service_name = service_name + + # 定义执行SQL查询方法,输入SQL字符串,返回JSON字符串 + def execute_query(self, sql: str, no_data_message="未找数据") -> str: + try: + cursor = self.conn.cursor(dictionary=True) + cursor.execute(sql) + results = cursor.fetchall() + cursor.close() + # 格式化结果 + for result in results: # 遍历每个结果字典 + for key, value in result.items(): + if isinstance(value, (date, datetime, timedelta, Decimal)): # 检查值是否为特殊类型 + result[key] = default_encoder(value) # 使用自定义编码器格式化该值 + # 序列化为JSON,如果有结果返回success,否则no_data;使用DateEncoder,非ASCII不转义 + return json.dumps({"status": "success", "data": results} if results else {"status": "no_data", "message": no_data_message}, cls=DateEncoder, ensure_ascii=False) + except Exception as e: + logger.error(f"{self.service_name}错误: {str(e)}") + # 返回错误JSON响应 + return json.dumps({"status": "error", "message": str(e)}, ensure_ascii=False) + + +if __name__ == "__main__": + service = SqlService() + sql = "SELECT * FROM flight_tickets WHERE departure_city = '上海' AND arrival_city = '北京' AND DATE(departure_time) = '2025-10-28' AND cabin_type = '公务舱'" + print(service.execute_query(sql)) \ No newline at end of file diff --git a/utils/__init__.py b/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/utils/format.py b/utils/format.py new file mode 100644 index 0000000..acf4abf --- /dev/null +++ b/utils/format.py @@ -0,0 +1,41 @@ +import json +from datetime import date, datetime, timedelta +from decimal import Decimal + + +def default_encoder(obj): # 定义编码器方法,用于格式化单个对象 + if isinstance(obj, datetime): # 检查是否为datetime,返回带时间的格式化字符串 + return obj.strftime('%Y-%m-%d %H:%M:%S') + if isinstance(obj, date): # 检查是否为date,返回日期格式化字符串 + return obj.strftime('%Y-%m-%d') + if isinstance(obj, timedelta): # 检查是否为timedelta,转换为字符串 + return str(obj) + if isinstance(obj, Decimal): # 检查是否为Decimal,转换为浮点数 + return float(obj) + return obj # 否则返回原对象 + + +# 定义自定义JSON编码器类,继承自json.JSONEncoder,用于处理非标准类型序列化 +class DateEncoder(json.JSONEncoder): + def default(self, obj): # 重写default方法,处理序列化时的默认对象转换 + if isinstance(obj, (date, datetime)): # 检查对象是否为date或datetime类型,对于datetime返回带时间的字符串,对于date返回日期字符串 + return obj.strftime('%Y-%m-%d %H:%M:%S') if isinstance(obj, datetime) else obj.strftime('%Y-%m-%d') + if isinstance(obj, timedelta): # 检查对象是否为timedelta类型,将时间差转换为字符串 + return str(obj) + if isinstance(obj, Decimal): # 检查对象是否为Decimal类型,将Decimal转换为浮点数以兼容JSON + return float(obj) + return super().default(obj) # 对于其他类型,调用父类默认方法 + + +if __name__ == '__main__': + print(default_encoder(datetime(2025, 8, 11, 8, 0))) + print(default_encoder(date(2025, 8, 11))) + print(default_encoder(timedelta(days=1))) + print(default_encoder(Decimal('123.45'))) + print('*'*80) + + encoder = DateEncoder() + print(encoder.default(datetime(2025, 8, 11, 8, 0))) + print(encoder.default(date(2025, 8, 11))) + print(encoder.default(timedelta(days=1))) + print(encoder.default(Decimal('123.45'))) \ No newline at end of file diff --git a/utils/spider_weather.py b/utils/spider_weather.py new file mode 100644 index 0000000..ccd5eef --- /dev/null +++ b/utils/spider_weather.py @@ -0,0 +1,248 @@ +import requests +import mysql.connector +from datetime import datetime, timedelta +import schedule +import time +import json +import gzip +import pytz +from conf import settings + +# 配置 +API_KEY = "a105ce8ca9a84afb984e3a8273071206" +city_codes = { + "北京": "101010100", + "上海": "101020100", + "广州": "101280101", + "深圳": "101280601" +} +BASE_URL = "https://n42pfwg4gh.re.qweatherapi.com/v7/weather/30d" +TZ = pytz.timezone('Asia/Shanghai') # 使用上海时区 + +# MySQL 配置 +db_config = { + "host": settings.mysql_host, + "port": settings.mysql_port, + "user": settings.mysql_user, + "password": settings.mysql_password, + "database": settings.mysql_database, + "charset": "utf8mb4" +} + + +def connect_db(): + """ + 连接数据库 + :return: + """ + return mysql.connector.connect(**db_config) + + +def fetch_weather_data(city, location): + """ + 天气数据的爬取与解析 + :param city: + :param location: + :return: + """ + headers = { + "X-QW-Api-Key": API_KEY, + "Accept-Encoding": "gzip" + } + url = f"{BASE_URL}?location={location}" + try: + response = requests.get(url, headers=headers, timeout=10) + response.raise_for_status() + if response.headers.get('Content-Encoding') == 'gzip': + data = gzip.decompress(response.content).decode('utf-8') + else: + data = response.text + return json.loads(data) + except requests.RequestException as e: + print(f"请求 {city} 天气数据失败: {e}") + return None + except json.JSONDecodeError as e: + print(f"{city} JSON 解析错误: {e}, 响应内容: {response.text[:500]}...") + return None + except gzip.BadGzipFile: + print(f"{city} 数据未正确解压,尝试直接解析: {response.text[:500]}...") + return json.loads(response.text) if response.text else None + + +def get_latest_update_time(cursor, city): + """ + 查询数据更新时间 + :param cursor: + :param city: + :return: + """ + cursor.execute("SELECT MAX(update_time) FROM weather_data WHERE city = %s", (city,)) + result = cursor.fetchone() + return result[0] if result[0] else None + + +def should_update_data(latest_time, force_update=False): + """ + 判断是否需要更新城市天气数据。(检查最新更新时间是否超过 1 天) + :param latest_time: + :param force_update: + :return: + """ + if force_update: + return True + if latest_time is None: + return True + + # 时区问题:确保 latest_time 有时区信息 + if latest_time and latest_time.tzinfo is None: + latest_time = latest_time.replace(tzinfo=TZ) + + current_time = datetime.now(TZ) + return (current_time - latest_time) > timedelta(days=1) + + +def store_weather_data(conn, cursor, city, data): + """ + 写入或更新天气预报数据到数据库。 + :param conn: + :param cursor: + :param city: + :param data: + :return: + """ + if not data or data.get("code") != "200": + print(f"{city} 数据无效,跳过存储。") + return + + daily_data = data.get("daily", []) + update_time = datetime.fromisoformat(data.get("updateTime").replace("+08:00", "+08:00")).replace(tzinfo=TZ) + + for day in daily_data: + fx_date = datetime.strptime(day["fxDate"], "%Y-%m-%d").date() + values = ( + city, fx_date, + day.get("sunrise"), day.get("sunset"), + day.get("moonrise"), day.get("moonset"), + day.get("moonPhase"), day.get("moonPhaseIcon"), + day.get("tempMax"), day.get("tempMin"), + day.get("iconDay"), day.get("textDay"), + day.get("iconNight"), day.get("textNight"), + day.get("wind360Day"), day.get("windDirDay"), day.get("windScaleDay"), day.get("windSpeedDay"), + day.get("wind360Night"), day.get("windDirNight"), day.get("windScaleNight"), day.get("windSpeedNight"), + day.get("precip"), day.get("uvIndex"), + day.get("humidity"), day.get("pressure"), + day.get("vis"), day.get("cloud"), + update_time + ) + insert_query = """ + INSERT INTO weather_data ( + city, fx_date, sunrise, sunset, moonrise, moonset, moon_phase, moon_phase_icon, + temp_max, temp_min, icon_day, text_day, icon_night, text_night, + wind360_day, wind_dir_day, wind_scale_day, wind_speed_day, + wind360_night, wind_dir_night, wind_scale_night, wind_speed_night, + precip, uv_index, humidity, pressure, vis, cloud, update_time + ) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) + ON DUPLICATE KEY UPDATE + sunrise = VALUES(sunrise), sunset = VALUES(sunset), moonrise = VALUES(moonrise), + moonset = VALUES(moonset), moon_phase = VALUES(moon_phase), moon_phase_icon = VALUES(moon_phase_icon), + temp_max = VALUES(temp_max), temp_min = VALUES(temp_min), icon_day = VALUES(icon_day), + text_day = VALUES(text_day), icon_night = VALUES(icon_night), text_night = VALUES(text_night), + wind360_day = VALUES(wind360_day), wind_dir_day = VALUES(wind_dir_day), wind_scale_day = VALUES(wind_scale_day), + wind_speed_day = VALUES(wind_speed_day), wind360_night = VALUES(wind360_night), + wind_dir_night = VALUES(wind_dir_night), wind_scale_night = VALUES(wind_scale_night), + wind_speed_night = VALUES(wind_speed_night), precip = VALUES(precip), uv_index = VALUES(uv_index), + humidity = VALUES(humidity), pressure = VALUES(pressure), vis = VALUES(vis), + cloud = VALUES(cloud), update_time = VALUES(update_time) + """ + try: + cursor.execute(insert_query, values) + print(f"{city} {fx_date} 数据写入/更新成功: {day.get('textDay')}, 影响行数: {cursor.rowcount}") + conn.commit() + print(f"{city} 事务提交完成。") + except mysql.connector.Error as e: + print(f"{city} {fx_date} 数据库错误: {e}") + conn.rollback() + print(f"{city} 事务回滚。") + + +def update_weather(force_update=False): + """ + 更新所有城市数据 + :param force_update: + :return: + """ + conn = connect_db() + cursor = conn.cursor() + + for city, location in city_codes.items(): + latest_time = get_latest_update_time(cursor, city) + if should_update_data(latest_time, force_update): + print(f"开始更新 {city} 天气数据...") + data = fetch_weather_data(city, location) + if data: + store_weather_data(conn, cursor, city, data) + else: + print(f"{city} 数据已为最新,无需更新。最新更新时间: {latest_time}") + + cursor.close() + conn.close() + + +def setup_scheduler(): + """ + 设置定时任务,每天在 PDT 16:00(北京时间 01:00)调用 update_weather 函数。保证数据的实时性。 + :return: + """ + # 北京时间 1:00 对应 PDT 前一天的 16:00(夏令时) + schedule.every().day.at("16:00").do(update_weather) + while True: + schedule.run_pending() + time.sleep(60) + + +if __name__ == "__main__": + # 初始检查和更新 + with mysql.connector.connect(**db_config) as conn: + cursor = conn.cursor() + cursor.execute(""" + CREATE TABLE IF NOT EXISTS weather_data ( + id INT AUTO_INCREMENT PRIMARY KEY, + city VARCHAR(50) NOT NULL COMMENT '城市名称', + fx_date DATE NOT NULL COMMENT '预报日期', + sunrise TIME COMMENT '日出时间', + sunset TIME COMMENT '日落时间', + moonrise TIME COMMENT '月升时间', + moonset TIME COMMENT '月落时间', + moon_phase VARCHAR(20) COMMENT '月相名称', + moon_phase_icon VARCHAR(10) COMMENT '月相图标代码', + temp_max INT COMMENT '最高温度', + temp_min INT COMMENT '最低温度', + icon_day VARCHAR(10) COMMENT '白天天气图标代码', + text_day VARCHAR(20) COMMENT '白天天气描述', + icon_night VARCHAR(10) COMMENT '夜间天气图标代码', + text_night VARCHAR(20) COMMENT '夜间天气描述', + wind360_day INT COMMENT '白天风向360角度', + wind_dir_day VARCHAR(20) COMMENT '白天风向', + wind_scale_day VARCHAR(10) COMMENT '白天风力等级', + wind_speed_day INT COMMENT '白天风速 (km/h)', + wind360_night INT COMMENT '夜间风向360角度', + wind_dir_night VARCHAR(20) COMMENT '夜间风向', + wind_scale_night VARCHAR(10) COMMENT '夜间风力等级', + wind_speed_night INT COMMENT '夜间风速 (km/h)', + precip DECIMAL(5,1) COMMENT '降水量 (mm)', + uv_index INT COMMENT '紫外线指数', + humidity INT COMMENT '相对湿度 (%)', + pressure INT COMMENT '大气压强 (hPa)', + vis INT COMMENT '能见度 (km)', + cloud INT COMMENT '云量 (%)', + update_time DATETIME COMMENT '数据更新时间', + UNIQUE KEY unique_city_date (city, fx_date) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='天气数据表' + """) + conn.commit() + + # 立即执行一次更新 + update_weather() + + # 启动定时任务 + setup_scheduler() \ No newline at end of file