diff --git a/config.js b/config.js
index dc1506f..e75d7c9 100644
--- a/config.js
+++ b/config.js
@@ -5,7 +5,7 @@ window.ENV = {
API_BASE_URL: 'http://47.108.24.205:9100',
// API_BASE_URL: 'http://192.168.10.119:9100',
// 后端租户标识,会作为 header tenantId 发送;后面更换租户只改这里。
- TENANT_ID: '000000',
+ TENANT_ID: '936208',
CLIENT_ID: '209ef407810e3856f40870a9f0e769d7',
DEBUG: true,
APP_NAME: 'Lottery App Dev'
@@ -14,7 +14,7 @@ window.ENV = {
production: {
API_BASE_URL: 'http://47.108.24.205:9100',
// 后端租户标识,会作为 header tenantId 发送;后面更换租户只改这里。
- TENANT_ID: '000000',
+ TENANT_ID: '936208',
CLIENT_ID: '209ef407810e3856f40870a9f0e769d7',
DEBUG: false,
APP_NAME: 'Lottery App'
diff --git a/html/login.html b/html/login.html
index f38950c..5837972 100644
--- a/html/login.html
+++ b/html/login.html
@@ -217,6 +217,8 @@
title: "登录安全验证",
subtitle: "拖动滑块完成验证后继续登录",
apiBase: ApiClient.baseUrl || "",
+ tenantId: ApiClient.tenantId || "936208",
+ headers: ApiClient.publicHeaders(),
onSuccess: completeSlideCaptcha,
onCancel: function () {
currentSlideUuid = "";
diff --git a/html/reg.html b/html/reg.html
index e53035e..5001e80 100644
--- a/html/reg.html
+++ b/html/reg.html
@@ -249,6 +249,8 @@
title: "注册安全验证",
subtitle: "拖动滑块完成验证后继续注册",
apiBase: ApiClient.baseUrl || "",
+ tenantId: ApiClient.tenantId || "936208",
+ headers: ApiClient.publicHeaders(),
onSuccess: completeSlideCaptcha,
onCancel: function () {
currentSlideUuid = "";
diff --git a/html/repwd.html b/html/repwd.html
index 6433349..7ef425e 100644
--- a/html/repwd.html
+++ b/html/repwd.html
@@ -229,6 +229,8 @@
title: "找回密码安全验证",
subtitle: "拖动滑块完成验证后继续重置",
apiBase: ApiClient.baseUrl || "",
+ tenantId: ApiClient.tenantId || "936208",
+ headers: ApiClient.publicHeaders(),
onSuccess: completeSlideCaptcha,
onCancel: function () {
currentSlideUuid = "";
diff --git a/html/usercenter.html b/html/usercenter.html
index 9bd989f..848d973 100644
--- a/html/usercenter.html
+++ b/html/usercenter.html
@@ -1157,11 +1157,12 @@
// ====== Purchase Records ======
var purchasePageNum = 1;
+ var purchaseTotalRow = 0;
function loadPurchaseRecords(pageNum) {
purchasePageNum = pageNum || 1;
ApiClient.get(
- "/api/web/mine/purchased-pay-article/list",
+ ApiClient.API.minePurchasedPayArticleList,
{
pageNum: purchasePageNum,
pageSize: pageSize,
@@ -1170,13 +1171,16 @@
)
.then(function (res) {
if (ApiClient.isSuccess(res)) {
+ purchaseTotalRow = pageTotal(res);
renderPurchaseTable(pageRows(res));
- renderPurchasePager(pageTotal(res));
+ renderPurchasePager(purchaseTotalRow);
} else {
+ purchaseTotalRow = 0;
renderPurchaseTable([]);
}
})
.catch(function () {
+ purchaseTotalRow = 0;
renderPurchaseTable([]);
});
}
@@ -1211,6 +1215,37 @@
return money(amount) + (item.payUnit || item.unit || "积分");
}
+ function purchaseDeleteSourceType(item) {
+ var directSourceType = firstValue(item, ["sourceType", "recordSourceType", "bizSourceType", "type", "bizType"], "");
+ var sourceTypeText = String(directSourceType || "").toLowerCase();
+ if (/fc3d|scheme/.test(sourceTypeText) || /方案/.test(String(directSourceType || ""))) {
+ return "fc3d_scheme";
+ }
+ if (/pay[_-]?article|article|preorder/.test(sourceTypeText) || /预购|付费文章/.test(String(directSourceType || ""))) {
+ return "pay_article";
+ }
+
+ return /断组|杀组合|方案/.test(purchaseTitle(item))
+ ? "fc3d_scheme"
+ : "pay_article";
+ }
+
+ function purchaseDeleteRecordId(item) {
+ return firstValue(
+ item,
+ [
+ "recordId",
+ "purchaseRecordId",
+ "purchasedRecordId",
+ "buyRecordId",
+ "payRecordId",
+ "orderRecordId",
+ "id",
+ ],
+ "",
+ );
+ }
+
function purchaseDetailUrl(item) {
var source = String(firstValue(item, ["sourceType", "type", "bizType"], ""));
var title = purchaseTitle(item);
@@ -1244,10 +1279,24 @@
}
$.each(records, function (i, item) {
var url = purchaseDetailUrl(item);
- var action =
- url === "javascript:void(0)"
- ? "-"
- : '查看';
+ var sourceType = purchaseDeleteSourceType(item);
+ var recordId = purchaseDeleteRecordId(item);
+ var actionList = [];
+ if (url !== "javascript:void(0)") {
+ actionList.push('查看');
+ }
+ if (sourceType && recordId) {
+ actionList.push(
+ '',
+ );
+ }
+ var action = actionList.length
+ ? '
' + actionList.join("") + "
"
+ : "-";
$tbody.append(
"" +
"| " +
@@ -1276,6 +1325,45 @@
});
}
+ function deletePurchaseRecord(sourceType, recordId) {
+ if (!sourceType || !recordId) {
+ layui.layer.msg("缺少购买记录信息,无法删除", { icon: 2 });
+ return;
+ }
+
+ layui.layer.confirm(
+ "确定删除这条购买记录吗?",
+ {
+ title: "删除购买记录",
+ btn: ["删除", "取消"],
+ },
+ function (index) {
+ layui.layer.close(index);
+ ApiClient.delete(
+ ApiClient.API.minePurchasedPayArticleDelete(sourceType, recordId),
+ null,
+ { headers: CommonUtil.authHeaders() },
+ )
+ .then(function (res) {
+ if (!ApiClient.isSuccess(res)) {
+ throw new Error((res && (res.msg || res.message)) || "删除购买记录失败");
+ }
+ layui.layer.msg("删除成功", { icon: 1 });
+ var nextPage =
+ purchaseTotalRow > 1 &&
+ purchasePageNum > 1 &&
+ purchaseTotalRow - 1 <= (purchasePageNum - 1) * pageSize
+ ? purchasePageNum - 1
+ : purchasePageNum;
+ loadPurchaseRecords(nextPage);
+ })
+ .catch(function (error) {
+ layui.layer.msg((error && error.message) || "删除购买记录失败", { icon: 2 });
+ });
+ },
+ );
+ }
+
function renderPurchasePager(total) {
layui.laypage.render({
elem: "purchasePager",
@@ -1486,6 +1574,10 @@
loadMenuList();
loadPurchaseRecords(1);
}
+
+ $("#purchaseTableBody").on("click", ".purchase-delete-btn", function () {
+ deletePurchaseRecord($(this).data("sourceType"), $(this).data("recordId"));
+ });
});
CommonUtil.loadPageConfig();
diff --git a/public/css/usercenter.css b/public/css/usercenter.css
index 6596d78..8a30826 100644
--- a/public/css/usercenter.css
+++ b/public/css/usercenter.css
@@ -713,6 +713,27 @@
color: var(--orange);
}
+.purchase-action-box {
+ display: inline-flex;
+ align-items: center;
+ gap: 10px;
+ white-space: nowrap;
+}
+
+.purchase-delete-btn {
+ border: 0;
+ background: transparent;
+ color: var(--red);
+ font-size: 13px;
+ line-height: 1.5;
+ cursor: pointer;
+ padding: 0;
+}
+
+.purchase-delete-btn:hover {
+ color: var(--orange);
+}
+
/* Empty state row */
.uc-table td[colspan] {
text-align: center;
diff --git a/utils/ApiClient.js b/utils/ApiClient.js
index d75c40e..1438f96 100644
--- a/utils/ApiClient.js
+++ b/utils/ApiClient.js
@@ -1,7 +1,7 @@
const ApiClient = {
// 后端租户标识,所有接口请求都会带到 header 里。
// 后面如果租户号更换,只需要改这里的默认值,或在 config.js 里配置 CURRENT_CONFIG.TENANT_ID。
- TENANT_ID: '000000',
+ TENANT_ID: '936208',
API: {
authCode: '/api/web/auth/code',
@@ -69,6 +69,7 @@ const ApiClient = {
minePayArticleList: '/api/web/mine/pay-article/list',
minePayArticleDetail: (id) => `/api/web/mine/pay-article/${encodeURIComponent(id)}`,
minePurchasedPayArticleList: '/api/web/mine/purchased-pay-article/list',
+ minePurchasedPayArticleDelete: (sourceType, recordId) => `/api/web/mine/purchased-pay-article/${encodeURIComponent(sourceType)}/${encodeURIComponent(recordId)}`,
freeArticleDetail: (id) => `/api/web/free-article/${encodeURIComponent(id)}`,
freeArticleRelated: (id) => `/api/web/free-article/${encodeURIComponent(id)}/related`,
freeArticleComments: (id) => `/api/web/free-article/${encodeURIComponent(id)}/comments`,
diff --git a/utils/AuthPageUtil.js b/utils/AuthPageUtil.js
index 85013b8..dacfb1d 100644
--- a/utils/AuthPageUtil.js
+++ b/utils/AuthPageUtil.js
@@ -73,7 +73,7 @@ const AuthPageUtil = {
const isSlideCaptchaUrl = (url) => String(url || '').indexOf('/api/web/auth/slide-captcha') >= 0;
const tenantId = () =>
- typeof ApiClient !== 'undefined' && ApiClient.tenantId ? ApiClient.tenantId : '000000';
+ typeof ApiClient !== 'undefined' && ApiClient.tenantId ? ApiClient.tenantId : '936208';
if (typeof window.fetch === 'function') {
const nativeFetch = window.fetch.bind(window);
@@ -146,7 +146,7 @@ const AuthPageUtil = {
const script = document.createElement('script');
script.src = `${ApiClient.baseUrl}/static/slide-captcha/slide-captcha.js`;
script.dataset.apiBase = ApiClient.baseUrl || '';
- script.dataset.tenantId = ApiClient.tenantId || '000000';
+ script.dataset.tenantId = ApiClient.tenantId || '936208';
script.onload = () => {
if (window.SlideCaptcha) resolve(window.SlideCaptcha);
else reject(new Error('滑动验证组件加载失败'));
@@ -166,7 +166,7 @@ const AuthPageUtil = {
title: options.title || '安全验证',
subtitle: options.subtitle || '拖动滑块完成验证',
apiBase: ApiClient.baseUrl || '',
- tenantId: ApiClient.tenantId || '000000',
+ tenantId: ApiClient.tenantId || '936208',
headers: ApiClient.publicHeaders(),
onSuccess: (result) => {
const data = result || {};
diff --git a/utils/CommonUtil.js b/utils/CommonUtil.js
index 8262ff9..ec61b37 100644
--- a/utils/CommonUtil.js
+++ b/utils/CommonUtil.js
@@ -51,7 +51,7 @@ const CommonUtil = {
const tenantId =
typeof ApiClient !== 'undefined' && ApiClient.tenantId
? ApiClient.tenantId
- : '000000';
+ : '936208';
const headers = { tenantId };
if (token) headers.Authorization = `Bearer ${token}`;
return headers;
|