Commit 643b8ab7 authored by Hsinli's avatar Hsinli

add

parent 0c4d4450
Pipeline #19659 passed with stage
in 59 seconds
...@@ -4,10 +4,13 @@ module.exports = app => { ...@@ -4,10 +4,13 @@ module.exports = app => {
const router = app.router.namespace(app.config.projectRootPath + '/cd'); const router = app.router.namespace(app.config.projectRootPath + '/cd');
const loginAuth = app.middleware.loginAuth({ type: 'new' });//登录中间件 const loginAuth = app.middleware.loginAuth({ type: 'new' });//登录中间件
//贷款计算器
router.post('third', '/caculator', 'cd.loanCaculator.caculator');
//资讯详细内容
router.get('third', '/news/:id', 'cd.news.getNews');
router.post('third', '/caculator', 'cd.loanCaculator.caculator');//贷款计算器
router.get('third', '/news/:id', 'cd.news.getNews');//资讯详细内容
}; };
\ No newline at end of file
...@@ -43,15 +43,31 @@ class NewsService extends Service { ...@@ -43,15 +43,31 @@ class NewsService extends Service {
*/ */
async getNews(id) { async getNews(id) {
const { ctx } = this; const { ctx } = this;
let ret = {
title: '',
source: '',
source_time: '',
content: '',
author: '',
read_num: '',
}
let filter = { let filter = {
attributes: ['id', 'title', 'images', 'source', 'source_time', 'content', 'author', 'initial_num'], attributes: ['title', 'source', 'source_time', 'content', 'author', 'initial_num'],
where: { where: {
id: id, id: id,
valid: 1, valid: 1,
status: 'pass', status: 'pass',
} }
} }
let ret = await ctx.realestateModel.CdNews.findOne(filter); let news = await ctx.realestateModel.CdNews.findOne(filter);
if (news) {
ret.title = news.title;
ret.source = news.source;
ret.source_time = news.source_time;
ret.content = news.content;
ret.author = news.author;
ret.read_num = news.initial_num;
}
return ret; return ret;
} }
......
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