* * @param {*} ctx
(ctx)
| 180 | */ |
| 181 | |
| 182 | async getLoginStatus(ctx) { |
| 183 | let body; |
| 184 | if ((await this.checkLogin(ctx)) === true) { |
| 185 | let result = yapi.commons.fieldSelect(this.$user, [ |
| 186 | '_id', |
| 187 | 'username', |
| 188 | 'email', |
| 189 | 'up_time', |
| 190 | 'add_time', |
| 191 | 'role', |
| 192 | 'type', |
| 193 | 'study' |
| 194 | ]); |
| 195 | body = yapi.commons.resReturn(result); |
| 196 | } else { |
| 197 | body = yapi.commons.resReturn(null, 40011, '请登录...'); |
| 198 | } |
| 199 | |
| 200 | body.ladp = await this.checkLDAP(); |
| 201 | body.canRegister = await this.checkRegister(); |
| 202 | ctx.body = body; |
| 203 | } |
| 204 | |
| 205 | getRole() { |
| 206 | return this.$user.role; |
nothing calls this directly
no test coverage detected