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
0d753082
Commit
0d753082
authored
Apr 16, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add generateReport
parent
253d033e
Pipeline
#21760
passed with stage
in 12 seconds
Changes
11
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
188 additions
and
42 deletions
+188
-42
report.js
app/controller/course/v5/report.js
+15
-0
courseUserReport.js
app/model/class/v5/courseUserReport.js
+44
-0
courseV5Answer.js
app/model/class/v5/courseV5Answer.js
+1
-0
courseV5AnswerToFilter.js
app/model/class/v5/courseV5AnswerToFilter.js
+1
-0
courseV5AnswerToReportColumnDetail.js
app/model/class/v5/courseV5AnswerToReportColumnDetail.js
+5
-7
courseV5Question.js
app/model/class/v5/courseV5Question.js
+1
-0
courseV5ReportColumn.js
app/model/class/v5/courseV5ReportColumn.js
+43
-0
courseV5ReportColumnDetail.js
app/model/class/v5/courseV5ReportColumnDetail.js
+43
-0
course.js
app/router/course.js
+30
-31
course_v5.js
app/router/course_v5.js
+5
-4
report.js
app/service/course/v5/report.js
+0
-0
No files found.
app/controller/course/v5/report.js
View file @
0d753082
...
...
@@ -14,6 +14,21 @@ class ReportController extends Controller {
const
ret
=
await
service
.
course
.
v5
.
report
.
getQuestionList
(
queryParams
.
cat_id
);
ctx
.
success
(
ret
);
}
// 生成报告
async
generateReport
()
{
const
{
ctx
,
service
}
=
this
;
const
queryParams
=
ctx
.
request
.
body
;
if
(
ctx
.
isEmpty
(
queryParams
)
||
ctx
.
isEmpty
(
queryParams
.
data
))
{
ctx
.
failed
(
'data is empty'
);
}
if
(
ctx
.
isEmpty
(
queryParams
)
||
ctx
.
isEmpty
(
queryParams
.
cat_id
))
{
ctx
.
failed
(
'cat_id is empty'
);
}
const
ret
=
await
service
.
course
.
v5
.
report
.
generateReport
(
queryParams
);
ctx
.
success
(
ret
);
}
}
module
.
exports
=
ReportController
;
app/model/class/v5/courseUserReport.js
0 → 100644
View file @
0d753082
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
}
=
app
.
Sequelize
;
const
CourseUserReport
=
app
.
classModel
.
define
(
'course_user_report'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
user_uuid
:
STRING
,
cat_id
:
INTEGER
,
report_column_detail_ids
:
STRING
,
answer
:
STRING
,
status
:
INTEGER
,
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_user_report'
,
});
return
CourseUserReport
;
};
app/model/class/v5/courseV5Answer.js
View file @
0d753082
...
...
@@ -17,6 +17,7 @@ module.exports = app => {
sub_title
:
STRING
,
selected_icon
:
STRING
,
unselected_icon
:
STRING
,
tag
:
STRING
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
sort
:
INTEGER
,
...
...
app/model/class/v5/courseV5AnswerToFilter.js
View file @
0d753082
...
...
@@ -18,6 +18,7 @@ module.exports = app => {
column
:
STRING
,
column_option
:
INTEGER
,
column_value
:
STRING
,
column_score
:
INTEGER
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
created_time
:
{
...
...
app/model/class/v5/courseV5
Score
.js
→
app/model/class/v5/courseV5
AnswerToReportColumnDetail
.js
View file @
0d753082
...
...
@@ -6,16 +6,14 @@ const moment = require('moment');
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
}
=
app
.
Sequelize
;
const
CourseV5
Column
=
app
.
classModel
.
define
(
'course_v5_column
'
,
{
const
CourseV5
AnswerToReportColumnDetail
=
app
.
classModel
.
define
(
'course_v5_answer_to_report_column_detail
'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
first
:
STRING
,
second
:
STRING
,
column
:
STRING
,
score
:
INTEGER
,
answer_id
:
INTEGER
,
report_column_detail_id
:
INTEGER
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
created_time
:
{
...
...
@@ -36,9 +34,9 @@ module.exports = app => {
},
},
{
timestamps
:
false
,
tableName
:
'course_v5_
column
'
,
tableName
:
'course_v5_
answer_to_report_column_detail
'
,
});
return
CourseV5
Column
;
return
CourseV5
AnswerToReportColumnDetail
;
};
app/model/class/v5/courseV5Question.js
View file @
0d753082
...
...
@@ -13,6 +13,7 @@ module.exports = app => {
autoIncrement
:
true
,
},
cat_id
:
INTEGER
,
age_id
:
INTEGER
,
title
:
STRING
,
style
:
INTEGER
,
type
:
INTEGER
,
...
...
app/model/class/v5/courseV5ReportColumn.js
0 → 100644
View file @
0d753082
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
}
=
app
.
Sequelize
;
const
CourseV5ReportColumn
=
app
.
classModel
.
define
(
'course_v5_report_column'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
cat_id
:
INTEGER
,
title
:
STRING
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
sort
:
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_v5_report_column'
,
});
return
CourseV5ReportColumn
;
};
app/model/class/v5/courseV5ReportColumnDetail.js
0 → 100644
View file @
0d753082
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
}
=
app
.
Sequelize
;
const
CourseV5ReportColumnDetail
=
app
.
classModel
.
define
(
'course_v5_report_column_detail'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
report_column_id
:
INTEGER
,
content
:
STRING
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
number
:
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_v5_report_column_detail'
,
});
return
CourseV5ReportColumnDetail
;
};
app/router/course.js
View file @
0d753082
'use strict'
;
module
.
exports
=
app
=>
{
const
router
=
app
.
router
.
namespace
(
app
.
config
.
projectRootPath
+
'/course'
);
const
loginAuth
=
app
.
middleware
.
loginAuth
({
type
:
'new'
});
// 登录中间件
const
miniAuth
=
app
.
middleware
.
miniAuth
();
// 因为不跟现有的用户中心系统,所以使用单独的登录中间件
router
.
get
(
'third'
,
'/options'
,
'course.option.getOptions'
);
// 筛选项
router
.
post
(
'third'
,
'/address'
,
miniAuth
,
'course.location.getAddress'
);
// 根据经纬度或ip获取地理位置信息
router
.
post
(
'third'
,
'/institutions'
,
miniAuth
,
'course.institution.institutionList'
);
// 机构列表
router
.
get
(
'third'
,
'/institutions'
,
miniAuth
,
'course.institution.institutionList'
);
// 机构列表
router
.
get
(
'third'
,
'/institution/:institution_id/:area_id'
,
miniAuth
,
'course.institution.institutionInfo'
);
// 机构详情
router
.
post
(
'third'
,
'/classes'
,
miniAuth
,
'course.institution.classList'
);
// 课程列表
router
.
get
(
'third'
,
'/classes'
,
miniAuth
,
'course.institution.classList'
);
// 课程列表
router
.
get
(
'third'
,
'/class/:class_id'
,
miniAuth
,
'course.institution.classInfo'
);
// 课程详情
router
.
post
(
'third'
,
'/teachers'
,
miniAuth
,
'course.institution.teacherList'
);
// 老师列表
router
.
get
(
'third'
,
'/teachers'
,
miniAuth
,
'course.institution.teacherList'
);
// 老师详情
router
.
get
(
'third'
,
'/teacher/:teacher_id'
,
miniAuth
,
'course.institution.teacherInfo'
);
// 老师详情
router
.
post
(
'third'
,
'/user/auth'
,
'course.user.auth'
);
// 微信授权登录
router
.
post
(
'third'
,
'/user/register_user'
,
miniAuth
,
'course.user.registerUserInfo'
);
// 授权后注册用户
router
.
get
(
'third'
,
'/user/baby'
,
miniAuth
,
'course.user.getBabyInfo'
);
// 获取baby信息
router
.
post
(
'third'
,
'/user/baby'
,
miniAuth
,
'course.user.saveBabyInfo'
);
// 保存baby信息
router
.
delete
(
'third'
,
'/user/baby'
,
miniAuth
,
'course.user.delBabyInfo'
);
// 删除baby信息
router
.
get
(
'third'
,
'/user/collection/institution'
,
miniAuth
,
'course.user.getCollectInstitutions'
);
// 收藏的机构列表
router
.
post
(
'third'
,
'/user/collection/institution'
,
miniAuth
,
'course.user.collectInstitution'
);
// 收藏机构
router
.
delete
(
'third'
,
'/user/collection/institution'
,
miniAuth
,
'course.user.delCollectInstitution'
);
// 取消收藏机构
router
.
get
(
'third'
,
'/wechat/callbackAction'
,
'course.wechat.check'
);
router
.
post
(
'third'
,
'/wechat/callbackAction'
,
'course.wechat.callbackAction'
);
router
.
post
(
'third'
,
'/wechat/test'
,
'course.wechat.test'
);
// const router = app.router.namespace(app.config.projectRootPath + '/course');
// const loginAuth = app.middleware.loginAuth({ type: 'new' });// 登录中间件
// const miniAuth = app.middleware.miniAuth();// 因为不跟现有的用户中心系统,所以使用单独的登录中间件
// router.get('third', '/options', 'course.option.getOptions');// 筛选项
// router.post('third', '/address', miniAuth, 'course.location.getAddress');// 根据经纬度或ip获取地理位置信息
// router.post('third', '/institutions', miniAuth, 'course.institution.institutionList');// 机构列表
// router.get('third', '/institutions', miniAuth, 'course.institution.institutionList');// 机构列表
// router.get('third', '/institution/:institution_id/:area_id', miniAuth, 'course.institution.institutionInfo');// 机构详情
// router.post('third', '/classes', miniAuth, 'course.institution.classList');// 课程列表
// router.get('third', '/classes', miniAuth, 'course.institution.classList');// 课程列表
// router.get('third', '/class/:class_id', miniAuth, 'course.institution.classInfo');// 课程详情
// router.post('third', '/teachers', miniAuth, 'course.institution.teacherList');// 老师列表
// router.get('third', '/teachers', miniAuth, 'course.institution.teacherList');// 老师详情
// router.get('third', '/teacher/:teacher_id', miniAuth, 'course.institution.teacherInfo');// 老师详情
// router.post('third', '/user/auth', 'course.user.auth');// 微信授权登录
// router.post('third', '/user/register_user', miniAuth, 'course.user.registerUserInfo');// 授权后注册用户
// router.get('third', '/user/baby', miniAuth, 'course.user.getBabyInfo');// 获取baby信息
// router.post('third', '/user/baby', miniAuth, 'course.user.saveBabyInfo');// 保存baby信息
// router.delete('third', '/user/baby', miniAuth, 'course.user.delBabyInfo');// 删除baby信息
// router.get('third', '/user/collection/institution', miniAuth, 'course.user.getCollectInstitutions');// 收藏的机构列表
// router.post('third', '/user/collection/institution', miniAuth, 'course.user.collectInstitution');// 收藏机构
// router.delete('third', '/user/collection/institution', miniAuth, 'course.user.delCollectInstitution');// 取消收藏机构
// router.get('third', '/wechat/callbackAction', 'course.wechat.check');
// router.post('third', '/wechat/callbackAction', 'course.wechat.callbackAction');
// router.post('third', '/wechat/test', 'course.wechat.test');
};
app/router/course_v5.js
View file @
0d753082
...
...
@@ -20,11 +20,12 @@ module.exports = app => {
router
.
get
(
'third'
,
'/class/all'
,
auth
,
'course.v5.institution.getClassList'
);
// 获取课程列表
router
.
get
(
'third'
,
'/class/:class_id'
,
auth
,
'course.v5.institution.getClassInfo'
);
// 获取课程详情
router
.
get
(
'
/
third'
,
'/collection/class/all'
,
auth
,
'course.v5.institution.getCollectionClassList'
);
// 获取收藏课程列表
router
.
post
(
'
/
third'
,
'/collection/class/:class_id'
,
auth
,
'course.v5.institution.collectClass'
);
// 收藏课程
router
.
get
(
'third'
,
'/collection/class/all'
,
auth
,
'course.v5.institution.getCollectionClassList'
);
// 获取收藏课程列表
router
.
post
(
'third'
,
'/collection/class/:class_id'
,
auth
,
'course.v5.institution.collectClass'
);
// 收藏课程
router
.
delete
(
'third'
,
'/collection/class/:class_id'
,
auth
,
'course.v5.institution.delCollectClass'
);
// 取消收藏课程
router
.
get
(
'
/
third'
,
'/article'
,
'course.v5.institution.getArticleByCategory'
);
// 获取科普文章
router
.
get
(
'third'
,
'/article'
,
'course.v5.institution.getArticleByCategory'
);
// 获取科普文章
router
.
get
(
'/third'
,
'/question/all'
,
'course.v5.report.getQuestionList'
);
// 获取问题列表
router
.
get
(
'third'
,
'/question/all'
,
'course.v5.report.getQuestionList'
);
// 获取问题列表
router
.
post
(
'third'
,
'/report'
,
auth
,
'course.v5.report.generateReport'
);
// 生成报告
};
app/service/course/v5/report.js
View file @
0d753082
This diff is collapsed.
Click to expand it.
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