浏览代码

获取城市数据

modood 8 年之前
父节点
当前提交
ce1b594737
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 11 1
      index.js

+ 11 - 1
index.js

@@ -9,6 +9,16 @@ const street = require('./data/street.json')
  * @DateTime 2016-10-08 15:50
  */
 exports.getProvinces = function () {
-  return division.filter(a => { if (a[4] === '000000') return true }).map(a => { return { code: a[0], name: a[1] } })
+  return division.filter(a => a[4] === '000000').map(a => { return { code: a[0], name: a[1] } })
+}
+
+
+/**
+ * 获取城市数据
+ * @Author   https://github.com/modood
+ * @DateTime 2016-10-08 17:58
+ */
+exports.getCities = function () {
+  return division.filter(a => a[2]).map(a => { return { code: a[0], name: a[2], parent_code: a[4] } })
 }