Parcourir la source

Merge remote-tracking branch 'origin/master'

chen il y a 4 ans
Parent
commit
cee4a188ea

+ 2 - 0
app/controller/.financeclaims.js

@@ -19,6 +19,7 @@ module.exports = {
         'news',
         'video',
         'videoimg',
+        'nownews',
       ]
     },
     destroy: {
@@ -46,6 +47,7 @@ module.exports = {
         'video',
         'news',
         'videoimg',
+        'nownews',
       ]
     },
     show: {

+ 2 - 1
app/model/tfinanceclaims.js

@@ -29,8 +29,9 @@ const TfinanceClaimsSchema = {
   status: { type: String,maxLength: 200,default:'0'}, // 状态,0-未发布,1-发布,2-下架
   video: {type: String, required: false,default:'0'}, // 视频附件
   videoimg: {type: String, required: false,default:'0'}, // 视频图片
-  news: { type: [ newsInfo ], select: true }, // 产品简介
+  news: { type: [ newsInfo ], select: true }, // 产品简介(之前版本)废掉了已经
   cattribute:{type: [String], select: true },//产品属性
+  nownews:{type: String,required: false, select: true },//产品简介(当前版本)
 };
 
 

+ 5 - 5
app/service/claimneed.js

@@ -404,7 +404,7 @@ class ClaimNeedService extends CrudService {
           as: 'dictnew' } },
         { $unwind: '$dictnew' },
         { $project: {money:1,use:1,mongey_min_rate:1,jg_pro_id:1,mongey_max_rate:1,claims_min_term:1,claims_max_term:1,project_status:1,remarks:1,
-                      hyname:'$dictnew.name',cdata:1,folid:{$toString:'$_id'}} },//hyname(担保名称)
+                      hyname:1,cdata:1,folid:{$toString:'$_id'}} },//hyname(担保名称)
         { $lookup: {
                         from: 't_finance_follow',
                         localField: 'folid',
@@ -412,7 +412,7 @@ class ClaimNeedService extends CrudService {
                         as: 'follownew' } },
         { $unwind: '$follownew' },
         { $project: { jg_pro_id:1,money:1,use:1,mongey_min_rate:1,mongey_max_rate:1,claims_min_term:1,claims_max_term:1,project_status:1,remarks:1,
-                      hyname:'$dictnew.name',cdata:1,folid:{$toString:'$_id'},jgpronew:1,sxcplilue:'$follownew.sxcplilue',sxcpname:'$follownew.sxcpname',sxhowlong:'$follownew.sxhowlong',credit_money:'$follownew.credit_money'}}
+                      hyname:1,cdata:1,folid:{$toString:'$_id'},jgpronew:1,sxcplilue:'$follownew.sxcplilue',sxcpname:'$follownew.sxcpname',sxhowlong:'$follownew.sxhowlong',credit_money:'$follownew.credit_money'}}
            ]);
       return res;
     }else{
@@ -433,15 +433,15 @@ class ClaimNeedService extends CrudService {
            as: 'jgpronew' } },
         { $unwind: '$jgpronew' },
         { $project: { jg_pro_id:1,money:1,use:1,mongey_min_rate:1,mongey_max_rate:1,claims_min_term:1,claims_max_term:1,project_status:1,remarks:1,
-          hyname:'$dictnew.name',cdata:1,folid:{$toString:'$_id'},jgpronew:1}},
+          hyname:1,cdata:1,folid:{$toString:'$_id'},jgpronew:1}},
         { $lookup: {
         from: 't_finance_follow',
         localField: 'folid',
         foreignField: 'finceId',
         as: 'follownew' } },
-        { $unwind: '$follownew' },
+        { $unwind: { path: '$follownew', preserveNullAndEmptyArrays: true } },
         { $project: { jg_pro_id:1,money:1,use:1,mongey_min_rate:1,mongey_max_rate:1,claims_min_term:1,claims_max_term:1,project_status:1,remarks:1,
-                  hyname:'$dictnew.name',cdata:1,folid:{$toString:'$_id'},jgpronew:1,sxcplilue:'$follownew.sxcplilue',sxcpname:'$follownew.sxcpname',sxhowlong:'$follownew.sxhowlong',credit_money:'$follownew.credit_money'}}
+                  hyname:1,cdata:1,folid:{$toString:'$_id'},jgpronew:1,sxcplilue:'$follownew.sxcplilue',sxcpname:'$follownew.sxcpname',sxhowlong:'$follownew.sxhowlong',credit_money:'$follownew.credit_money'}}
       ]);
       return resmore;
     }

+ 5 - 3
app/service/financeclaims.js

@@ -89,7 +89,7 @@ class FubabceClaimsService extends CrudService {
       total= totalres[0].total;
     }
     const res = await this.model.aggregate([
-      { $project: { uid: {$toObjectId: '$uid'},name:1,mongey_min_rate:1,mongey_max_rate:1,status:1,video:1} },
+      { $project: { uid: {$toObjectId: '$uid'},name:1,mongey_min_rate:1,mongey_max_rate:1,status:1,video:1,metatime:'$meta.updatedAt'} },
       { $lookup: {
         from: 'institution',
         localField: 'uid',
@@ -97,10 +97,12 @@ class FubabceClaimsService extends CrudService {
         as: 'innew' } },
       { $unwind: '$innew' },
       { $project: { _id: 1, uid: {$toString: '$uid'}, status: 1, name: 1, publish_time: 1, mongey_min_rate: 1, mongey_max_rate: 1,video:1,
-         innewname: '$innew.name', innewpic: '$innew.logo' } },
+         innewname: '$innew.name', innewpic: '$innew.logo',metatime:1} },
       { $match: match },
+      { $sort : { metatime:-1} },
       { $skip: (skip - 1) * limit },
-      { $limit: limit },
+      { $limit: limit }
+    
     ]);
     const newres = {res,total};
     return newres;