lintry

调整接口参数配置

......@@ -2,14 +2,16 @@
* run
* Created by lintry on 2020/1/28.
*/
const _ = require('lodash');
const config = global.config;
const dbo = global.sequelize;
const DataImporter = require('../service/data_importer');
const data_importer = new DataImporter(dbo);
const NCOV_URL = config.NCOV.API_URL;
const NCOV_URL = config.NCOV_API.area.url;
const NCOV_PARAM = config.NCOV_API.area.param;
const Result = require('kml-express-stage-lib').Result;
module.exports = async (cfg) => {
await data_importer.import_url(NCOV_URL, {latest: 0})
return Result.Ok(`Fetched from ${NCOV_URL}`);
await data_importer.import_url(NCOV_URL, _.merge({latest: 0}, NCOV_PARAM))
return Result.Ok(`Fetched from ${NCOV_URL}`, NCOV_PARAM);
};
......
......@@ -209,8 +209,13 @@ const configure = function () {
},
// 获取数据的api地址
NCOV: {
API_URL: 'https://lab.isaaclin.cn/nCoV/api/area'
NCOV_API: {
area: {
url: 'https://lab.isaaclin.cn/nCoV/api/area',
param: {
latest: 1
}
}
}
};
......