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
a8055205
Commit
a8055205
authored
Sep 03, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix niutongshe order
parent
a65e426a
Pipeline
#27888
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
institution.js
app/service/course/v5/institution.js
+3
-3
user.js
app/service/course/v5/user.js
+25
-5
No files found.
app/service/course/v5/institution.js
View file @
a8055205
...
...
@@ -374,7 +374,7 @@ class InstitutionSubService extends Service {
// 订单总数
const
orderCount
=
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
findAll
({
where
:
{
class_id
:
{
$in
:
_
.
uniq
(
R
.
pluck
(
'id'
,
classList
))
},
status
:
1
,
is_deleted
:
0
}
});
const
classOrder
=
_
.
groupBy
(
orderCount
,
'class_id'
);
console
.
log
(
classList
[
0
]);
for
(
const
i
in
classList
)
{
const
classCategoryList
=
[];
if
(
!
ctx
.
isEmpty
(
classToCategory
[
classList
[
i
].
id
]))
{
...
...
@@ -394,7 +394,7 @@ class InstitutionSubService extends Service {
classList
[
i
].
institution_logo
=
ctx
.
isEmpty
(
institutionList
[
classList
[
i
].
institution_id
])
?
''
:
institutionList
[
classList
[
i
].
institution_id
][
0
].
logo
;
classList
[
i
].
pay_count
=
ctx
.
isEmpty
(
classOrder
[
classList
[
i
].
id
])
?
classList
[
i
].
pay_count
:
classList
[
i
].
pay_count
+
classOrder
[
classList
[
i
].
id
].
length
;
}
console
.
log
(
classList
[
0
]);
return
classList
;
}
...
...
@@ -454,7 +454,7 @@ class InstitutionSubService extends Service {
// 先查询机构名称的
const
institutionList
=
await
ctx
.
classModel
.
V5
.
CourseV5Institution
.
findAll
({
where
:
{
name
:
{
$like
:
`%
${
word
}
%`
},
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'name'
],
raw
:
true
});
const
institutionIds
=
R
.
pluck
(
'id'
,
institutionList
);
let
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
({
where
:
{
$or
:
[{
name
:
{
$like
:
`%
${
word
}
%`
}
},
{
institution_id
:
{
$in
:
institutionIds
}
}],
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'name'
,
'logo'
,
'price_type'
,
'mode'
,
'price'
,
'age'
,
'institution_id'
],
order
:
[[
'sort'
,
'asc'
]],
raw
:
true
});
let
classList
=
await
ctx
.
classModel
.
V5
.
CourseV5Class
.
findAll
({
where
:
{
$or
:
[{
name
:
{
$like
:
`%
${
word
}
%`
}
},
{
institution_id
:
{
$in
:
institutionIds
}
}],
status
:
1
,
is_deleted
:
0
},
attributes
:
[
'id'
,
'name'
,
'logo'
,
'price_type'
,
'mode'
,
'price'
,
'age'
,
'institution_id'
,
'pay_count'
],
order
:
[[
'sort'
,
'asc'
]],
raw
:
true
});
classList
=
await
this
.
formatClassList
(
classList
);
const
ret
=
{
...
...
app/service/course/v5/user.js
View file @
a8055205
...
...
@@ -675,6 +675,11 @@ class UserService extends Service {
ctx
.
failed
(
'课程已下线'
);
}
// 牛通社特殊处理
if
(
actInfo
.
institution_id
===
222
)
{
classInfo
.
has_address
=
0
;
}
// 生成订单
const
orderNo
=
'11'
+
moment
().
format
(
'YYYYMMDDHHmmSS'
)
+
await
this
.
getRandomNumber
(
6
);
const
order
=
{
...
...
@@ -687,12 +692,27 @@ class UserService extends Service {
columns
:
'{}'
,
status
:
ctx
.
isEmpty
(
institutionInfo
.
pay_column
)
&&
classInfo
.
has_address
===
0
?
1
:
0
,
};
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
create
(
order
);
// 牛通社特殊处理
if
(
actInfo
.
institution_id
===
222
)
{
classInfo
.
has_address
=
0
;
if
(
order
.
status
===
1
)
{
// 判断是否有兑换码
let
redeem
=
''
;
if
(
actInfo
.
type
===
2
)
{
const
redeemCode
=
await
ctx
.
classModel
.
V5
.
CourseRedeemCode
.
findOne
({
where
:
{
class_id
:
actInfo
.
class_id
,
status
:
1
,
is_used
:
0
,
is_deleted
:
0
},
raw
:
true
});
if
(
ctx
.
isEmpty
(
redeemCode
))
{
ctx
.
failed
(
'兑换码不足'
);
}
await
ctx
.
classModel
.
V5
.
CourseRedeemCode
.
update
({
is_used
:
1
,
user_uuid
:
userUuid
,
used_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
where
:
{
id
:
redeemCode
.
id
}
});
redeem
=
redeemCode
.
code
;
}
else
if
(
actInfo
.
type
===
3
)
{
const
redeemCode
=
await
ctx
.
classModel
.
V5
.
CourseV5InstitutionRedeemCode
.
findOne
({
where
:
{
class_id
:
actInfo
.
class_id
,
status
:
1
,
is_used
:
0
,
is_deleted
:
0
},
raw
:
true
});
if
(
ctx
.
isEmpty
(
redeemCode
))
{
ctx
.
failed
(
'兑换码不足'
);
}
await
ctx
.
classModel
.
V5
.
CourseV5InstitutionRedeemCode
.
update
({
is_used
:
1
,
user_uuid
:
userUuid
,
used_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
where
:
{
id
:
redeemCode
.
id
}
});
redeem
=
redeemCode
.
code
;
}
order
.
redeem
=
redeem
;
}
await
ctx
.
classModel
.
V5
.
CourseUserOrder
.
create
(
order
);
if
(
ctx
.
isEmpty
(
institutionInfo
.
pay_column
)
&&
classInfo
.
has_address
===
0
)
{
await
ctx
.
classModel
.
CourseUserActImage
.
create
({
user_uuid
:
userUuid
,
image_id
:
id
});
...
...
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