测试验证完成

This commit is contained in:
rain
2026-06-20 11:20:45 +08:00
parent db8ed02602
commit b3e6f3e831
30 changed files with 110 additions and 135 deletions
+1 -1
View File
@@ -180,7 +180,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 && res.code !== 200) return;
var list = ApiClient.asArray(ApiClient.pickData(res, []));
var $nav = $("#navLotteryItems");
+19 -10
View File
@@ -143,6 +143,12 @@
return { Authorization: "Bearer " + token };
}
function escapeJsString(value) {
return String(value == null ? "" : value)
.replace(/\\/g, "\\\\")
.replace(/'/g, "\\'");
}
// Load collection list
function loadCollections() {
const token = localStorage.getItem("token");
@@ -152,10 +158,11 @@
}
ApiClient.get(
"/api/user/collect/list?page=" +
currentPage +
"&pageSize=" +
pageSize,
ApiClient.API.mineFreeCollectList,
{
pageNum: currentPage,
pageSize: pageSize,
},
{ headers: authHeaders() },
).then(function (res) {
if (res.code === 0 && res.data) {
@@ -189,6 +196,8 @@
$grid.append(
'<div class="cxz-collect-card" data-collect-id="' +
(item.id || "") +
'" data-article-id="' +
articleId +
'">' +
'<div class="cxz-card-body">' +
'<div class="cxz-card-title"><a href="' +
@@ -200,9 +209,9 @@
"<span>" +
displayDate +
"</span>" +
'<button class="cxz-card-remove" onclick="removeCollect(this, ' +
(item.id || 0) +
')">取消收藏</button>' +
'<button class="cxz-card-remove" onclick="removeCollect(this, \'' +
escapeJsString(articleId) +
'\')">取消收藏</button>' +
"</div>" +
"</div>" +
"</div>",
@@ -210,15 +219,15 @@
});
}
function removeCollect(btn, collectId) {
function removeCollect(btn, articleId) {
layui.layer.confirm(
"确定要取消收藏吗?",
{ icon: 3, title: "提示" },
function (index) {
layui.layer.close(index);
ApiClient.post(
"/api/user/collect/delete",
{ id: collectId },
ApiClient.API.freeArticleCollect(articleId),
{},
{ headers: authHeaders() },
).then(function (res) {
if (res.code === 0) {
+4 -4
View File
@@ -226,7 +226,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -250,7 +250,7 @@
// Load menu data (3-level cascade)
function loadMenuData() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code === 0 && res.data) {
menuData = res.data;
renderLotteryFilter();
@@ -559,7 +559,7 @@
return;
}
currentTypeId = typeId;
ApiClient.get("/api/web/pay-article/expert-rank", {
ApiClient.get(ApiClient.API.payArticleExpertRank, {
menuId: typeId,
issueCount: currentPageSize,
pageNum: currentPage,
@@ -664,7 +664,7 @@
);
return;
}
ApiClient.get("/api/web/pay-article/expert-rank", {
ApiClient.get(ApiClient.API.payArticleExpertRank, {
menuId: typeId,
issueCount: 50,
pageNum: 1,
+26 -4
View File
@@ -308,10 +308,10 @@
function loadBasicConfig() {
Promise.all([
ApiClient.get("/api/web/config").catch(function () {
ApiClient.get(ApiClient.API.webConfig).catch(function () {
return { data: {} };
}),
ApiClient.get("/api/web/config/site").catch(function () {
ApiClient.get(ApiClient.API.configSite).catch(function () {
return { data: {} };
}),
]).then(function (results) {
@@ -392,8 +392,30 @@
return String((item && (item.expertId || item.createBy || item.accountId)) || createBy || "");
}
function getArticleMenuIdFromMenus(item) {
const menus = ApiClient.asArray(item && item.menus);
const menu =
menus.find(function (entry) {
return entry && entry.type !== "lottery" && (entry.id || entry.menuId);
}) ||
menus.find(function (entry) {
return entry && (entry.id || entry.menuId);
});
return menu ? String(menu.id || menu.menuId || "") : "";
}
function getArticleMenuId(item) {
return String((item && (item.menuId || item.parentId || item.typeId)) || parentId || "");
return String(
(item &&
(item.menuId ||
item.playMenuId ||
item.typeMenuId ||
item.parentId ||
item.typeId ||
getArticleMenuIdFromMenus(item))) ||
parentId ||
"",
);
}
function getArticlePrice(item) {
@@ -423,7 +445,7 @@
if (!item) return [];
const expert = item.expertId || item.createBy || createBy;
const lottery = item.code || item.suoxie || code;
const menu = item.menuId || item.parentId || item.typeId || parentId;
const menu = getArticleMenuId(item);
const issue = getArticleIssue(item);
if (!expert || !issue) return [];
const normalized = function (parts) {
+3 -7
View File
@@ -142,7 +142,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -337,16 +337,12 @@
}
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "cjdlt" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "cjdlt" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
$(document).on("click", ".qishu-but", function () {
+2 -2
View File
@@ -300,10 +300,10 @@
function loadBasicConfig() {
Promise.all([
ApiClient.get("/api/web/config").catch(function () {
ApiClient.get(ApiClient.API.webConfig).catch(function () {
return { data: {} };
}),
ApiClient.get("/api/web/config/site").catch(function () {
ApiClient.get(ApiClient.API.configSite).catch(function () {
return { data: {} };
}),
]).then(function (results) {
+2 -2
View File
@@ -526,7 +526,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (!isApiSuccess(res)) return;
var list = ApiClient.asArray(ApiClient.pickData(res, []));
var $nav = layui.$("#navLotteryItems");
@@ -573,7 +573,7 @@
}
function loadMenuList() {
ApiClient.post("/api/web/menu/getFormatList", {})
ApiClient.loadMenuCompat()
.then(function (res) {
if (!isApiSuccess(res)) throw new Error(res.msg || "获取彩种失败");
menuList = ApiClient.asArray(ApiClient.pickData(res, [])).filter(
+3 -7
View File
@@ -144,7 +144,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -394,16 +394,12 @@
}
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "fc3d" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "fc3d" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
$(document).on("click", ".qishu-but", function () {
+4 -16
View File
@@ -252,7 +252,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(
ApiClient.loadMenuCompat().then(
function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
@@ -288,7 +288,7 @@
}
function getAffInfo() {
return ApiClient.post("/api/web/rebate/getAffInfo", {}, { headers: CommonUtil.authHeaders() });
return ApiClient.get(ApiClient.API.referralShareInfo, null, { headers: CommonUtil.authHeaders() });
}
function copyText(text) {
@@ -442,13 +442,7 @@
},
function (index) {
layer.close(index);
ApiClient.post(
"/api/web/user/applyDistribution",
{},
{
headers: CommonUtil.authHeaders(),
},
)
ApiClient.post(ApiClient.API.referralBind, {}, { headers: CommonUtil.authHeaders() })
.then(function (res) {
if (res.code === 0) {
layer.msg(
@@ -482,13 +476,7 @@
},
function (index) {
layer.close(index);
ApiClient.post(
"/api/web/user/applyExpert",
{},
{
headers: CommonUtil.authHeaders(),
},
)
ApiClient.post(ApiClient.API.expertApply, {}, { headers: CommonUtil.authHeaders() })
.then(function (res) {
if (res.code === 0) {
layer.msg(
+1 -1
View File
@@ -243,7 +243,7 @@
}
function renderTopNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (!isApiSuccess(res)) return;
var list = ApiClient.asArray(ApiClient.pickData(res, []));
var $nav = layui.$("#navLotteryItems");
+1 -1
View File
@@ -139,7 +139,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
+1 -1
View File
@@ -135,7 +135,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
+2 -5
View File
@@ -766,7 +766,7 @@
$("#historyTableBody").html(
'<tr><td colspan="4" class="is-empty">正在加载历史开奖数据...</td></tr>',
);
ApiClient.post("/api/web/lotteryResult/getList", { suoxie: code })
ApiClient.requestLegacyLotteryResultCompat({ suoxie: code })
.then(function (res) {
if (res.code === 0 && res.data) {
historyCache[code] = res.data.records || res.data || [];
@@ -834,10 +834,7 @@
renderAdGroups(data.adList || []);
renderRecommendGrid(data.linkList || []);
renderLinksGrid(data.linkList || []);
ApiClient.post("/api/web/QRCode").then(function (res) {
if (res.code === 0 && res.data)
CommonUtil.generateQRCode(res.data, "downloadQrImg");
});
CommonUtil.generateQRCode(location.origin + "/html/appdown.html", "downloadQrImg");
}
$(function () {
bindStaticEvents();
+3 -7
View File
@@ -142,7 +142,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -303,16 +303,12 @@
}
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "kl8" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "kl8" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
$(document).on("click", ".qishu-but", function () {
+1 -1
View File
@@ -242,7 +242,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (!ApiClient.isSuccess(res) || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
+3 -7
View File
@@ -144,7 +144,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -382,16 +382,12 @@
}
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "pl3" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "pl3" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
$(document).on("click", ".qishu-but", function () {
+3 -7
View File
@@ -145,7 +145,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -311,16 +311,12 @@
}
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "pl5" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "pl5" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
$(document).on("click", ".qishu-but", function () {
+3 -7
View File
@@ -144,7 +144,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -333,16 +333,12 @@
}
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "qlc" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "qlc" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
$(document).on("click", ".qishu-but", function () {
+3 -7
View File
@@ -147,7 +147,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -321,16 +321,12 @@
}
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "qxc" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "qxc" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
$(document).on("click", ".qishu-but", function () {
+1 -1
View File
@@ -466,7 +466,7 @@
AuthPageUtil.startSmsCountdown("#sendSmsBtn", waitSeconds);
throw new Error("__SMS_WAIT__");
}
return AuthPageUtil.sendForgotPasswordSmsCode(
return AuthPageUtil.sendSmsCode(
Object.assign(
{ phoneNumber: $("#phone").val().trim() },
verifyParams,
+2 -2
View File
@@ -335,10 +335,10 @@
function loadBasicConfig() {
Promise.all([
ApiClient.get("/api/web/config").catch(function () {
ApiClient.get(ApiClient.API.webConfig).catch(function () {
return { data: {} };
}),
ApiClient.get("/api/web/config/site").catch(function () {
ApiClient.get(ApiClient.API.configSite).catch(function () {
return { data: {} };
}),
]).then(function (results) {
+3 -7
View File
@@ -142,7 +142,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
@@ -396,16 +396,12 @@
// Load data from API
function loadData() {
ApiClient.post(
"/api/web/lotteryResult/getList",
{ suoxie: "ssq" },
function (res) {
ApiClient.requestLegacyLotteryResultCompat({ suoxie: "ssq" }).then(function (res) {
if (res && res.data) {
allData = res.data;
renderData(currentCount);
}
},
);
});
}
// Period count buttons
+1 -1
View File
@@ -359,7 +359,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
$nav.find(".topbar__nav-link").not(":first").remove();
+7 -16
View File
@@ -815,11 +815,7 @@
// ====== Logout ======
function handleLogout() {
ApiClient.post(
"/api/web/user/logout",
{},
{ headers: CommonUtil.authHeaders() },
)
ApiClient.post(ApiClient.API.authLogout, null, { headers: CommonUtil.authHeaders() })
.then(function (res) {
localStorage.removeItem("token");
window.location.href = "login.html";
@@ -833,10 +829,9 @@
// ====== Sign-in Records ======
function loadSignInRecords(pageNum) {
signInPageNum = pageNum || 1;
ApiClient.post(
"/api/web/user/signIn/getPageList",
ApiClient.get(
ApiClient.API.mineSignInList,
{
delFlag: "0",
pageNum: signInPageNum,
pageSize: 5,
pointsType: 1,
@@ -845,7 +840,7 @@
).then(function (res) {
if (res.code === 0 && res.data) {
renderSignInTable(res.data.records || []);
renderSignInPager(res.data.totalRow);
renderSignInPager(res.data.totalRow || res.data.total || 0);
}
});
}
@@ -898,11 +893,7 @@
// ====== Load Menu for Filter ======
function loadMenuList() {
ApiClient.post(
"/api/web/menu/getFormatList",
{},
{ headers: CommonUtil.authHeaders() },
).then(function (res) {
ApiClient.loadMenuCompat().then(function (res) {
if (res.code === 0 && res.data) {
menuListData = res.data;
// 免费文章 - 只需彩种
@@ -953,7 +944,7 @@
articlePageNum = pageNum || 1;
var menuId = $("#filterLottery").val() || "";
ApiClient.get(
"/api/web/mine/free-article/list",
ApiClient.API.mineFreeArticleList,
{
menuId: menuId,
pageNum: articlePageNum,
@@ -1090,7 +1081,7 @@
$("#paidFilterLottery").val() ||
"";
ApiClient.get(
"/api/web/mine/pay-article/list",
ApiClient.API.minePayArticleList,
{
menuId: menuId,
pageNum: paidArticlePageNum,
+3 -3
View File
@@ -169,7 +169,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(
ApiClient.loadMenuCompat().then(
function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
@@ -205,8 +205,8 @@
function loadDistList(pageNum) {
currentPage = pageNum;
ApiClient.post(
"/api/web/distribution/getPageList",
ApiClient.get(
ApiClient.API.referralInviteList,
{
pageNum: pageNum,
pageSize: pageSize,
+1 -1
View File
@@ -228,7 +228,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(
ApiClient.loadMenuCompat().then(
function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
+1 -1
View File
@@ -272,7 +272,7 @@
}
function renderNav() {
ApiClient.post("/api/web/menu/getFormatList", {}).then(
ApiClient.loadMenuCompat().then(
function (res) {
if (res.code !== 0 || !res.data) return;
var $nav = $("#navLotteryItems");
+1 -1
View File
@@ -29,7 +29,7 @@
CommonUtil.getCurrentUserDetail(
function (data) {
$("#userName").text(data.nickName || data.nickname || data.username || "鐢ㄦ埛");
$("#userName").text(data.nickName || data.nickname || data.username || "用户");
$("#userAvatar").attr("src", data.avatar || "../public/img/userimg.png");
$("#userLevel").text(CommonUtil.getUserLevelText(data));
},
+3 -3
View File
@@ -26,7 +26,7 @@ const ApiClient = {
noticeList: '/api/web/notice/list',
noticeDetail: (id) => `/api/web/notice/${encodeURIComponent(id || '')}`,
friendLinks: '/api/web/link/friend',
otherRecommendLinks: '/api/web/link/other',
otherRecommendLinks: '/api/web/link/other-recommend',
latestLotteryResult: '/api/web/lottery/result/latest',
lotteryResultList: '/api/web/lottery/result/list',
webConfigList: '/api/web/config/list',
@@ -108,8 +108,8 @@ const ApiClient = {
fc3dSchemeList: '/api/web/fc3d/scheme/list',
fc3dSchemeDetail: (id) => `/api/web/fc3d/scheme/${encodeURIComponent(id)}`,
walletPurchaseFc3dScheme: '/api/web/wallet/purchase/fc3d-scheme',
lotteryTrendTools: '/api/web/lottery/trend/tools',
lotteryTrend: '/api/web/lottery/trend',
lotteryTrendTools: '/api/web/lottery/result/trend/tools',
lotteryTrend: '/api/web/lottery/result/trend',
},
get baseUrl() {
+2 -2
View File
@@ -1020,7 +1020,7 @@ const CommonUtil = {
if (!window.__cxzCaiinfoMenuLoading && !window.__cxzCaiinfoMenuMeta && typeof ApiClient !== 'undefined') {
window.__cxzCaiinfoMenuLoading = true;
ApiClient.post('/api/web/menu/getFormatList', {})
ApiClient.loadMenuCompat()
.then((res) => {
window.__cxzCaiinfoMenuMeta = findMenuMeta(res.data || []);
if (typeof window.loadArticles === 'function') window.loadArticles();
@@ -1439,7 +1439,7 @@ const CommonUtil = {
},
loadLinks() {
ApiClient.post('/api/web/link/getList', {}).then((res) => {
ApiClient.loadLinksCompat().then((res) => {
const list = res.data || [];
this.renderLinks(
list.filter((item) => item.type === 1),