feat: 更新版权接口与彩票列表展示

This commit is contained in:
rain
2026-07-29 16:30:24 +08:00
parent 4c3fbed3a4
commit 2caef697e4
4 changed files with 84 additions and 10 deletions
+56 -2
View File
@@ -178,6 +178,51 @@
let currentPage = 1;
let menuData = [];
let currentLottery = null;
// 付费文章专家展示上限:未列出的彩种/玩法保持接口返回的完整分页。
const paidExpertDisplayLimits = [
{ lotteries: ["fc3d", "福彩3d"], plays: ["独胆"], total: 10 },
{
lotteries: ["fc3d", "福彩3d"],
plays: ["杀1码", "杀码"],
total: 20,
},
{ lotteries: ["pl3", "排列三"], plays: ["独胆"], total: 10 },
{
lotteries: ["pl3", "排列三"],
plays: ["杀1码", "杀码"],
total: 20,
},
{
lotteries: ["ssq", "双色球"],
plays: ["1码定胆", "一码定胆"],
total: 10,
},
{ lotteries: ["qlc", "七乐彩"], plays: ["独胆"], total: 20 },
];
function normalizeDisplayLimitKey(value) {
return String(value || "").replace(/\s/g, "").toLowerCase();
}
function getPaidExpertDisplayLimit(playName) {
const lotteryKeys = [
currentLottery && currentLottery.code,
currentLottery && currentLottery.suoxie,
currentLottery && currentLottery.name,
currentCode,
].map(normalizeDisplayLimitKey);
const playKey = normalizeDisplayLimitKey(playName);
const matchedLimit = paidExpertDisplayLimits.find((item) => {
const lotteryMatched = item.lotteries.some((lottery) =>
lotteryKeys.includes(normalizeDisplayLimitKey(lottery)),
);
const playMatched = item.plays.some(
(name) => playKey === normalizeDisplayLimitKey(name),
);
return lotteryMatched && playMatched;
});
return matchedLimit ? matchedLimit.total : null;
}
// Login status
function logout() {
@@ -523,6 +568,11 @@
return;
}
currentTypeId = typeId;
const displayLimit = getPaidExpertDisplayLimit(getCurrentTypeName());
const maxPage = displayLimit
? Math.ceil(displayLimit / currentRowPageSize)
: Infinity;
currentPage = Math.min(Math.max(1, Number(currentPage) || 1), maxPage);
ApiClient.get(ApiClient.API.payArticleExpertRank, {
menuId: typeId,
issueCount: currentPageSize,
@@ -532,8 +582,12 @@
if (ApiClient.isSuccess(res) && ApiClient.pickData(res, null)) {
const data = ApiClient.pickData(res, {}) || {};
const list = data.records || data.rows || ApiClient.asArray(data);
renderArticles(list);
renderPagination(data.totalRow || data.total || data.count || list.length || 0);
const total = data.totalRow || data.total || data.count || list.length || 0;
const visibleTotal = displayLimit
? Math.min(total, displayLimit)
: total;
renderArticles(ApiClient.asArray(list).slice(0, currentRowPageSize));
renderPagination(visibleTotal);
} else {
$("#articleBody").html(
'<tr><td colspan="5" style="text-align:center;color:var(--text-muted);padding:40px;">暂无数据</td></tr>',