Procházet zdrojové kódy

feat: 信息价地区“茂名市-电白市”识别修改为“茂名市-电白区”

vian před 1 rokem
rodič
revize
8b9e5fdbc5

+ 8 - 1
web/over_write/crawler/guangdong_2018_price_crawler.js

@@ -57,7 +57,7 @@ const areas = [
   { city: '湛江市', county: '雷州市' },
   { city: '湛江市', county: '吴川市' },
   { city: '茂名市', county: '茂名市' },
-  { city: '茂名市', county: '电白' },
+  { city: '茂名市', county: '电白' },
   { city: '茂名市', county: '高州市' },
   { city: '茂名市', county: '化州市' },
   { city: '茂名市', county: '信宜市' },
@@ -473,6 +473,13 @@ async function crawlData(from, to, compilationID) {
       // 存入地区
       const { city, county } = areas[i];
       const area = `${city}-${county}`;
+      if (area === '茂名市-电白区') {
+        // 电白市是错的,需要改成电白区
+        const dianBai = await priceInfoAreaModel.findOne({ compilationID, name: '茂名市-电白市' }).lean();
+        if (dianBai) {
+          await priceInfoAreaModel.update({ ID: dianBai.ID }, { $set: { name: area } });
+        }
+      }
       let areaItem = await priceInfoAreaModel.findOne({ compilationID, name: area }).lean();
       const serialNo = i + 1;
       if (!areaItem) {