chengjie 5 months ago
parent
commit
8792643aa3
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/api/yjbdc/yjbdcController.js

+ 14 - 0
src/api/yjbdc/yjbdcController.js

@@ -283,6 +283,7 @@ export async function GetYJBDCArticleList(ctx) {
283 283
     const param = {
284 284
         UserID: ctx.query.UserID || 0,
285 285
         ID:ctx.query.ID || 0,
286
+        IsTodayCount: ctx.query.IsTodayCount || false,
286 287
     };
287 288
     // 尝试从缓存获取
288 289
     const url='GetYJBDCArticleList?UserID='+param.UserID+"&ID="+param.ID;
@@ -315,6 +316,19 @@ export async function GetYJBDCArticleList(ctx) {
315 316
         console.log("缓存60秒");
316 317
     }
317 318
 
319
+    if (param.IsTodayCount && !param.ID){
320
+        let count=0;
321
+        const today=moment().format("YYYY年MM月DD日 00:00");
322
+        for(let i=0;i<result.length;i++){
323
+            if (result[i].CreateTime>=today)
324
+                count++;
325
+        }
326
+        result={
327
+            TodayCount:count,
328
+            MaxCount:12,
329
+        };
330
+    }
331
+
318 332
     ctx.body = {"errcode": 10000, result:result};
319 333
 }
320 334