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
d19ba81f
Commit
d19ba81f
authored
Aug 06, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pay_columns
parent
957df6fc
Pipeline
#27144
passed with stage
in 10 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
9 deletions
+15
-9
courseUserOrder.js
app/model/class/v5/courseUserOrder.js
+1
-0
courseV5Institution.js
app/model/class/v5/courseV5Institution.js
+1
-0
institution.js
app/service/course/v5/institution.js
+2
-2
user.js
app/service/course/v5/user.js
+11
-7
No files found.
app/model/class/v5/courseUserOrder.js
View file @
d19ba81f
...
@@ -21,6 +21,7 @@ module.exports = app => {
...
@@ -21,6 +21,7 @@ module.exports = app => {
type
:
INTEGER
,
type
:
INTEGER
,
redeem
:
STRING
,
redeem
:
STRING
,
address
:
STRING
,
address
:
STRING
,
columns
:
TEXT
,
status
:
INTEGER
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
is_deleted
:
INTEGER
,
created_time
:
{
created_time
:
{
...
...
app/model/class/v5/courseV5Institution.js
View file @
d19ba81f
...
@@ -17,6 +17,7 @@ module.exports = app => {
...
@@ -17,6 +17,7 @@ module.exports = app => {
logo
:
STRING
,
logo
:
STRING
,
description
:
TEXT
,
description
:
TEXT
,
title
:
STRING
,
title
:
STRING
,
pay_column
:
STRING
,
status
:
INTEGER
,
status
:
INTEGER
,
is_deleted
:
INTEGER
,
is_deleted
:
INTEGER
,
created_time
:
{
created_time
:
{
...
...
app/service/course/v5/institution.js
View file @
d19ba81f
...
@@ -203,11 +203,11 @@ class InstitutionSubService extends Service {
...
@@ -203,11 +203,11 @@ class InstitutionSubService extends Service {
classInfo
.
institution_logo
=
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
logo
;
classInfo
.
institution_logo
=
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
logo
;
classInfo
.
institution_description
=
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
description
;
classInfo
.
institution_description
=
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
description
;
classInfo
.
institution_title
=
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
title
;
classInfo
.
institution_title
=
ctx
.
isEmpty
(
institution
)
?
''
:
institution
.
title
;
classInfo
.
institution_pay_column
=
ctx
.
isEmpty
(
institution
)
||
ctx
.
isEmpty
(
institution
.
pay_column
)
?
[]
:
JSON
.
parse
(
institution
.
pay_column
);
classInfo
.
pay_count
+=
orderCount
;
classInfo
.
pay_count
+=
orderCount
;
classInfo
.
video_count
=
videoCount
;
classInfo
.
video_count
=
videoCount
;
classInfo
.
frequency
=
frequency
;
classInfo
.
frequency
=
frequency
;
classInfo
.
relation
=
relation
;
classInfo
.
relation
=
relation
;
// classInfo.ext = ctx.isEmpty(institution) ? {} : JSON.parse(institution.ext);
return
classInfo
;
return
classInfo
;
}
}
...
@@ -224,7 +224,7 @@ class InstitutionSubService extends Service {
...
@@ -224,7 +224,7 @@ class InstitutionSubService extends Service {
const
userCollection
=
await
ctx
.
classModel
.
V5
.
CourseUserCollection
.
findAndCountAll
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
is_deleted
:
0
,
type
:
3
},
raw
:
true
});
const
userCollection
=
await
ctx
.
classModel
.
V5
.
CourseUserCollection
.
findAndCountAll
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
is_deleted
:
0
,
type
:
3
},
raw
:
true
});
const
collectedIds
=
R
.
pluck
(
'type_id'
,
userCollection
.
rows
);
const
collectedIds
=
R
.
pluck
(
'type_id'
,
userCollection
.
rows
);
const
filter
=
{
where
:
{
id
:
{
$in
:
collectedIds
},
status
:
1
,
is_deleted
:
0
},
limit
:
page_size
,
offset
,
attributes
,
raw
:
true
};
const
filter
=
{
where
:
{
id
:
{
$in
:
collectedIds
},
status
:
1
,
is_deleted
:
0
},
limit
:
page_size
,
offset
,
attributes
,
raw
:
true
};
const
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
(
filter
);
const
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
(
filter
);
·
for
(
const
i
in
classList
)
{
for
(
const
i
in
classList
)
{
classList
[
i
].
price_type
=
await
this
.
getClassPriceType
(
classList
[
i
].
price_type
);
classList
[
i
].
price_type
=
await
this
.
getClassPriceType
(
classList
[
i
].
price_type
);
classList
[
i
].
mode
=
await
this
.
getClassMode
(
classList
[
i
].
mode
);
classList
[
i
].
mode
=
await
this
.
getClassMode
(
classList
[
i
].
mode
);
...
...
app/service/course/v5/user.js
View file @
d19ba81f
...
@@ -362,9 +362,12 @@ class UserService extends Service {
...
@@ -362,9 +362,12 @@ class UserService extends Service {
// 购买课程
// 购买课程
async
buyClass
(
i
d
)
{
async
buyClass
(
i
nput
)
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
userUuid
=
ctx
.
userUuid
;
const
userUuid
=
ctx
.
userUuid
;
const
id
=
input
.
id
||
0
;
const
address
=
input
.
address
||
''
;
const
columns
=
ctx
.
isEmpty
(
input
.
columns
)
?
{}
:
JSON
.
parse
(
input
.
columns
);
if
(
ctx
.
isEmpty
(
userUuid
))
{
if
(
ctx
.
isEmpty
(
userUuid
))
{
ctx
.
failed
(
'用户异常'
);
ctx
.
failed
(
'用户异常'
);
...
@@ -382,11 +385,11 @@ class UserService extends Service {
...
@@ -382,11 +385,11 @@ class UserService extends Service {
ctx
.
failed
(
'课程不存在'
);
ctx
.
failed
(
'课程不存在'
);
}
}
// 获取用户地址
//
//
获取用户地址
const
address
=
await
ctx
.
classModel
.
V5
.
CourseUserAddress
.
findOne
({
where
:
{
user_uuid
:
ctx
.
userUuid
,
is_deleted
:
0
},
attributes
:
[
'province'
,
'city'
,
'area'
,
'address'
,
'name'
,
'phone'
],
raw
:
true
});
//
const address = await ctx.classModel.V5.CourseUserAddress.findOne({ where: { user_uuid: ctx.userUuid, is_deleted: 0 }, attributes: [ 'province', 'city', 'area', 'address', 'name', 'phone' ], raw: true });
if
(
ctx
.
isEmpty
(
address
))
{
//
if (ctx.isEmpty(address)) {
ctx
.
failed
(
'地址不能为空'
);
//
ctx.failed('地址不能为空');
}
//
}
const
orderNo
=
'11'
+
moment
().
format
(
'YYYYMMDDHHMMSS'
)
+
await
this
.
getRandomNumber
(
6
);
const
orderNo
=
'11'
+
moment
().
format
(
'YYYYMMDDHHMMSS'
)
+
await
this
.
getRandomNumber
(
6
);
if
(
ctx
.
isEmpty
(
order
))
{
if
(
ctx
.
isEmpty
(
order
))
{
...
@@ -397,12 +400,13 @@ class UserService extends Service {
...
@@ -397,12 +400,13 @@ class UserService extends Service {
pay
:
classInfo
.
pay_price
,
pay
:
classInfo
.
pay_price
,
type
:
1
,
type
:
1
,
address
:
JSON
.
stringify
(
address
),
address
:
JSON
.
stringify
(
address
),
columns
:
JSON
.
stringify
(
columns
),
};
};
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
create
(
data
);
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
create
(
data
);
order
=
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
findOne
({
where
:
{
user_uuid
:
userUuid
,
class_id
:
id
,
is_deleted
:
0
},
order
:
[[
'id'
,
'asc'
]]
});
order
=
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
findOne
({
where
:
{
user_uuid
:
userUuid
,
class_id
:
id
,
is_deleted
:
0
},
order
:
[[
'id'
,
'asc'
]]
});
}
}
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
update
({
pay
:
classInfo
.
pay_price
,
order_no
:
orderNo
,
type
:
1
,
redeem
:
''
,
address
:
JSON
.
stringify
(
address
),
status
:
0
},
{
where
:
{
id
:
order
.
id
}
});
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
update
({
pay
:
classInfo
.
pay_price
,
order_no
:
orderNo
,
type
:
1
,
redeem
:
''
,
address
:
JSON
.
stringify
(
address
),
columns
:
JSON
.
stringify
(
columns
),
status
:
0
},
{
where
:
{
id
:
order
.
id
}
});
let
response
=
await
this
.
service
.
course
.
v5
.
wechat
.
pay
({
pay
:
order
.
pay
,
order_no
:
orderNo
,
body
:
`趣选课-订单
${
orderNo
}
`
});
let
response
=
await
this
.
service
.
course
.
v5
.
wechat
.
pay
({
pay
:
order
.
pay
,
order_no
:
orderNo
,
body
:
`趣选课-订单
${
orderNo
}
`
});
response
=
await
ctx
.
helper
.
xmlTojson
(
response
);
response
=
await
ctx
.
helper
.
xmlTojson
(
response
);
...
...
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