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
ae23777e
Commit
ae23777e
authored
Apr 17, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add feedback
parent
76072b19
Pipeline
#21813
passed with stage
in 3 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
0 deletions
+109
-0
option.js
app/controller/course/v5/option.js
+24
-0
courseFeedback.js
app/model/class/v5/courseFeedback.js
+43
-0
course_v5.js
app/router/course_v5.js
+2
-0
option.js
app/service/course/v5/option.js
+34
-0
report.js
app/service/course/v5/report.js
+6
-0
No files found.
app/controller/course/v5/option.js
View file @
ae23777e
...
@@ -30,6 +30,30 @@ class OptionController extends Controller {
...
@@ -30,6 +30,30 @@ class OptionController extends Controller {
const
ret
=
await
service
.
course
.
v5
.
option
.
getCategoryList
(
queryParams
);
const
ret
=
await
service
.
course
.
v5
.
option
.
getCategoryList
(
queryParams
);
ctx
.
success
(
ret
);
ctx
.
success
(
ret
);
}
}
// 获取反馈类型列表
async
getFeedbackTypeList
()
{
const
{
ctx
,
service
}
=
this
;
const
ret
=
await
service
.
course
.
v5
.
option
.
getFeedbackTypeList
();
ctx
.
success
(
ret
);
}
// 上传反馈内容
async
addFeedback
()
{
const
{
ctx
,
service
}
=
this
;
const
params
=
ctx
.
request
.
body
;
if
(
ctx
.
isEmpty
(
params
)
||
ctx
.
isEmpty
(
params
.
type
))
{
ctx
.
failed
(
'type is empty'
);
}
if
(
ctx
.
isEmpty
(
params
)
||
ctx
.
isEmpty
(
params
.
content
))
{
ctx
.
failed
(
'content is empty'
);
}
const
ret
=
await
service
.
course
.
v5
.
option
.
addFeedback
(
params
);
ctx
.
success
(
ret
);
}
}
}
module
.
exports
=
OptionController
;
module
.
exports
=
OptionController
;
app/model/class/v5/courseFeedback.js
0 → 100644
View file @
ae23777e
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
}
=
app
.
Sequelize
;
const
CourseFeedback
=
app
.
classModel
.
define
(
'course_feedback'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
user_uuid
:
STRING
,
type
:
INTEGER
,
content
:
STRING
,
images
:
STRING
,
is_deleted
:
INTEGER
,
created_time
:
{
type
:
DATE
,
allowNull
:
true
,
get
()
{
const
date
=
this
.
getDataValue
(
'created_time'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
updated_time
:
{
type
:
DATE
,
allowNull
:
true
,
get
()
{
const
date
=
this
.
getDataValue
(
'updated_time'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
},
{
timestamps
:
false
,
tableName
:
'course_feedback'
,
});
return
CourseFeedback
;
};
app/router/course_v5.js
View file @
ae23777e
...
@@ -16,6 +16,8 @@ module.exports = app => {
...
@@ -16,6 +16,8 @@ module.exports = app => {
router
.
get
(
'third'
,
'/banner/all'
,
'course.v5.option.getBannerList'
);
// 获取banner列表
router
.
get
(
'third'
,
'/banner/all'
,
'course.v5.option.getBannerList'
);
// 获取banner列表
router
.
get
(
'third'
,
'/options'
,
'course.v5.option.getOptions'
);
// 获取配置项
router
.
get
(
'third'
,
'/options'
,
'course.v5.option.getOptions'
);
// 获取配置项
router
.
post
(
'third'
,
'/wechat/qrcode'
,
'course.v5.wechat.getQRCode'
);
// 获取二维码
router
.
post
(
'third'
,
'/wechat/qrcode'
,
'course.v5.wechat.getQRCode'
);
// 获取二维码
router
.
get
(
'third'
,
'/feedback/type'
,
'course.v5.option.getFeedbackTypeList'
);
// 获取反馈分类
router
.
post
(
'third'
,
'/feedback'
,
auth
,
'course.v5.option.addFeedback'
);
// 反馈
router
.
get
(
'third'
,
'/class/all'
,
auth
,
'course.v5.institution.getClassList'
);
// 获取课程列表
router
.
get
(
'third'
,
'/class/all'
,
auth
,
'course.v5.institution.getClassList'
);
// 获取课程列表
router
.
get
(
'third'
,
'/class/:class_id'
,
auth
,
'course.v5.institution.getClassInfo'
);
// 获取课程详情
router
.
get
(
'third'
,
'/class/:class_id'
,
auth
,
'course.v5.institution.getClassInfo'
);
// 获取课程详情
...
...
app/service/course/v5/option.js
View file @
ae23777e
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
'use strict'
;
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
Service
=
require
(
'egg'
).
Service
;
const
moment
=
require
(
'moment'
);
const
MODE
=
[
const
MODE
=
[
{
{
...
@@ -147,6 +148,39 @@ class OptionService extends Service {
...
@@ -147,6 +148,39 @@ class OptionService extends Service {
}
}
// 获取反馈类型列表
async
getFeedbackTypeList
()
{
const
ret
=
{
list
:
[
{
id
:
1
,
name
:
'使用疑问'
},
{
id
:
2
,
name
:
'功能故障'
},
{
id
:
3
,
name
:
'数据错误'
},
{
id
:
4
,
name
:
'投诉'
},
{
id
:
5
,
name
:
'提建议'
},
],
};
return
ret
;
}
// 提交反馈
async
addFeedback
(
input
)
{
const
{
ctx
}
=
this
;
const
data
=
{
user_uuid
:
ctx
.
userUuid
,
type
:
input
.
type
,
content
:
input
.
content
,
images
:
input
.
images
,
status
:
1
,
is_deleted
:
0
,
created_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
};
await
ctx
.
classModel
.
V5
.
CourseFeedback
.
create
(
data
);
return
{
result
:
true
};
}
}
}
module
.
exports
=
OptionService
;
module
.
exports
=
OptionService
;
app/service/course/v5/report.js
View file @
ae23777e
...
@@ -85,6 +85,8 @@ class ReportService extends Service {
...
@@ -85,6 +85,8 @@ class ReportService extends Service {
ctx
.
failed
(
'尚未生成报告'
);
ctx
.
failed
(
'尚未生成报告'
);
}
}
const
category
=
await
ctx
.
classModel
.
V5
.
CourseV5Category
.
findOne
({
where
:
{
id
:
userReportInfo
.
cat_id
},
attributes
:
[
'name'
,
'url'
]
});
let
reportColumnDetailList
=
ctx
.
isEmpty
(
userReportInfo
.
report_column_detail_ids
)
?
[]
:
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumnDetail
.
findAll
({
where
:
{
id
:
{
$in
:
eval
(
userReportInfo
.
report_column_detail_ids
)
},
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'report_column_id'
,
'sub_title'
,
'level'
,
'content'
,
'advice'
],
raw
:
true
});
let
reportColumnDetailList
=
ctx
.
isEmpty
(
userReportInfo
.
report_column_detail_ids
)
?
[]
:
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumnDetail
.
findAll
({
where
:
{
id
:
{
$in
:
eval
(
userReportInfo
.
report_column_detail_ids
)
},
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'report_column_id'
,
'sub_title'
,
'level'
,
'content'
,
'advice'
],
raw
:
true
});
const
reportColumnList
=
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumn
.
findAll
({
where
:
{
id
:
{
$in
:
R
.
pluck
(
'report_column_id'
,
reportColumnDetailList
)
}
},
order
:
[[
'sort'
,
'asc'
]],
attributes
:
[
'id'
,
'title'
],
raw
:
true
});
const
reportColumnList
=
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumn
.
findAll
({
where
:
{
id
:
{
$in
:
R
.
pluck
(
'report_column_id'
,
reportColumnDetailList
)
}
},
order
:
[[
'sort'
,
'asc'
]],
attributes
:
[
'id'
,
'title'
],
raw
:
true
});
reportColumnDetailList
=
_
.
groupBy
(
reportColumnDetailList
,
'report_column_id'
);
reportColumnDetailList
=
_
.
groupBy
(
reportColumnDetailList
,
'report_column_id'
);
...
@@ -107,6 +109,7 @@ class ReportService extends Service {
...
@@ -107,6 +109,7 @@ class ReportService extends Service {
const
userBabyInfo
=
await
ctx
.
classModel
.
V5
.
CourseV5UserBaby
.
findOne
({
where
:
{
user_uuid
:
userReportInfo
.
user_uuid
,
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'user_uuid'
,
'baby_sex'
,
'baby_name'
]
});
const
userBabyInfo
=
await
ctx
.
classModel
.
V5
.
CourseV5UserBaby
.
findOne
({
where
:
{
user_uuid
:
userReportInfo
.
user_uuid
,
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'user_uuid'
,
'baby_sex'
,
'baby_name'
]
});
const
ret
=
{
const
ret
=
{
category
:
ctx
.
isEmpty
(
category
)
?
{}
:
category
,
tags
,
tags
,
report
,
report
,
user
:
userBabyInfo
,
user
:
userBabyInfo
,
...
@@ -124,6 +127,8 @@ class ReportService extends Service {
...
@@ -124,6 +127,8 @@ class ReportService extends Service {
ctx
.
failed
(
'尚未生成报告'
);
ctx
.
failed
(
'尚未生成报告'
);
}
}
const
category
=
await
ctx
.
classModel
.
V5
.
CourseV5Category
.
findOne
({
where
:
{
id
:
userReportInfo
.
cat_id
},
attributes
:
[
'name'
,
'url'
]
});
let
reportColumnDetailList
=
ctx
.
isEmpty
(
userReportInfo
.
report_column_detail_ids
)
?
[]
:
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumnDetail
.
findAll
({
where
:
{
id
:
{
$in
:
eval
(
userReportInfo
.
report_column_detail_ids
)
},
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'report_column_id'
,
'sub_title'
,
'level'
,
'content'
,
'advice'
],
raw
:
true
});
let
reportColumnDetailList
=
ctx
.
isEmpty
(
userReportInfo
.
report_column_detail_ids
)
?
[]
:
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumnDetail
.
findAll
({
where
:
{
id
:
{
$in
:
eval
(
userReportInfo
.
report_column_detail_ids
)
},
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'report_column_id'
,
'sub_title'
,
'level'
,
'content'
,
'advice'
],
raw
:
true
});
const
reportColumnList
=
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumn
.
findAll
({
where
:
{
id
:
{
$in
:
R
.
pluck
(
'report_column_id'
,
reportColumnDetailList
)
}
},
order
:
[[
'sort'
,
'asc'
]],
attributes
:
[
'id'
,
'title'
],
raw
:
true
});
const
reportColumnList
=
await
ctx
.
classModel
.
V5
.
CourseV5ReportColumn
.
findAll
({
where
:
{
id
:
{
$in
:
R
.
pluck
(
'report_column_id'
,
reportColumnDetailList
)
}
},
order
:
[[
'sort'
,
'asc'
]],
attributes
:
[
'id'
,
'title'
],
raw
:
true
});
reportColumnDetailList
=
_
.
groupBy
(
reportColumnDetailList
,
'report_column_id'
);
reportColumnDetailList
=
_
.
groupBy
(
reportColumnDetailList
,
'report_column_id'
);
...
@@ -146,6 +151,7 @@ class ReportService extends Service {
...
@@ -146,6 +151,7 @@ class ReportService extends Service {
const
userBabyInfo
=
await
ctx
.
classModel
.
V5
.
CourseV5UserBaby
.
findOne
({
where
:
{
user_uuid
:
userReportInfo
.
user_uuid
,
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'user_uuid'
,
'baby_sex'
,
'baby_name'
]
});
const
userBabyInfo
=
await
ctx
.
classModel
.
V5
.
CourseV5UserBaby
.
findOne
({
where
:
{
user_uuid
:
userReportInfo
.
user_uuid
,
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'user_uuid'
,
'baby_sex'
,
'baby_name'
]
});
const
ret
=
{
const
ret
=
{
category
:
ctx
.
isEmpty
(
category
)
?
{}
:
category
,
tags
,
tags
,
report
,
report
,
user
:
userBabyInfo
,
user
:
userBabyInfo
,
...
...
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