modood 8 жил өмнө
parent
commit
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
  * @DateTime 2016-10-08 15:50
  */
  */
 exports.getProvinces = function () {
 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] } })
 }
 }