Bläddra i källkod

feat: 数据格式化逻辑优化

cuiyalong 1 år sedan
förälder
incheckning
da29b01a2e
1 ändrade filer med 12 tillägg och 4 borttagningar
  1. 12 4
      data/data-models/modules/article/model/expand.js

+ 12 - 4
data/data-models/modules/article/model/expand.js

@@ -51,17 +51,21 @@ class ContentExpandModel extends BaseModel {
 
   preSortBiddingItem(item) {
     let bidAmount = ''
+    // 有中标金额取中标金额,没有取预算,预算没有置空
     if (item?.bidAmount) {
       bidAmount = formatMoney(item?.bidAmount - 0)
     } else if (item?.budget) {
       bidAmount = formatMoney(item?.budget - 0)
     }
 
+    const area = item.area || '全国'
+    const type = item?.type || item?.subtype
+    const buyerclass = item.buyerClass || ''
+
     const tagList = [
-      item.area || '全国',
-      item.buyerClass,
-      item?.type || item?.subtype,
-      // 有中标金额取中标金额,没有取预算,预算没有置空
+      area,
+      buyerclass,
+      type,
       bidAmount
     ].filter((v) => v)
 
@@ -69,6 +73,10 @@ class ContentExpandModel extends BaseModel {
       id: item.id,
       title: item.title,
       tags: tagList,
+      area,
+      type,
+      buyerclass,
+      bidAmount,
       time: item.publishTime ? item.publishTime * 1000 : undefined,
       _o: item
     }