Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
qinhaitao
taobao-mini-template
Commits
7511a09c
Commit
7511a09c
authored
Aug 20, 2020
by
汪忙忙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改返回值
parent
1af1d053
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
awards.service.js
v1.0/service/awards.service.js
+5
-6
No files found.
v1.0/service/awards.service.js
View file @
7511a09c
...
...
@@ -14,7 +14,7 @@ class AwardsService extends UserService{
this
.
activityprizedao
=
new
BaseDao
(
context
,
PRIZE_CONFIG_DB_NAME
);
}
// 根据奖品Id扣库存
// 根据奖品Id扣库存
, 扣库存成功返回为1
async
reduceStock
(
_id
)
{
let
result
=
await
this
.
activityprizedao
.
findOne
({
_id
,
deleteStatus
:
ACTIVITY_STATUS
.
NORMAL
});
// 奖品不存在
...
...
@@ -24,15 +24,15 @@ class AwardsService extends UserService{
let
{
switchStock
,
stock
,
useStock
}
=
result
;
// 若不限制库存
if
(
switchStock
===
2
)
{
return
true
;
return
1
;
}
// 若库存不足
if
(
useStock
>=
stock
)
{
return
CODE_TYPES
.
ERROR_NO_STOCK
;
}
try
{
await
this
.
activityprizedao
.
update
(
{
return
await
this
.
activityprizedao
.
update
(
{
_id
,
$where
:
"this.useStock < this.stock"
},
...
...
@@ -42,9 +42,8 @@ class AwardsService extends UserService{
}
}
);
return
true
;
}
catch
(
e
)
{
console
.
log
(
`扣库存
(实物)
失败:`
,
e
);
console
.
log
(
`扣库存失败:`
,
e
);
return
CODE_TYPES
.
SYSTEM_ERROR
;
}
}
...
...
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