101 lines
1.7 KiB
JavaScript
Raw Normal View History

2025-10-17 17:34:36 +08:00
/**
* 建行生活 API 接口
*
* @author Billy
* @date 2025-01-17
*/
import request from '@/sheep/request';
const ccbApi = {
/**
* URL跳转登录
* 建行App会携带加密参数跳转到此地址
*/
login: (params) => {
return request({
url: '/ccblife/login',
method: 'GET',
params: params,
custom: {
showLoading: true,
auth: false
}
});
},
/**
* 自动登录JSBridge方式
* H5在建行App内打开时通过JSBridge获取用户信息后调用
*/
autoLogin: (data) => {
return request({
url: '/ccblife/autoLogin',
method: 'POST',
data: data,
custom: {
showLoading: true,
auth: false
}
});
},
/**
* 生成支付串
* 用于调起建行收银台
*/
createPayment: (orderId) => {
return request({
url: '/ccbpayment/createPayment',
method: 'POST',
data: {
order_id: orderId
},
custom: {
showLoading: true,
auth: true
}
});
},
/**
2025-10-20 16:36:06 +08:00
* 查询订单支付状态 (轮询用)
*
* 重要: 本接口只查询状态,不更新订单!
* 订单状态由建行异步通知(notify)接口更新
*
* @deprecated paymentCallback已废弃,改用本方法
*/
queryPaymentStatus: (orderId) => {
return request({
url: '/ccbpayment/queryPaymentStatus',
method: 'GET',
params: {
order_id: orderId
},
custom: {
showLoading: false,
auth: true
}
});
},
/**
* @deprecated 2025-01-20 该方法存在安全漏洞,已废弃
* @see queryPaymentStatus
2025-10-17 17:34:36 +08:00
*/
paymentCallback: (data) => {
2025-10-20 16:36:06 +08:00
// 向后兼容:调用查询接口
2025-10-17 17:34:36 +08:00
return request({
url: '/ccbpayment/callback',
method: 'POST',
data: data,
custom: {
showLoading: false,
auth: true
}
});
}
};
export default ccbApi;