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
449d4871
Commit
449d4871
authored
May 19, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more
parent
14b387c1
Pipeline
#23474
passed with stage
in 3 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
2 deletions
+107
-2
option.js
app/controller/course/v5/option.js
+30
-0
courseV5QRCode.js
app/model/class/v5/courseV5QRCode.js
+41
-0
common.js
app/router/common.js
+1
-1
course_v5.js
app/router/course_v5.js
+4
-1
option.js
app/service/course/v5/option.js
+26
-0
report.js
app/service/course/v5/report.js
+5
-0
No files found.
app/controller/course/v5/option.js
View file @
449d4871
...
...
@@ -100,6 +100,36 @@ class OptionController extends Controller {
const
ret
=
await
service
.
course
.
v5
.
option
.
getQuestionnaire
();
ctx
.
success
(
ret
);
}
// 保存渠道小程序码
async
addUnlimitedCodeByChannel
()
{
const
{
ctx
,
service
}
=
this
;
const
params
=
ctx
.
request
.
body
;
if
(
ctx
.
isEmpty
(
params
)
||
ctx
.
isEmpty
(
params
.
channel
))
{
ctx
.
failed
(
'channel is empty'
);
}
if
(
ctx
.
isEmpty
(
params
)
||
ctx
.
isEmpty
(
params
.
image
))
{
ctx
.
failed
(
'image is empty'
);
}
const
ret
=
await
service
.
course
.
v5
.
option
.
addUnlimitedCodeByChannel
(
params
);
ctx
.
success
(
ret
);
}
// 获取渠道小程序码
async
getUnlimitedCodeByChannel
()
{
const
{
ctx
,
service
}
=
this
;
const
queryParams
=
ctx
.
request
.
query
;
if
(
ctx
.
isEmpty
(
queryParams
)
||
ctx
.
isEmpty
(
queryParams
.
channel
))
{
ctx
.
failed
(
'channel is empty'
);
}
const
ret
=
await
service
.
course
.
v5
.
option
.
getUnlimitedCodeByChannel
(
queryParams
);
ctx
.
success
(
ret
);
}
}
module
.
exports
=
OptionController
;
app/model/class/v5/courseV5QRCode.js
0 → 100644
View file @
449d4871
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
STRING
,
INTEGER
,
DATE
}
=
app
.
Sequelize
;
const
CourseV5QRCode
=
app
.
classModel
.
define
(
'course_v5_qrcode'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
channel
:
STRING
,
image
:
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_v5_qrcode'
,
});
return
CourseV5QRCode
;
};
app/router/common.js
View file @
449d4871
...
...
@@ -4,7 +4,7 @@ module.exports = app => {
const
router
=
app
.
router
.
namespace
(
app
.
config
.
projectRootPath
+
'/common'
);
router
.
get
(
'third_oss_signature'
,
'/oss/signature'
,
'common.oss.signature'
);
// 业务的 oss 签名
router
.
post
(
'third'
,
'/oss/image'
,
app
.
middleware
.
verifyAuth
(),
'common.oss.uploadOss'
);
// 上传图片
router
.
post
(
'third'
,
'/oss/image'
,
app
.
middleware
.
verifyAuth
(
{
is_force
:
1
}
),
'common.oss.uploadOss'
);
// 上传图片
router
.
get
(
'third_test'
,
'/test'
,
'common.test.test'
);
};
app/router/course_v5.js
View file @
449d4871
...
...
@@ -24,7 +24,10 @@ module.exports = app => {
router
.
post
(
'third'
,
'/wechat/callbackAction'
,
'course.v5.wechat.callbackAction'
);
router
.
post
(
'third'
,
'/wechat/test'
,
'course.v5.wechat.test'
);
router
.
post
(
'third'
,
'/questionnaire'
,
auth
({
is_force
:
1
}),
'course.v5.option.addQuestionnaire'
);
// 填写问卷
router
.
get
(
'.third'
,
'/questionnaire'
,
'course.v5.option.getQuestionnaire'
);
// 获取问卷
router
.
get
(
'third'
,
'/questionnaire'
,
'course.v5.option.getQuestionnaire'
);
// 获取问卷
router
.
post
(
'third'
,
'/channel/unlimited_code'
,
'course.v5.option.addUnlimitedCodeByChannel'
);
// 保存渠道小程序码
router
.
get
(
'third'
,
'/channel/unlimited_code'
,
'course.v5.option.getUnlimitedCodeByChannel'
);
// 获取渠道小程序码
router
.
get
(
'third'
,
'/class/all'
,
auth
({
is_force
:
0
}),
'course.v5.institution.getClassList'
);
// 获取课程列表
router
.
get
(
'third'
,
'/class/:class_id'
,
auth
({
is_force
:
0
}),
'course.v5.institution.getClassInfo'
);
// 获取课程详情
...
...
app/service/course/v5/option.js
View file @
449d4871
...
...
@@ -336,6 +336,32 @@ class OptionService extends Service {
return
ret
;
}
// 保存渠道小程序码
async
addUnlimitedCodeByChannel
(
input
)
{
const
{
ctx
}
=
this
;
const
data
=
{
channel
:
input
.
channel
||
''
,
image
:
input
.
image
||
''
,
is_deleted
:
0
,
created_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
};
await
ctx
.
classModel
.
V5
.
CourseV5QRCode
.
update
({
is_deleted
:
1
},
{
where
:
{
channel
:
input
.
channel
}
});
await
ctx
.
classModel
.
V5
.
CourseV5QRCode
.
create
(
data
);
return
{
result
:
true
};
}
// 获取渠道小程序码
async
getUnlimitedCodeByChannel
(
input
)
{
const
{
ctx
}
=
this
;
const
image
=
await
ctx
.
classModel
.
V5
.
CourseV5QRCode
.
findOne
({
where
:
{
channel
:
input
.
channel
,
is_deleted
:
0
}
});
const
result
=
ctx
.
isEmpty
(
image
)
?
''
:
image
.
image
;
return
{
result
};
}
}
module
.
exports
=
OptionService
;
app/service/course/v5/report.js
View file @
449d4871
...
...
@@ -118,10 +118,12 @@ class ReportService extends Service {
const
tags
=
await
this
.
getReportTags
(
userReportInfo
);
const
recommendClassList
=
await
this
.
getRecommendClassListByReport
(
userReportInfo
.
answer
,
userReportInfo
.
user_uuid
,
userReportInfo
.
cat_id
);
const
userQuestionnaire
=
await
ctx
.
classModel
.
V5
.
CourseV5Questionnaire
.
findOne
({
where
:
{
user_id
:
userReportInfo
.
user_uuid
,
cat_id
:
userReportInfo
.
cat_id
}
});
const
ret
=
{
id
:
userReportInfo
.
id
,
category
:
ctx
.
isEmpty
(
category
)
?
{}
:
category
,
has_questionnaire
:
ctx
.
isEmpty
(
userQuestionnaire
)
?
0
:
1
,
tags
,
report
,
user
:
userBabyInfo
,
...
...
@@ -165,9 +167,12 @@ class ReportService extends Service {
const
tags
=
await
this
.
getReportTags
(
userReportInfo
);
const
recommendClassList
=
await
this
.
getRecommendClassListByReport
(
userReportInfo
.
answer
,
userReportInfo
.
user_uuid
,
userReportInfo
.
cat_id
);
const
userQuestionnaire
=
await
ctx
.
classModel
.
V5
.
CourseV5Questionnaire
.
findOne
({
where
:
{
user_id
:
userReportInfo
.
user_uuid
,
cat_id
:
userReportInfo
.
cat_id
}
});
const
ret
=
{
id
:
reportId
,
category
:
ctx
.
isEmpty
(
category
)
?
{}
:
category
,
has_questionnaire
:
ctx
.
isEmpty
(
userQuestionnaire
)
?
0
:
1
,
tags
,
report
,
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