Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
1990eff7
Commit
1990eff7
authored
Sep 26, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
course teacher_info add institution_name
parent
006efeb4
Pipeline
#14313
passed with stage
in 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
institution.js
app/service/course/institution.js
+9
-3
No files found.
app/service/course/institution.js
View file @
1990eff7
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment