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
06c60cc4
Commit
06c60cc4
authored
Sep 25, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
5b05f827
Pipeline
#14140
passed with stage
in 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
institution.js
app/service/course/institution.js
+17
-14
No files found.
app/service/course/institution.js
View file @
06c60cc4
...
...
@@ -67,9 +67,22 @@ class InstitutionService extends Service {
const
institution
=
await
ctx
.
classModel
.
CourseInstitution
.
one
({
where
:
{
id
:
institution_id
}
});
const
teachers
=
await
this
.
getTeachers
({
institution_id
,
limit
:
6
});
const
classes
=
await
this
.
getClasses
({
institution_id
,
limit
:
4
});
const
areas_ret
=
await
this
.
getInstitutionAreas
({
institution_id
,
limit
:
1000
});
//校区
const
institution_images
=
await
ctx
.
classModel
.
CourseImages
.
all
({
where
:
{
type
:
1
,
type_id
:
institution_id
}
});
//图片
//处理详情页信息
const
current_area
=
await
ctx
.
classModel
.
CourseArea
.
one
({
id
:
area_id
});
let
institution_detail
=
await
this
.
formatInstitutions
([
institution
]);
institution_detail
=
institution_detail
[
0
];
institution_detail
.
address
=
current_area
.
address
;
institution_detail
.
phone
=
current_area
.
phone
;
institution_detail
.
description
=
institution
.
description
;
institution_detail
.
point
=
institution
.
point
;
institution_detail
.
honor
=
institution
.
honor
;
institution_detail
.
is_collect
=
0
;
//计算校区距离
const
areas_ret
=
await
this
.
getInstitutionAreas
({
institution_id
,
limit
:
1000
});
//校区
const
area_rows
=
areas_ret
.
rows
;
const
area_lbs
=
await
this
.
computeDistance
(
area_rows
,
{
lat
,
lng
});
//计算距离信息
const
areas
=
[];
...
...
@@ -88,6 +101,9 @@ class InstitutionService extends Service {
if
(
distance
===
0
&&
duration
===
0
)
{
travel_tips
=
'暂无法计算出距离'
;
}
if
(
area
.
id
==
area_id
&&
area
.
institution_id
==
institution_id
)
{
institution_detail
.
travel_tips
=
travel_tips
;
}
areas
.
push
({
id
:
area
.
id
,
institution_id
:
area
.
institution_id
,
...
...
@@ -100,19 +116,6 @@ class InstitutionService extends Service {
});
}
const
institution_images
=
await
ctx
.
classModel
.
CourseImages
.
all
({
where
:
{
type
:
1
,
type_id
:
institution_id
}
});
//图片
//处理详情页信息
const
current_area
=
await
ctx
.
classModel
.
CourseArea
.
one
({
id
:
area_id
});
let
institution_detail
=
await
this
.
formatInstitutions
([
institution
]);
institution_detail
=
institution_detail
[
0
];
institution_detail
.
address
=
current_area
.
address
;
institution_detail
.
phone
=
current_area
.
phone
;
institution_detail
.
description
=
institution
.
description
;
institution_detail
.
point
=
institution
.
point
;
institution_detail
.
honor
=
institution
.
honor
;
institution_detail
.
is_collect
=
0
;
//是否收藏过
const
collection_ret
=
await
ctx
.
classModel
.
CourseUserCollection
.
one
({
where
:
{
user_uuid
,
institution_id
,
is_deleted
:
0
}
});
if
(
collection_ret
&&
collection_ret
.
id
)
{
...
...
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