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
68f9052c
Commit
68f9052c
authored
Apr 11, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix wechat v5
parent
cf331820
Pipeline
#21599
passed with stage
in 3 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
56 deletions
+30
-56
course_v5.js
app/router/course_v5.js
+0
-53
option.js
app/service/course/v5/option.js
+29
-3
user.js
app/service/course/v5/user.js
+1
-0
No files found.
app/router/course_v5.js
View file @
68f9052c
...
@@ -4,59 +4,6 @@ module.exports = app => {
...
@@ -4,59 +4,6 @@ module.exports = app => {
const
router
=
app
.
router
.
namespace
(
app
.
config
.
projectRootPath
+
'/course/v5'
);
const
router
=
app
.
router
.
namespace
(
app
.
config
.
projectRootPath
+
'/course/v5'
);
const
miniAuth
=
app
.
middleware
.
miniAuthV5
();
// 因为不跟现有的用户中心系统,所以使用单独的登录中间件
const
miniAuth
=
app
.
middleware
.
miniAuthV5
();
// 因为不跟现有的用户中心系统,所以使用单独的登录中间件
// 版本二
router
.
get
(
'third'
,
'/cats'
,
'course.v4.institution.getCats'
);
// 分类
router
.
get
(
'third'
,
'/options'
,
'course.v4.option.getOptions'
);
// 筛选项
router
.
get
(
'third'
,
'/banners'
,
'course.v4.option.getBanners'
);
// banner
router
.
post
(
'third'
,
'/address'
,
miniAuth
,
'course.v4.location.getAddress'
);
// 根据经纬度或ip获取地理位置信息
router
.
get
(
'third'
,
'/institutions'
,
miniAuth
,
'course.v4.institution.getInstitutions'
);
// 机构列表
router
.
get
(
'third'
,
'/institution/:institution_id'
,
miniAuth
,
'course.v4.institution.getInstitution'
);
// 机构详情
router
.
get
(
'third'
,
'/classes'
,
miniAuth
,
'course.v4.institution.getClasses'
);
// 课程列表
router
.
get
(
'third'
,
'/class/:class_id'
,
miniAuth
,
'course.v4.institution.getClass'
);
// 课程详情
router
.
get
(
'third'
,
'/teachers'
,
miniAuth
,
'course.v4.institution.getTeachers'
);
// 老师列表
router
.
get
(
'third'
,
'/teacher/:teacher_id'
,
miniAuth
,
'course.v4.institution.getTeacher'
);
// 老师详情
router
.
post
(
'third'
,
'/user/auth'
,
'course.v4.user.auth'
);
// 微信授权登录
router
.
post
(
'third'
,
'/user/register_user'
,
miniAuth
,
'course.v4.user.registerUserInfo'
);
// 授权后注册用户
router
.
get
(
'third'
,
'/user/info'
,
miniAuth
,
'course.v4.user.getUserInfo'
);
// 获取用户信息
router
.
get
(
'third'
,
'/user/baby'
,
miniAuth
,
'course.v4.user.getBabyInfo'
);
// 获取baby信息
router
.
post
(
'third'
,
'/user/baby'
,
miniAuth
,
'course.v4.user.saveBabyInfo'
);
// 保存baby信息
router
.
delete
(
'third'
,
'/user/baby'
,
miniAuth
,
'course.v4.user.delBabyInfo'
);
// 删除baby信息
router
.
get
(
'third'
,
'/user/collection/institution'
,
miniAuth
,
'course.v4.institution.getUserCollectedInstitutions'
);
// 收藏的机构列表
router
.
get
(
'third'
,
'/user/collection/class'
,
miniAuth
,
'course.v4.institution.getUserCollectedClasses'
);
// 收藏的课程列表
router
.
post
(
'third'
,
'/user/collection/institution'
,
miniAuth
,
'course.v4.user.collectInstitution'
);
// 收藏机构
router
.
delete
(
'third'
,
'/user/collection/institution'
,
miniAuth
,
'course.v4.user.delCollectInstitution'
);
// 取消收藏机构
router
.
post
(
'third'
,
'/user/collection/class'
,
miniAuth
,
'course.v4.user.collectClass'
);
// 收藏课程
router
.
delete
(
'third'
,
'/user/collection/class'
,
miniAuth
,
'course.v4.user.delCollectClass'
);
// 取消收藏课程
router
.
get
(
'third'
,
'/wechat/callbackAction'
,
'course.v4.wechat.check'
);
router
.
post
(
'third'
,
'/wechat/callbackAction'
,
'course.v4.wechat.callbackAction'
);
router
.
post
(
'third'
,
'/wechat/test'
,
'course.v4.wechat.test'
);
router
.
get
(
'third'
,
'/comments'
,
miniAuth
,
'course.v4.institution.getComments'
);
// 评论列表
router
.
get
(
'third'
,
'/search/hot'
,
miniAuth
,
'course.v4.institution.getHotSearch'
);
// 热搜
router
.
get
(
'third'
,
'/search/suggest'
,
miniAuth
,
'course.v4.institution.getSuggestSearch'
);
// 搜索联想
router
.
get
(
'third'
,
'/search'
,
miniAuth
,
'course.v4.institution.search'
);
// 搜索
router
.
get
(
'third'
,
'/user/search'
,
miniAuth
,
'course.v4.institution.getUserSearch'
);
// 用户搜索历史
router
.
delete
(
'third'
,
'/user/search'
,
miniAuth
,
'course.v4.institution.deleteUserSearch'
);
// 清空用户搜索记录
router
.
get
(
'third'
,
'/article/all'
,
miniAuth
,
'course.v4.institution.getArticlesByCat'
);
// 根据分类获取选课指南
router
.
get
(
'third'
,
'/article/recommend'
,
miniAuth
,
'course.v4.institution.getArticlesByRecommend'
);
// 获取推荐选课指南
router
.
get
(
'third'
,
'/article/:id'
,
miniAuth
,
'course.v4.institution.getArticle'
);
// 获取选课指南详情
router
.
post
(
'third'
,
'/like'
,
miniAuth
,
'course.v4.institution.like'
);
// 点赞
router
.
post
(
'third'
,
'/unlike'
,
miniAuth
,
'course.v4.institution.unlike'
);
// 取消点赞
router
.
get
(
'third'
,
'/online/classes'
,
'course.v4.online.getClasses'
);
// 在线课程列表
router
.
post
(
'third'
,
'/online/collection/class'
,
miniAuth
,
'course.v4.online.collectClass'
);
// 收藏在线课程
router
.
get
(
'third'
,
'/online/collection/classes'
,
miniAuth
,
'course.v4.online.getCollectionClasses'
);
// 在线课程收藏列表
router
.
get
(
'third'
,
'/online/class/:id'
,
'course.v4.online.getClass'
);
// 在线课程详情
router
.
get
(
'third'
,
'/online/option'
,
'course.v4.online.getOption'
);
// 在线课程选项
router
.
delete
(
'third'
,
'/online/collection/class'
,
miniAuth
,
'course.v4.online.delCollectClass'
);
// 取消收藏课程
router
.
post
(
'third'
,
'/verification_code'
,
'course.v5.user.sendVerificationCode'
);
// 发送验证码
router
.
post
(
'third'
,
'/verification_code'
,
'course.v5.user.sendVerificationCode'
);
// 发送验证码
router
.
post
(
'third'
,
'/login/phone'
,
'course.v5.user.loginByPhone'
);
// 手机号登录
router
.
post
(
'third'
,
'/login/phone'
,
'course.v5.user.loginByPhone'
);
// 手机号登录
router
.
post
(
'third'
,
'/login/wechat'
,
'course.v5.user.loginByWX'
);
// 微信登录
router
.
post
(
'third'
,
'/login/wechat'
,
'course.v5.user.loginByWX'
);
// 微信登录
...
...
app/service/course/v5/option.js
View file @
68f9052c
...
@@ -35,7 +35,7 @@ const DISTANCES = [
...
@@ -35,7 +35,7 @@ const DISTANCES = [
class
OptionService
extends
Service
{
class
OptionService
extends
Service
{
async
getOptions
()
{
async
getOptions
()
{
const
{
service
}
=
this
;
const
{
service
}
=
this
;
const
cats
=
await
service
.
course
.
v
4
.
institution
.
getCats
();
const
cats
=
await
service
.
course
.
v
5
.
institution
.
getCats
();
const
options
=
{
const
options
=
{
cats
,
cats
,
...
@@ -48,12 +48,12 @@ class OptionService extends Service {
...
@@ -48,12 +48,12 @@ class OptionService extends Service {
async
getBanners
(
alias
)
{
async
getBanners
(
alias
)
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
bannerType
=
await
ctx
.
classModel
.
V
4
.
CourseBannerType
.
findOne
({
where
:
{
alias
,
status
:
'online'
,
is_deleted
:
0
},
row
:
true
});
const
bannerType
=
await
ctx
.
classModel
.
V
5
.
CourseBannerType
.
findOne
({
where
:
{
alias
,
status
:
'online'
,
is_deleted
:
0
},
row
:
true
});
if
(
ctx
.
isEmpty
(
bannerType
))
{
if
(
ctx
.
isEmpty
(
bannerType
))
{
ctx
.
failed
(
'数据不存在'
);
ctx
.
failed
(
'数据不存在'
);
}
}
const
banners
=
await
ctx
.
classModel
.
V
4
.
CourseBanner
.
findAll
({
where
:
{
type_id
:
bannerType
.
id
,
status
:
'online'
,
is_deleted
:
0
},
order
:
[[
'sort'
,
'asc'
]],
row
:
true
});
const
banners
=
await
ctx
.
classModel
.
V
5
.
CourseBanner
.
findAll
({
where
:
{
type_id
:
bannerType
.
id
,
status
:
'online'
,
is_deleted
:
0
},
order
:
[[
'sort'
,
'asc'
]],
row
:
true
});
const
ret
=
{
const
ret
=
{
results
:
banners
,
results
:
banners
,
count
:
banners
.
length
,
count
:
banners
.
length
,
...
@@ -61,6 +61,32 @@ class OptionService extends Service {
...
@@ -61,6 +61,32 @@ class OptionService extends Service {
return
ret
;
return
ret
;
}
}
// 获取分类
async
getCategoryList
(
input
)
{
const
{
ctx
}
=
this
;
const
parentId
=
Number
(
input
.
parent_id
)
||
0
;
const
type
=
Number
(
input
.
type
)
||
1
;
const
filter
=
{
where
:
{
type
,
is_deleted
:
0
,
status
:
1
},
order
:
[[
'sort'
,
'asc'
],
[
'id'
,
'asc'
]]
};
if
(
parentId
>
0
)
{
filter
.
where
.
parent_id
=
parentId
;
}
const
categoryList
=
await
ctx
.
classModel
.
V5
.
CourseV5Category
.
findAll
(
filter
);
const
results
=
[];
for
(
const
v
of
categoryList
)
{
results
.
push
({
id
:
v
.
id
,
type
:
v
.
type
,
parent_id
:
v
.
parent_id
,
name
:
v
.
name
,
selected_icon
:
v
.
selected_icon
,
});
}
}
}
}
module
.
exports
=
OptionService
;
module
.
exports
=
OptionService
;
app/service/course/v5/user.js
View file @
68f9052c
...
@@ -159,6 +159,7 @@ class UserService extends Service {
...
@@ -159,6 +159,7 @@ class UserService extends Service {
data
.
openid
=
user
.
openid
;
data
.
openid
=
user
.
openid
;
await
ctx
.
classModel
.
V5
.
update
(
data
,
{
where
:
{
id
:
userInfo
.
id
}
});
await
ctx
.
classModel
.
V5
.
update
(
data
,
{
where
:
{
id
:
userInfo
.
id
}
});
data
.
uuid
=
userInfo
.
uuid
;
data
.
uuid
=
userInfo
.
uuid
;
await
ctx
.
classModel
.
V5
.
update
({
is_deleted
:
1
},
{
where
:
{
id
:
user
.
id
}
});
}
else
{
}
else
{
await
ctx
.
classModel
.
V5
.
update
(
data
,
{
where
:
{
id
:
user
.
id
}
});
await
ctx
.
classModel
.
V5
.
update
(
data
,
{
where
:
{
id
:
user
.
id
}
});
data
.
uuid
=
user
.
uuid
;
data
.
uuid
=
user
.
uuid
;
...
...
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