Commit 450b1b53 authored by 任国军's avatar 任国军

fix class iamges

parent 33d00258
Pipeline #16880 passed with stage
in 49 seconds
...@@ -95,7 +95,7 @@ class InstitutionSubService extends Service { ...@@ -95,7 +95,7 @@ class InstitutionSubService extends Service {
const classHandle = []; const classHandle = [];
if (classes.length > 0) { if (classes.length > 0) {
for (const v of classes) { for (const v of classes) {
classHandle.push(ctx.classModel.V2.CourseImages.findOne({ where: { type: 2, type_id: v.id, status: 'online', is_deleted: 0, is_cover: 1 } })); classHandle.push(ctx.classModel.V2.CourseImages.findOne({ where: { type: 2, type_id: v.id, status: 'online', is_deleted: 0 }, order: [[ 'sort', 'asc' ]] }));
} }
const classImages = await Promise.all(classHandle).then(result => { const classImages = await Promise.all(classHandle).then(result => {
return result; return result;
...@@ -592,7 +592,7 @@ class InstitutionSubService extends Service { ...@@ -592,7 +592,7 @@ class InstitutionSubService extends Service {
images.push(v); images.push(v);
} }
} }
images = _.orderBy(images, [ 'is_cover', 'sort' ], [ 'desc', 'asc' ]); images = _.orderBy(images, [ 'sort' ], [ 'asc' ]);
classes.rows[i].image = images.length > 0 ? images[0] : {}; classes.rows[i].image = images.length > 0 ? images[0] : {};
} }
......
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