|
@ -2,6 +2,23 @@ |
|
|
const request = require("superagent"); |
|
|
const request = require("superagent"); |
|
|
const cheerio = require('cheerio'); |
|
|
const cheerio = require('cheerio'); |
|
|
|
|
|
|
|
|
|
|
|
function addAffordableHousing(opts) { |
|
|
|
|
|
return async function (ctx, next) { |
|
|
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
|
|
let errMsg = { message: '新增住房信息失败' } |
|
|
|
|
|
try { |
|
|
|
|
|
const { houseValue, personValue } = ctx.request.body; |
|
|
|
|
|
const arr = personValue.map(p => ({ ...houseValue, ...p })); |
|
|
|
|
|
await models.AffordableHousing.bulkCreate(arr); |
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 204; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
|
|
|
ctx.status = 400; |
|
|
|
|
|
ctx.body = errMsg |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
function getPersonAge(opts) { |
|
|
function getPersonAge(opts) { |
|
|
return async function (ctx, next) { |
|
|
return async function (ctx, next) { |
|
|
|
|
|
|
|
@ -182,6 +199,7 @@ function getFgjvNotice(opts) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
module.exports = { |
|
|
module.exports = { |
|
|
|
|
|
addAffordableHousing, |
|
|
getPersonAge, |
|
|
getPersonAge, |
|
|
getHomePerson, |
|
|
getHomePerson, |
|
|
getHomeInfo, |
|
|
getHomeInfo, |
|
|