lintry

调整接口参数配置

...@@ -2,14 +2,16 @@ ...@@ -2,14 +2,16 @@
2 * run 2 * run
3 * Created by lintry on 2020/1/28. 3 * Created by lintry on 2020/1/28.
4 */ 4 */
5 +const _ = require('lodash');
5 const config = global.config; 6 const config = global.config;
6 const dbo = global.sequelize; 7 const dbo = global.sequelize;
7 const DataImporter = require('../service/data_importer'); 8 const DataImporter = require('../service/data_importer');
8 const data_importer = new DataImporter(dbo); 9 const data_importer = new DataImporter(dbo);
9 -const NCOV_URL = config.NCOV.API_URL; 10 +const NCOV_URL = config.NCOV_API.area.url;
11 +const NCOV_PARAM = config.NCOV_API.area.param;
10 const Result = require('kml-express-stage-lib').Result; 12 const Result = require('kml-express-stage-lib').Result;
11 13
12 module.exports = async (cfg) => { 14 module.exports = async (cfg) => {
13 - await data_importer.import_url(NCOV_URL, {latest: 0}) 15 + await data_importer.import_url(NCOV_URL, _.merge({latest: 0}, NCOV_PARAM))
14 - return Result.Ok(`Fetched from ${NCOV_URL}`); 16 + return Result.Ok(`Fetched from ${NCOV_URL}`, NCOV_PARAM);
15 }; 17 };
......
...@@ -209,8 +209,13 @@ const configure = function () { ...@@ -209,8 +209,13 @@ const configure = function () {
209 }, 209 },
210 210
211 // 获取数据的api地址 211 // 获取数据的api地址
212 - NCOV: { 212 + NCOV_API: {
213 - API_URL: 'https://lab.isaaclin.cn/nCoV/api/area' 213 + area: {
214 + url: 'https://lab.isaaclin.cn/nCoV/api/area',
215 + param: {
216 + latest: 1
217 + }
218 + }
214 } 219 }
215 }; 220 };
216 221
......