浏览代码

Modify the address location algorithm of the mock

陈帅 7 年之前
父节点
当前提交
1d8293a60b
共有 2 个文件被更改,包括 3 次插入5 次删除
  1. 1 1
      .roadhogrc.mock.js
  2. 2 4
      mock/geographic/geographic.js

+ 1 - 1
.roadhogrc.mock.js

@@ -6,7 +6,7 @@ import { getProfileBasicData } from './mock/profile';
 import { getProfileAdvancedData } from './mock/profile';
 import { getNotices } from './mock/notices';
 import { format, delay } from 'roadhog-api-doc';
-import { getProvince, getCity, getArea } from './mock/geographic/geographic';
+import { getProvince, getCity } from './mock/geographic';
 
 // 是否禁用代理
 const noProxy = process.env.NO_PROXY === 'true';

+ 2 - 4
mock/geographic/geographic.js

@@ -1,8 +1,6 @@
-const fs = require('fs');
-
 function getJson(infoType) {
-  const json = fs.readFileSync(`${__dirname}/${infoType}.json`, 'utf8');
-  return JSON.parse(json);
+  const json = require(`${__dirname}/geographic/${infoType}.json`); // eslint-disable-line
+  return json;
 }
 
 export function getProvince(req, res) {