Commit 2f86ea37 authored by Hsinli's avatar Hsinli

Merge branch 'master' of t-git.51gjj.com:fangbin/51business

parents 5683f933 e440142c
Pipeline #14066 passed with stage
in 28 seconds
...@@ -27,7 +27,7 @@ class UserController extends Controller { ...@@ -27,7 +27,7 @@ class UserController extends Controller {
//存储缓存标识 //存储缓存标识
const user_uuid = user.uuid; const user_uuid = user.uuid;
const key = 'course_user_session_' + user_uuid; const key = 'course_user_session_' + user_uuid;
await app.memcache.set(key, { user_uuid, openid }, 86400); await app.memcache.set(key, { user_uuid, openid }, 86400 * 180);
const auth_token = ctx.helper.md5(openid + user_uuid + 'jbwl'); const auth_token = ctx.helper.md5(openid + user_uuid + 'jbwl');
ctx.set('uuid', key); ctx.set('uuid', key);
ctx.set('auth_token', auth_token); ctx.set('auth_token', auth_token);
......
...@@ -8,15 +8,15 @@ module.exports = (options, app) => { ...@@ -8,15 +8,15 @@ module.exports = (options, app) => {
const key = 'course_user_session_' + uuid; const key = 'course_user_session_' + uuid;
const auth_info = await ctx.app.memcache.get(key); const auth_info = await ctx.app.memcache.get(key);
if (!auth_info) { if (!auth_info) {
await next(); // await next();
return; // return;
// ctx.failed('login auth error'); ctx.failed('login auth error');
} }
const openid = auth_info.openid; const openid = auth_info.openid;
const user_uuid = auth_info.user_uuid; const user_uuid = auth_info.user_uuid;
const auth_token = ctx.headers.auth_token; const auth_token = ctx.headers.auth_token;
if (ctx.helper.md5(openid + uuid + 'jbwl') != auth_token) { if (ctx.helper.md5(openid + uuid + 'jbwl') != auth_token) {
// ctx.failed('login auth error'); ctx.failed('login auth error');
} }
ctx.setUserUuid(user_uuid); ctx.setUserUuid(user_uuid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment