CREATE TABLE `wa_payment_order` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `order_no` varchar(50) NOT NULL COMMENT '订单号',
  `trade_no` varchar(100) DEFAULT NULL COMMENT '支付交易号',
  `pay_type` varchar(20) NOT NULL COMMENT '支付类型: alipay, wechat',
  `type` varchar(20) NOT NULL DEFAULT 'goods' COMMENT '订单类型: recharge(充值), goods(商品), service(服务), other(其他)',
  `amount` decimal(10,2) NOT NULL COMMENT '支付金额',
  `subject` varchar(255) NOT NULL COMMENT '订单标题',
  `status` varchar(20) NOT NULL DEFAULT 'PENDING' COMMENT '订单状态: PENDING, SUCCESS, FAIL, CLOSED, REFUNDED',
  `extra` text COMMENT '额外信息',
  `created_at` int NOT NULL COMMENT '创建时间',
  `updated_at` int NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `order_no` (`order_no`),
  KEY `pay_type` (`pay_type`),
  KEY `type` (`type`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='支付订单表';
