系统菜单先提交
This commit is contained in:
25
server/app/controller/menu.js
Normal file
25
server/app/controller/menu.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const Controller = require("egg").Controller
|
||||
|
||||
const table = "sys_menu";
|
||||
|
||||
class User extends Controller {
|
||||
async list() {
|
||||
const {ctx} = this
|
||||
const result = await this.service.db.list("sys_menu", ctx.query)
|
||||
this.ctx.status = 200
|
||||
this.ctx.body = result
|
||||
}
|
||||
|
||||
async info() {
|
||||
const {ctx, app} = this
|
||||
if (!ctx.state.user?.id) {
|
||||
this.ctx.body = {code: 1, msg: "找不到授权用户"}
|
||||
return this.ctx.status = 401
|
||||
}
|
||||
const user = await app.mysql.get(table, {id: ctx.state.user?.id})
|
||||
this.ctx.body = {code: 0, data: user}
|
||||
this.ctx.status = 200
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = User
|
||||
Reference in New Issue
Block a user