feat: 更新版权接口与彩票列表展示
This commit is contained in:
+56
-2
@@ -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>',
|
||||
|
||||
+5
-1
@@ -319,13 +319,17 @@
|
||||
ApiClient.get(ApiClient.API.webConfig).catch(function () {
|
||||
return { data: {} };
|
||||
}),
|
||||
ApiClient.get(ApiClient.API.configCopyright).catch(function () {
|
||||
return { data: [] };
|
||||
}),
|
||||
ApiClient.get(ApiClient.API.configSite).catch(function () {
|
||||
return { data: {} };
|
||||
}),
|
||||
]).then(function (results) {
|
||||
if (!CommonUtil.applyWebConfigs) return;
|
||||
CommonUtil.applyWebConfigs(ApiClient.pickData(results[0], {}) || {});
|
||||
CommonUtil.applyWebConfigs(ApiClient.pickData(results[1], {}) || {});
|
||||
CommonUtil.applyCopyrightConfigs(ApiClient.pickData(results[1], []) || []);
|
||||
CommonUtil.applyWebConfigs(ApiClient.pickData(results[2], {}) || {});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user