支付模块开发
支付宝回调日志
数据表设计
DROP TABLE IF EXISTS `mmall_pay_info`;
CREATE TABLE `mmall_pay_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`order_no` bigint(20) DEFAULT NULL COMMENT '订单号',
`pay_platform` int(10) DEFAULT NULL COMMENT '支付平台:1-支付宝,2-微信',
`platform_number` varchar(200) DEFAULT NULL COMMENT '支付宝支付流水号',
`platform_status` varchar(20) DEFAULT NULL COMMENT '支付宝支付状态',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8;
####1.支付
/order/pay.do
http://localhost:8080/order/pay.do?orderNo=1485158676346
request (入参)
orderNo // 支付的订单号
response (返回)
success(成功)
{
"status": 0,
"data": {
"orderNo": "1485158676346", // 订单号
"qrPath": "http://img.happymmall.com/qr-1492329044075.png"
// 二维码 持久化到ftp服务器上的二维码通过nginx反向代理解析出来的url,返回到qrPath字段上
}
}
fail(失败)
{
"status": 1,
"msg": "支付宝生成订单失败"
}
####2.查询订单支付状态
/order/query_order_pay_status.do
http://localhost:8080/order/query_order_pay_status.do?orderNo=1485158676346
request(入参)
orderNo // 订单号
response (返回)
success
{
"status": 0,
"data": true
}
fail
{
"status": 1,
"msg": "该用户并没有该订单,查询无效"
}
####3.支付宝回调
/order/alipay_callback.do
request
HttpServletRequest
response
success
success // 如果不返回success,支付宝会重复的回调
fail
failed