Commit 1990eff7 authored by 任国军's avatar 任国军

course teacher_info add institution_name

parent 006efeb4
Pipeline #14313 passed with stage
in 22 seconds
...@@ -64,7 +64,9 @@ class InstitutionService extends Service { ...@@ -64,7 +64,9 @@ class InstitutionService extends Service {
const { ctx } = this; const { ctx } = this;
const user_uuid = ctx.userUuid; const user_uuid = ctx.userUuid;
const { institution_id, area_id, lat, lng } = input; const { institution_id, area_id} = input;
const lat = ctx.isEmpty(input.lat) ? 0 : input.lat;
const lng = ctx.isEmpty(input.lng) ? 0 : input.lng;
const institution = await ctx.classModel.CourseInstitution.one({ where: { id: institution_id } }); const institution = await ctx.classModel.CourseInstitution.one({ where: { id: institution_id } });
const teachers = await this.getTeachers({ institution_id, limit: 6 }); const teachers = await this.getTeachers({ institution_id, limit: 6 });
const classes = await this.getClasses({ institution_id, limit: 4 }); const classes = await this.getClasses({ institution_id, limit: 4 });
...@@ -85,12 +87,13 @@ class InstitutionService extends Service { ...@@ -85,12 +87,13 @@ class InstitutionService extends Service {
//计算校区距离 //计算校区距离
const areas_ret = await this.getInstitutionAreas({ institution_id, limit: 1000 });//校区 const areas_ret = await this.getInstitutionAreas({ institution_id, limit: 1000 });//校区
const area_rows = areas_ret.rows; const area_rows = areas_ret.rows;
const area_lbs = await this.computeDistance(area_rows, { lat, lng });//计算距离信息 const area_lbs = (lat > 0 || lng > 0) ? await this.computeDistance(area_rows, { lat, lng }) : [];//计算距离信息
const areas = []; const areas = [];
for (let i in area_rows) { for (let i in area_rows) {
const area = area_rows[i]; const area = area_rows[i];
const lbs = area_lbs[i]; const lbs = i < area_lbs.length ? area_lbs[i] : {distance:0, duration:0, travel_method:''};
const area_name = area.name; const area_name = area.name;
const distance = lbs.distance; const distance = lbs.distance;
const duration = lbs.duration; const duration = lbs.duration;
...@@ -149,6 +152,9 @@ class InstitutionService extends Service { ...@@ -149,6 +152,9 @@ class InstitutionService extends Service {
teacher.dataValues.point_tags = teacher.point ? teacher.point.split(';') : []; teacher.dataValues.point_tags = teacher.point ? teacher.point.split(';') : [];
teacher.dataValues.work_experience_tags = teacher.work_experience ? teacher.work_experience.split(';') : []; teacher.dataValues.work_experience_tags = teacher.work_experience ? teacher.work_experience.split(';') : [];
const institution = await ctx.classModel.CourseInstitution.find({where: {id: teacher.institution_id}});
teacher.dataValues.institution_name = institution.name;
return teacher; return teacher;
} }
......
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