|
|
@@ -420,22 +420,24 @@ export async function GetYJBDCArticleList(ctx) {
|
|
420
|
420
|
if (result === 0) {
|
|
421
|
421
|
|
|
422
|
422
|
result = await yjbdc.GetYJBDCArticleList(param);
|
|
423
|
|
-
|
|
424
|
423
|
let menuConfig = constantClass.GetYJBDCGenerateConfig();
|
|
425
|
|
- // 随机选择三个不重复的索引用于今日推荐
|
|
426
|
424
|
let recommendIndices = [];
|
|
427
|
|
- if (result.length > 3) {
|
|
428
|
|
- while (recommendIndices.length < 3) {
|
|
429
|
|
- const randomIndex = Math.floor(Math.random() * (result.length - 4)) + 4; // 从第5条开始随机选择
|
|
430
|
|
- if (!recommendIndices.includes(randomIndex)) {
|
|
431
|
|
- recommendIndices.push(randomIndex);
|
|
|
425
|
+ if (param.IsFine){
|
|
|
426
|
+ // 随机选择三个不重复的索引用于今日推荐
|
|
|
427
|
+
|
|
|
428
|
+ if (result.length > 3) {
|
|
|
429
|
+ while (recommendIndices.length < 3) {
|
|
|
430
|
+ const randomIndex = Math.floor(Math.random() * (result.length - 4)) + 4; // 从第5条开始随机选择
|
|
|
431
|
+ if (!recommendIndices.includes(randomIndex)) {
|
|
|
432
|
+ recommendIndices.push(randomIndex);
|
|
|
433
|
+ }
|
|
432
|
434
|
}
|
|
433
|
|
- }
|
|
434
|
435
|
|
|
435
|
|
- } else {
|
|
436
|
|
- // 如果结果少于3个,全部标记为推荐
|
|
437
|
|
- for (let i = 0; i < result.length; i++) {
|
|
438
|
|
- recommendIndices.push(i);
|
|
|
436
|
+ } else {
|
|
|
437
|
+ // 如果结果少于3个,全部标记为推荐
|
|
|
438
|
+ for (let i = 0; i < result.length; i++) {
|
|
|
439
|
+ recommendIndices.push(i);
|
|
|
440
|
+ }
|
|
439
|
441
|
}
|
|
440
|
442
|
}
|
|
441
|
443
|
|
|
|
@@ -444,8 +446,10 @@ export async function GetYJBDCArticleList(ctx) {
|
|
444
|
446
|
item.CreateTime = moment(item.CreateTime).format("YYYY年MM月DD日 HH:mm");
|
|
445
|
447
|
//debugger;
|
|
446
|
448
|
item.LevelStr = menuConfig.Level[item.Level].Name;
|
|
|
449
|
+
|
|
447
|
450
|
// 添加今日推荐标记
|
|
448
|
|
- item.IsRecommend = recommendIndices.includes(i);
|
|
|
451
|
+ if (param.IsFine)
|
|
|
452
|
+ item.IsRecommend = recommendIndices.includes(i);
|
|
449
|
453
|
}
|
|
450
|
454
|
globalCache.set(url, result, config.BufferMemoryTime);
|
|
451
|
455
|
console.log("缓存" + config.BufferMemoryTime + "秒");
|