修复留言问题
This commit is contained in:
parent
f889ba70aa
commit
9121d5da62
|
|
@ -522,7 +522,7 @@ module.exports = class extends Base {
|
||||||
// 获取所有留言
|
// 获取所有留言
|
||||||
async advicesAction() {
|
async advicesAction() {
|
||||||
try {
|
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 });
|
this.json({ code: 0, data });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.json({ code: 1, data: '', msg: error.toString() });
|
this.json({ code: 1, data: '', msg: error.toString() });
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ app.controller('adviceCtr', ['$scope', '$state', '$timeout', 'pubSubService', 'd
|
||||||
async function getAdvices() {
|
async function getAdvices() {
|
||||||
let data = await get("advices");
|
let data = await get("advices");
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
element.imgData = new Identicon(md5(element.username)).toString();
|
element.imgData = new Identicon(md5(element.userId)).toString();
|
||||||
});
|
});
|
||||||
$scope.comment = "";
|
$scope.comment = "";
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue