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 {
console.info(user);
// 存储缓存标识
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);
const auth_token = ctx.helper.md5(openid + user_uuid + 'jbwl');
ctx.set('uuid', key);
......
......@@ -659,8 +659,8 @@ class InstitutionSubService extends Service {
const articles = await ctx.classModel.V3.CourseArticle.findAndCountAll(filter);
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);
for (const v of articles.rows) {
ret.push({
......@@ -694,8 +694,8 @@ class InstitutionSubService extends Service {
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 = {
id: article.id,
......@@ -752,7 +752,7 @@ class InstitutionSubService extends Service {
return;
}
//取消点赞
// 取消点赞
async unlike(input) {
const { ctx } = this;
const type = Number(input.type) || 0;
......@@ -783,7 +783,7 @@ class InstitutionSubService extends Service {
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;
}
}
......
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