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

courseInfo add institution_logo

parent eddd3606
Pipeline #21666 passed with stage
in 3 seconds
...@@ -9,7 +9,7 @@ module.exports = { ...@@ -9,7 +9,7 @@ module.exports = {
const { ctx } = this; const { ctx } = this;
const bearerToken = ctx.request.header.authorization; const bearerToken = ctx.request.header.authorization;
if (!bearerToken) { if (!bearerToken) {
ctx.failed('error auth'); this.throw(422, 'error auth');
} }
return bearerToken && bearerToken.replace('Bearer ', ''); return bearerToken && bearerToken.replace('Bearer ', '');
}, },
......
...@@ -88,6 +88,18 @@ class InstitutionSubService extends Service { ...@@ -88,6 +88,18 @@ class InstitutionSubService extends Service {
// 学员成果 // 学员成果
const studentWorks = await ctx.classModel.V5.CourseV5StudentWorks.findAll({ where: { class_id: id, status: 1, is_deleted: 0 }, order: [[ 'sort', 'asc' ]], attributes: [ 'id', 'name', 'sub_title', 'description', 'video_url', 'cover_image' ] }); const studentWorks = await ctx.classModel.V5.CourseV5StudentWorks.findAll({ where: { class_id: id, status: 1, is_deleted: 0 }, order: [[ 'sort', 'asc' ]], attributes: [ 'id', 'name', 'sub_title', 'description', 'video_url', 'cover_image' ] });
// 顶部图片
const imageList = await ctx.classModel.V5.CourseImage.findAll({ where: { type: 5, type_id: id, status: 'online', is_deleted: 0 }, order: [[ 'sort', 'asc' ]] });
const images = [];
for (const v of imageList) {
images.push({
id: v.id,
url: v.is_video > 0 ? v.video_url : v.image_url,
is_video: v.is_video,
});
}
const columns = []; const columns = [];
for (const v of classColumns) { for (const v of classColumns) {
if (!ctx.isEmpty(columnList[v.column_id])) { if (!ctx.isEmpty(columnList[v.column_id])) {
...@@ -105,7 +117,9 @@ class InstitutionSubService extends Service { ...@@ -105,7 +117,9 @@ class InstitutionSubService extends Service {
classInfo.columns = columns; classInfo.columns = columns;
classInfo.student_works = studentWorks; classInfo.student_works = studentWorks;
classInfo.images = images;
classInfo.institution_name = ctx.isEmpty(institution) ? '' : institution.name; classInfo.institution_name = ctx.isEmpty(institution) ? '' : institution.name;
classInfo.institution_logo = ctx.isEmpty(institution) ? '' : institution.logo;
classInfo.institution_description = ctx.isEmpty(institution) ? '' : institution.description; classInfo.institution_description = ctx.isEmpty(institution) ? '' : institution.description;
return classInfo; return classInfo;
......
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