feat(recharge): add full virtual recharge flow for aigc credits
- Replace legacy recharge API endpoints with new dedicated VirtualRechargeApi with sensitive request logging - Implement pending order tracking, automatic payment reconciliation, and recovery for interrupted payments - Overhaul recharge component logic to support both pre-defined package and custom amount recharge - Fix currency price formatting to consistently display 2 decimal places for all monetary values - Remove unused xiaoqi-avatar asset and related component imports - Simplify Vite build asset naming configuration - Switch application to test development mode
This commit is contained in:
@@ -24,14 +24,6 @@ function getCurrentCredit() {
|
||||
return request.get("/hotelBiz/credit/current", {});
|
||||
}
|
||||
|
||||
function getRechargeOptions() {
|
||||
return request.get("/hotelBiz/credit/recharge/options", {});
|
||||
}
|
||||
|
||||
function rechargeCredit(args) {
|
||||
return request.post("/hotelBiz/credit/recharge", args);
|
||||
}
|
||||
|
||||
function getCreditLedgerPage(args) {
|
||||
return request.post("/hotelBiz/credit/ledger/page", args);
|
||||
}
|
||||
@@ -55,8 +47,6 @@ export {
|
||||
getAigcGeneratorTaskDetail,
|
||||
createAigcGeneratorTask,
|
||||
getCurrentCredit,
|
||||
getRechargeOptions,
|
||||
rechargeCredit,
|
||||
getCreditLedgerPage,
|
||||
getPointsTopUpAgreement,
|
||||
createAigcGeneratorTaskShare,
|
||||
|
||||
44
src/request/api/VirtualRechargeApi.js
Normal file
44
src/request/api/VirtualRechargeApi.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from "../base/request";
|
||||
|
||||
const VIRTUAL_RECHARGE_BASE_PATH = "/hotelBiz/credit/virtual-recharge";
|
||||
|
||||
const getVirtualRechargeOrderPath = (rechargeOrderNo) => {
|
||||
const normalizedOrderNo = String(rechargeOrderNo || "").trim();
|
||||
if (!normalizedOrderNo) {
|
||||
throw new Error("积分充值订单号不能为空");
|
||||
}
|
||||
|
||||
return `${VIRTUAL_RECHARGE_BASE_PATH}/orders/${encodeURIComponent(normalizedOrderNo)}`;
|
||||
};
|
||||
|
||||
function getVirtualRechargeOptions() {
|
||||
return request.get(`${VIRTUAL_RECHARGE_BASE_PATH}/options`, {});
|
||||
}
|
||||
|
||||
function createVirtualRechargeOrder(args) {
|
||||
return request.post(`${VIRTUAL_RECHARGE_BASE_PATH}/orders`, args, {
|
||||
sensitive: true,
|
||||
});
|
||||
}
|
||||
|
||||
function confirmVirtualRechargeOrder(rechargeOrderNo, args = {}) {
|
||||
const wxLoginCode = String(args?.wxLoginCode || "").trim();
|
||||
const payload = wxLoginCode ? { wxLoginCode } : {};
|
||||
|
||||
return request.post(
|
||||
`${getVirtualRechargeOrderPath(rechargeOrderNo)}/confirm`,
|
||||
payload,
|
||||
{ sensitive: true }
|
||||
);
|
||||
}
|
||||
|
||||
function getVirtualRechargeOrder(rechargeOrderNo) {
|
||||
return request.get(getVirtualRechargeOrderPath(rechargeOrderNo), {});
|
||||
}
|
||||
|
||||
export {
|
||||
confirmVirtualRechargeOrder,
|
||||
createVirtualRechargeOrder,
|
||||
getVirtualRechargeOptions,
|
||||
getVirtualRechargeOrder,
|
||||
};
|
||||
@@ -7,7 +7,7 @@ import { getServiceUrl } from "../api/GetServiceUrlApi";
|
||||
const versionValue = "1.1.3";
|
||||
|
||||
/// 是否是测试版本, 测试版本为true, 发布版本为false
|
||||
const developVersion = false;
|
||||
const developVersion = true;
|
||||
|
||||
// 获取服务地址
|
||||
const getEvnUrl = async () => {
|
||||
|
||||
@@ -14,6 +14,8 @@ const defaultConfig = {
|
||||
};
|
||||
|
||||
function request(url, args = {}, method = "POST", customConfig = {}) {
|
||||
const { sensitive = false, ...requestCustomConfig } = customConfig;
|
||||
customConfig = requestCustomConfig;
|
||||
const appStore = useAppStore();
|
||||
// 判断 url 是否以 http 开头
|
||||
if (!/^http/.test(url)) {
|
||||
@@ -53,7 +55,11 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
||||
header,
|
||||
};
|
||||
|
||||
console.log(`\n\n请求接口: ${url}, \n请求参数: ${JSON.stringify(args)}, \n请求头: ${JSON.stringify(config)}\n\n`);
|
||||
if (sensitive) {
|
||||
console.log(`\n\n请求接口: ${url}, \n敏感请求参数和请求头已隐藏\n\n`);
|
||||
} else {
|
||||
console.log(`\n\n请求接口: ${url}, \n请求参数: ${JSON.stringify(args)}, \n请求头: ${JSON.stringify(config)}\n\n`);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
@@ -62,7 +68,11 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
||||
method,
|
||||
...config,
|
||||
success: (res) => {
|
||||
console.log(`\n\n请求接口: ${url}, \n请求响应: ${JSON.stringify(res)}, \n\n`);
|
||||
if (sensitive) {
|
||||
console.log(`\n\n请求接口: ${url}, \n响应状态: ${res.statusCode || "unknown"}\n\n`);
|
||||
} else {
|
||||
console.log(`\n\n请求接口: ${url}, \n请求响应: ${JSON.stringify(res)}, \n\n`);
|
||||
}
|
||||
|
||||
resolve(res.data);
|
||||
if (res.statusCode && res.statusCode === 424) {
|
||||
|
||||
Reference in New Issue
Block a user