123456789101112131415161718192021222324252627282930 |
- 'use strict';
- module.exports = options => {
-
- return async function webLogin(ctx, next) {
- const token = ctx.request.header.weblogintoken;
- if (token) {
- try {
- const user = ctx.app.jwt.verify(token, options.secret);
- await next();
- } catch (err) {
- return ctx.appJson(ctx.app.szjcomo.appResult('登录时间过期,请重新登录', null, true, 10001));
- }
- } else {
- return ctx.appJson(ctx.app.szjcomo.appResult('未登录,请先登录后再进行数据操作', null, true, 10001));
- }
- };
- };
|