修复留言问题

This commit is contained in:
HelloWorld 2020-04-08 12:19:44 +08:00
parent f889ba70aa
commit 9121d5da62
2 changed files with 2 additions and 2 deletions

View File

@ -522,7 +522,7 @@ module.exports = class extends Base {
// 获取所有留言
async advicesAction() {
try {
let data = await this.model("advices").order("createdAt DESC").select();
let data = await this.model("advices").join('users ON users.id = advices.userId').order("createdAt DESC").field('advices.*,users.username').select();
this.json({ code: 0, data });
} catch (error) {
this.json({ code: 1, data: '', msg: error.toString() });

View File

@ -37,7 +37,7 @@ app.controller('adviceCtr', ['$scope', '$state', '$timeout', 'pubSubService', 'd
async function getAdvices() {
let data = await get("advices");
data.forEach(element => {
element.imgData = new Identicon(md5(element.username)).toString();
element.imgData = new Identicon(md5(element.userId)).toString();
});
$scope.comment = "";
$timeout(function () {