|
@@ -15,6 +15,7 @@ class NewsService extends CrudService {
|
|
|
|
|
|
async fetch({ id }) {
|
|
|
const news = await this.model.findById(id);
|
|
|
+ const newdata = { ...JSON.parse(JSON.stringify(news)) };
|
|
|
if (news) {
|
|
|
const url = 'http://127.0.0.1:9999/api/auth/user/' + news.uid;
|
|
|
const user = await this.ctx.curl(url, {
|
|
@@ -24,11 +25,11 @@ class NewsService extends CrudService {
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
});
|
|
|
- if (user.data.name) {
|
|
|
- news.uname = user.data.name;
|
|
|
+ if (user.data.errcode === 0) {
|
|
|
+ newdata.uname = user.data.data.name;
|
|
|
}
|
|
|
}
|
|
|
- return news;
|
|
|
+ return newdata;
|
|
|
}
|
|
|
|
|
|
}
|