-- 创建订单同步日志表 CREATE TABLE IF NOT EXISTS `ls_order_sync_log` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '日志ID', `bill_id` int(11) NOT NULL COMMENT '原系统订单ID', `rider_order_id` int(11) DEFAULT NULL COMMENT '骑手订单ID', `rider_id` int(11) DEFAULT NULL COMMENT '骑手ID', `operation_type` varchar(20) NOT NULL COMMENT '操作类型:accept,pickup,delivery,complete,reject,cancel', `old_status` tinyint(4) DEFAULT NULL COMMENT '原状态', `new_status` tinyint(4) DEFAULT NULL COMMENT '新状态', `sync_result` tinyint(4) NOT NULL DEFAULT '0' COMMENT '同步结果:0失败,1成功', `error_msg` text COMMENT '错误信息', `request_data` text COMMENT '请求数据', `response_data` text COMMENT '响应数据', `sync_time` int(11) NOT NULL COMMENT '同步时间', `retry_count` tinyint(4) NOT NULL DEFAULT '0' COMMENT '重试次数', `created_at` int(11) NOT NULL COMMENT '创建时间', `updated_at` int(11) NOT NULL COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_bill_id` (`bill_id`), KEY `idx_rider_order_id` (`rider_order_id`), KEY `idx_rider_id` (`rider_id`), KEY `idx_operation_type` (`operation_type`), KEY `idx_sync_result` (`sync_result`), KEY `idx_sync_time` (`sync_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单状态同步日志表';