19 lines
451 B
JavaScript
19 lines
451 B
JavaScript
const Controller = require("egg").Controller
|
|
|
|
const table = "sys_user";
|
|
|
|
class User extends Controller {
|
|
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
|