Commit 20d975ea authored by Hsinli's avatar Hsinli

addd

parent c2c15585
Pipeline #8870 passed with stage
in 4 seconds
...@@ -12,7 +12,7 @@ class AnswerController extends Controller { ...@@ -12,7 +12,7 @@ class AnswerController extends Controller {
let inputParams = ctx.request.body; let inputParams = ctx.request.body;
const rule = { const rule = {
answer: { type: 'string', required: true }, answer: { type: 'string', required: true },
id: { type: 'integer', required: true }, question_id: { type: 'integer', required: true },
city_code: { type: 'string', required: true }, city_code: { type: 'string', required: true },
}; };
ctx.validate(rule, inputParams); ctx.validate(rule, inputParams);
......
...@@ -68,7 +68,7 @@ module.exports = app => { ...@@ -68,7 +68,7 @@ module.exports = app => {
AnswerLike.one = async (data) => { AnswerLike.one = async (data) => {
const attributes = data.attributes ? data.attributes : {}; const attributes = data.attributes ? data.attributes : {};
const where = data.where ? data.where : {}; const where = data.where ? data.where : {};
return await SearchHistory.findOne({ return await AnswerLike.findOne({
attributes: attributes, attributes: attributes,
where: where, where: where,
}); });
......
...@@ -72,7 +72,7 @@ module.exports = app => { ...@@ -72,7 +72,7 @@ module.exports = app => {
HotQuestionAnswer.one = async (data) => { HotQuestionAnswer.one = async (data) => {
const attributes = data.attributes ? data.attributes : {}; const attributes = data.attributes ? data.attributes : {};
const where = data.where ? data.where : {}; const where = data.where ? data.where : {};
return await SearchHistory.findOne({ return await HotQuestionAnswer.findOne({
attributes: attributes, attributes: attributes,
where: where, where: where,
}); });
......
...@@ -68,7 +68,7 @@ module.exports = app => { ...@@ -68,7 +68,7 @@ module.exports = app => {
HotQuestionPut.one = async (data) => { HotQuestionPut.one = async (data) => {
const attributes = data.attributes ? data.attributes : {}; const attributes = data.attributes ? data.attributes : {};
const where = data.where ? data.where : {}; const where = data.where ? data.where : {};
return await SearchHistory.findOne({ return await HotQuestionPut.findOne({
attributes: attributes, attributes: attributes,
where: where, where: where,
}); });
......
...@@ -19,7 +19,7 @@ class HotQuestionAnswerService extends Service { ...@@ -19,7 +19,7 @@ class HotQuestionAnswerService extends Service {
app_type_id: ctx.appTypeId, app_type_id: ctx.appTypeId,
question_id: inputParams.question_id, question_id: inputParams.question_id,
answer: inputParams.answer, answer: inputParams.answer,
city: inputParams.city, city: inputParams.city_code,
status: 'wait', status: 'wait',
}; };
let retId = await ctx.realestateModel.HotQuestionAnswer.add(data); let retId = await ctx.realestateModel.HotQuestionAnswer.add(data);
...@@ -36,7 +36,7 @@ class HotQuestionAnswerService extends Service { ...@@ -36,7 +36,7 @@ class HotQuestionAnswerService extends Service {
page: condition.page || 1, page: condition.page || 1,
limit: condition.limit || 10, limit: condition.limit || 10,
where: { where: {
question_id: Number(condition.id), question_id: Number(condition.question_id),
status: 'pass', status: 'pass',
}, },
order: [['created_at', 'desc']] order: [['created_at', 'desc']]
...@@ -46,7 +46,7 @@ class HotQuestionAnswerService extends Service { ...@@ -46,7 +46,7 @@ class HotQuestionAnswerService extends Service {
for (let i in res) { for (let i in res) {
taskList[i] = this.formatAnswer(res[i]); taskList[i] = this.formatAnswer(res[i]);
} }
retList = await Promise.all(taskList).then(result => { let retList = await Promise.all(taskList).then(result => {
return result; return result;
}).catch(error => { }).catch(error => {
ctx.failed(error); ctx.failed(error);
......
...@@ -73,7 +73,7 @@ class HotQuestionPutService extends Service { ...@@ -73,7 +73,7 @@ class HotQuestionPutService extends Service {
limit: Number(condition.limit) || 10, limit: Number(condition.limit) || 10,
question_id: Number(condition.id), question_id: Number(condition.id),
} }
let answerLsit = await ctx.service.house.v2.HotQuestionAnswer.answerList(answerFliter); let answerLsit = await ctx.service.house.v2.hotQuestionAnswer.answerList(answerFliter);
let ret = { let ret = {
question: question.question, question: question.question,
answerList: answerLsit answerList: answerLsit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment