Commit 1e8d3212 authored by 任国军's avatar 任国军

fix auth

parent bcc5732c
Pipeline #18125 passed with stage
in 8 seconds
...@@ -28,7 +28,7 @@ class UserController extends Controller { ...@@ -28,7 +28,7 @@ class UserController extends Controller {
console.info(user); console.info(user);
// 存储缓存标识 // 存储缓存标识
const user_uuid = user.uuid; const user_uuid = user.uuid;
const key = 'course_v2_user_session_' + user_uuid; const key = 'course_v3_user_session_' + user_uuid;
await app.memcache.set(key, { user_uuid, openid, session_key }, 86400 * 7); await app.memcache.set(key, { user_uuid, openid, session_key }, 86400 * 7);
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);
......
...@@ -659,8 +659,8 @@ class InstitutionSubService extends Service { ...@@ -659,8 +659,8 @@ class InstitutionSubService extends Service {
const articles = await ctx.classModel.V3.CourseArticle.findAndCountAll(filter); const articles = await ctx.classModel.V3.CourseArticle.findAndCountAll(filter);
const ret = []; const ret = [];
//用户点赞列表 // 用户点赞列表
const userLikes = await ctx.classModel.V3.CourseLike.findAll({where: {user_uuid: ctx.userUuid, type: 1, is_deleted: 0}}); const userLikes = await ctx.classModel.V3.CourseLike.findAll({ where: { user_uuid: ctx.userUuid, type: 1, is_deleted: 0 } });
const userLikeIds = R.pluck('type_id', userLikes); const userLikeIds = R.pluck('type_id', userLikes);
for (const v of articles.rows) { for (const v of articles.rows) {
ret.push({ ret.push({
...@@ -694,8 +694,8 @@ class InstitutionSubService extends Service { ...@@ -694,8 +694,8 @@ class InstitutionSubService extends Service {
await ctx.classModel.V3.CourseArticle.update({ read_count: sequelize.literal('`read_count` + 1') }, { where: { id } }); await ctx.classModel.V3.CourseArticle.update({ read_count: sequelize.literal('`read_count` + 1') }, { where: { id } });
//用户是否点赞 // 用户是否点赞
const userLike = await ctx.classModel.V3.CourseLike.findOne({where: {user_uuid: ctx.userUuid, type: 1, type_id: id, is_deleted: 0}}); const userLike = await ctx.classModel.V3.CourseLike.findOne({ where: { user_uuid: ctx.userUuid, type: 1, type_id: id, is_deleted: 0 } });
const ret = { const ret = {
id: article.id, id: article.id,
...@@ -752,7 +752,7 @@ class InstitutionSubService extends Service { ...@@ -752,7 +752,7 @@ class InstitutionSubService extends Service {
return; return;
} }
//取消点赞 // 取消点赞
async unlike(input) { async unlike(input) {
const { ctx } = this; const { ctx } = this;
const type = Number(input.type) || 0; const type = Number(input.type) || 0;
...@@ -783,7 +783,7 @@ class InstitutionSubService extends Service { ...@@ -783,7 +783,7 @@ class InstitutionSubService extends Service {
break; break;
} }
await ctx.classModel.V3.CourseLike.update({ is_deleted: 1 }, {where:{id: userLike.id}}); await ctx.classModel.V3.CourseLike.update({ is_deleted: 1 }, { where: { id: userLike.id } });
return; return;
} }
} }
......
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