Commit 2016eaba authored by Aria's avatar Aria

fix collectClass bugs

parent f5b6f86b
Pipeline #19458 passed with stage
in 57 seconds
...@@ -196,7 +196,7 @@ class OnlineService extends Service { ...@@ -196,7 +196,7 @@ class OnlineService extends Service {
created_time: moment().format('YYYY-MM-DD HH:mm:ss'), created_time: moment().format('YYYY-MM-DD HH:mm:ss'),
}; };
const check = await ctx.classModel.V4.CourseUserCollection.findOne({ where: { user_uuid: userUuid, type: 5, type_id: id, is_deleted: 0 } }); const check = await ctx.classModel.V4.CourseUserCollection.findOne({ where: { user_uuid: userUuid, type: 3, type_id: id, is_deleted: 0 } });
if (!ctx.isEmpty(check)) { if (!ctx.isEmpty(check)) {
ctx.failed('请勿重复收藏'); ctx.failed('请勿重复收藏');
} }
...@@ -214,7 +214,7 @@ class OnlineService extends Service { ...@@ -214,7 +214,7 @@ class OnlineService extends Service {
const offset = (page - 1) * limit; const offset = (page - 1) * limit;
const userUuid = ctx.userUuid; const userUuid = ctx.userUuid;
const userCollection = await ctx.classModel.V4.CourseUserCollection.findAndCountAll({ where: { user_uuid: userUuid, is_deleted: 0, type: 5 }, raw: true, limit, offset }); const userCollection = await ctx.classModel.V4.CourseUserCollection.findAndCountAll({ where: { user_uuid: userUuid, is_deleted: 0, type: 3 }, raw: true, limit, offset });
let classIds = R.pluck('type_id', userCollection.rows); let classIds = R.pluck('type_id', userCollection.rows);
const filter = { where: { id: { $in: classIds }, status: 'online', is_deleted: 0 }, order: [[ 'institution_id', 'desc' ]], limit, offset, attributes: [ 'id', 'institution_id', 'name', 'price', 'type', 'age', 'mode', 'time', 'created_time' ] }; const filter = { where: { id: { $in: classIds }, status: 'online', is_deleted: 0 }, order: [[ 'institution_id', 'desc' ]], limit, offset, attributes: [ 'id', 'institution_id', 'name', 'price', 'type', 'age', 'mode', 'time', 'created_time' ] };
...@@ -275,7 +275,7 @@ class OnlineService extends Service { ...@@ -275,7 +275,7 @@ class OnlineService extends Service {
const userUuid = ctx.userUuid; const userUuid = ctx.userUuid;
// 是否已收藏 // 是否已收藏
const check = await ctx.classModel.V4.CourseUserCollection.findOne({ where: { user_uuid: userUuid, type: 5, type_id: id, is_deleted: 0 } }); const check = await ctx.classModel.V4.CourseUserCollection.findOne({ where: { user_uuid: userUuid, type: 3, type_id: id, is_deleted: 0 } });
if (ctx.isEmpty(check)) { if (ctx.isEmpty(check)) {
ctx.failed('尚未收藏'); ctx.failed('尚未收藏');
} }
......
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