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
0cd7ed73
Commit
0cd7ed73
authored
Oct 11, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix class image
parent
ec2cd57f
Pipeline
#14744
passed with stage
in 34 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
institution.js
app/service/course/institution.js
+29
-4
No files found.
app/service/course/institution.js
View file @
0cd7ed73
...
@@ -30,7 +30,7 @@ class InstitutionService extends Service {
...
@@ -30,7 +30,7 @@ class InstitutionService extends Service {
const
next_next_level
=
cat_level
+
2
;
const
next_next_level
=
cat_level
+
2
;
const
next_cat
=
await
ctx
.
classModel
.
CourseCat
.
all
({
where
:
{
level
:
next_level
,
parent_id
:
cat_id
}
});
const
next_cat
=
await
ctx
.
classModel
.
CourseCat
.
all
({
where
:
{
level
:
next_level
,
parent_id
:
cat_id
}
});
const
next_next_cat
=
await
ctx
.
classModel
.
CourseCat
.
all
({
where
:
{
level
:
next_next_level
,
first_id
:
cat_id
}
});
const
next_next_cat
=
await
ctx
.
classModel
.
CourseCat
.
all
({
where
:
{
level
:
next_next_level
,
first_id
:
cat_id
}
});
let
cat_ids
=
[
cat_id
];
let
cat_ids
=
[
cat_id
];
cat_ids
=
cat_ids
.
concat
(
R
.
pluck
(
'id'
,
next_cat
)).
concat
(
R
.
pluck
(
'id'
,
next_next_cat
));
cat_ids
=
cat_ids
.
concat
(
R
.
pluck
(
'id'
,
next_cat
)).
concat
(
R
.
pluck
(
'id'
,
next_next_cat
));
const
institutions
=
await
ctx
.
classModel
.
CourseInstitutionToCat
.
all
({
where
:
{
cat_id
:
{
$in
:
cat_ids
}
}
});
const
institutions
=
await
ctx
.
classModel
.
CourseInstitutionToCat
.
all
({
where
:
{
cat_id
:
{
$in
:
cat_ids
}
}
});
where
.
id
=
{
$in
:
R
.
pluck
(
'institution_id'
,
institutions
)
};
where
.
id
=
{
$in
:
R
.
pluck
(
'institution_id'
,
institutions
)
};
...
@@ -45,7 +45,7 @@ class InstitutionService extends Service {
...
@@ -45,7 +45,7 @@ class InstitutionService extends Service {
// 关联校区表查找信息
// 关联校区表查找信息
const
include
=
[{
model
:
ctx
.
classModel
.
CourseArea
,
where
:
{
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'institution_id'
,
'name'
,
'address'
,
'lat'
,
'lng'
]
}];
const
include
=
[{
model
:
ctx
.
classModel
.
CourseArea
,
where
:
{
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'institution_id'
,
'name'
,
'address'
,
'lat'
,
'lng'
]
}];
const
attributes
=
[
'id'
,
'name'
,
'type'
,
'establishment_time'
,
'class_type'
,
'teacher_count'
,
'teacher_experience'
,
'corner'
,
'min_age'
,
'max_age'
,
'price'
,
'characteristic'
];
const
attributes
=
[
'id'
,
'name'
,
'type'
,
'establishment_time'
,
'class_type'
,
'teacher_count'
,
'teacher_experience'
,
'corner'
,
'min_age'
,
'max_age'
,
'price'
,
'characteristic'
];
const
institutions
=
await
ctx
.
classModel
.
CourseInstitution
.
findAll
({
attributes
,
include
,
where
});
const
institutions
=
await
ctx
.
classModel
.
CourseInstitution
.
findAll
({
attributes
,
include
,
where
});
const
institution_area_list
=
await
this
.
getInstitutionAreaList
(
institutions
);
// 将校区表处理成数组
const
institution_area_list
=
await
this
.
getInstitutionAreaList
(
institutions
);
// 将校区表处理成数组
...
@@ -181,7 +181,32 @@ class InstitutionService extends Service {
...
@@ -181,7 +181,32 @@ class InstitutionService extends Service {
const
classs
=
await
ctx
.
classModel
.
CourseClass
.
one
({
where
});
const
classs
=
await
ctx
.
classModel
.
CourseClass
.
one
({
where
});
classs
.
dataValues
.
age_text
=
Number
(
classs
.
max_age
)
>
0
?
`
${
classs
.
min_age
}
-
${
classs
.
max_age
}
岁`
:
''
;
classs
.
dataValues
.
age_text
=
Number
(
classs
.
max_age
)
>
0
?
`
${
classs
.
min_age
}
-
${
classs
.
max_age
}
岁`
:
''
;
classs
.
dataValues
.
point_tags
=
classs
.
point
?
classs
.
point
.
split
(
','
)
:
[];
classs
.
dataValues
.
point_tags
=
classs
.
point
?
classs
.
point
.
split
(
','
)
:
[];
classs
.
dataValues
.
photo_album
=
classs
.
image
?
classs
.
image
.
split
(
';'
)
:
[];
const
class_images
=
await
ctx
.
classModel
.
CourseImages
.
findAll
({
where
:
{
type
:
2
,
type_id
:
classs
.
id
,
is_video
:
0
}
});
// 处理图片
const
photo_album
=
[];
const
photo_check
=
[];
// 去重
for
(
const
i
in
class_images
)
{
const
class_image
=
class_images
[
i
];
if
(
class_image
.
is_video
>
0
)
{
if
(
photo_check
.
includes
(
class_image
.
video_url
))
{
continue
;
}
else
{
photo_check
.
push
(
class_image
.
video_url
);
}
}
else
{
if
(
photo_check
.
includes
(
class_image
.
image_url
))
{
continue
;
}
else
{
photo_check
.
push
(
class_image
.
image_url
);
}
}
photo_album
.
push
({
image
:
class_image
.
image_url
,
is_video
:
class_image
.
is_video
,
video_url
:
class_image
.
video_url
,
});
}
classs
.
dataValues
.
photo_album
=
photo_album
;
classs
.
dataValues
.
class_period
=
classs
.
class_period
>
0
?
classs
.
class_period
:
''
;
classs
.
dataValues
.
class_period
=
classs
.
class_period
>
0
?
classs
.
class_period
:
''
;
return
classs
;
return
classs
;
...
@@ -239,7 +264,7 @@ class InstitutionService extends Service {
...
@@ -239,7 +264,7 @@ class InstitutionService extends Service {
for
(
const
i
in
classes
.
rows
)
{
for
(
const
i
in
classes
.
rows
)
{
const
classs
=
classes
.
rows
[
i
];
const
classs
=
classes
.
rows
[
i
];
classs
.
dataValues
.
image
=
class_images
[
i
]
?
class_images
[
i
].
image_url
:
''
;
classs
.
dataValues
.
image
=
class_images
[
i
]
?
class_images
[
i
].
image_url
:
''
;
classs
.
dataValues
.
price_text
=
classs
.
price
?
classs
.
price
:
'现场咨询'
;
classs
.
dataValues
.
price_text
=
classs
.
price
?
classs
.
price
:
'现场咨询'
;
classs
.
dataValues
.
class_period
=
classs
.
class_period
>
0
?
classs
.
class_period
:
''
;
classs
.
dataValues
.
class_period
=
classs
.
class_period
>
0
?
classs
.
class_period
:
''
;
ret
.
push
(
classs
);
ret
.
push
(
classs
);
}
}
...
...
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