Parcourir la source

feat: 后台信息价库,改为倒序显示 (#GLY-7261)

vian il y a 1 semaine
Parent
commit
df86cccb1b
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      modules/price_info_lib/facade/index.js

+ 2 - 2
modules/price_info_lib/facade/index.js

@@ -18,7 +18,7 @@ const SMS = require('../../users/models/sms');
 const sms = new SMS();
 const sms = new SMS();
 
 
 async function getLibs(query) {
 async function getLibs(query) {
-    return await priceInfoLibModel.find(query).lean();
+    return await priceInfoLibModel.find(query).sort({ period: -1 }).lean();
 }
 }
 
 
 async function createLib(name, period, compilationID) {
 async function createLib(name, period, compilationID) {
@@ -389,7 +389,7 @@ async function getAllLibs() {
     const rst = [];
     const rst = [];
     Object.keys(groupData).forEach(key => {
     Object.keys(groupData).forEach(key => {
         const items = groupData[key];
         const items = groupData[key];
-        items.sort((a, b) => a.period.localeCompare(b.period));
+        items.sort((a, b) => b.period.localeCompare(a.period));
         rst.push(...items);
         rst.push(...items);
     });
     });
     return rst;
     return rst;