Skip to content

Commit df2645b

Browse files
author
zhouzhihui
committed
chore: use Redux state management
1 parent f88bb5f commit df2645b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app/controller/default/home.js

+6
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ class HomeController extends Controller {
118118
})
119119
this.ctx.body = {data: mainCate}
120120
}
121+
// 获取网站管理员信息
122+
async getAdminInfo(){
123+
const sql = `SELECT admin_user.Id as id,admin_user.avatar,admin_user.userName as username,admin_user.introduction,role.name FROM admin_user LEFT JOIN role ON admin_user.role=role.value WHERE admin_user.role='ROLE_ADMIN'`
124+
const res = await this.app.mysql.query(sql)
125+
this.ctx.body = {data: res}
126+
}
121127
// 根据文章ID获得文章评论列表
122128
async getCommentById() {
123129
const id = this.ctx.params.id

app/router/default.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = app => {
1212
router.get('/default/getTimeline', controller.default.home.getTimeline)
1313
router.get('/default/getSiteinfo', controller.default.home.getSiteinfo)
1414
router.get('/default/getTags', controller.default.home.getTags)
15+
router.get('/default/getAdminInfo', controller.default.home.getAdminInfo)
1516
router.get('/default/getCommentById/:id', controller.default.home.getCommentById)
1617
router.post('/default/addComment', controller.default.home.addComment)
1718
router.get('/default/isRegister/:username', controller.default.home.isRegister)

0 commit comments

Comments
 (0)