Commit 8d7740c7 authored by 任国军's avatar 任国军

add mini_auth_v2

parent a0640356
Pipeline #17507 passed with stage
in 2 minutes 7 seconds
......@@ -28,7 +28,7 @@ class UserController extends Controller {
//存储缓存标识
const user_uuid = user.uuid;
const key = 'course_v2_user_session_' + user_uuid;
await app.memcache.set(key, { user_uuid, openid }, 86400 * 180);
await app.memcache.set(key, { user_uuid, openid }, 86400 * 7);
const auth_token = ctx.helper.md5(openid + user_uuid + 'jbwl');
ctx.set('uuid', key);
ctx.set('auth_token', auth_token);
......
......@@ -11,6 +11,8 @@ module.exports = (options, app) => {
auth_info = await ctx.classModel.V2.CourseUser.findOne({where: {uuid}});
if (ctx.isEmpty(auth_info)) {
ctx.failed('user not exist');
} else {
await app.memcache.set(key, { user_uuid:uuid, openid:auth_info.openid }, 86400 * 7);
}
}
const openid = auth_info.openid;
......
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