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
9fef62dd
Commit
9fef62dd
authored
Nov 24, 2020
by
zhaofei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
5041c6ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
30 deletions
+34
-30
awards.controller.ts
server/duibats/src/controller/awards.controller.ts
+29
-27
awards.service.ts
server/duibats/src/service/awards.service.ts
+5
-3
No files found.
server/duibats/src/controller/awards.controller.ts
View file @
9fef62dd
...
@@ -110,7 +110,7 @@ export default class BaseController {
...
@@ -110,7 +110,7 @@ export default class BaseController {
async
exportAwardsInfoBySearch
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
async
exportAwardsInfoBySearch
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
/******VV */
/******VV */
let
{
cloud
}
=
context
let
{
cloud
}
=
context
let
{
activityId
,
title
,
prizeId
,
userId
:
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeDataType
}
=
context
.
data
let
{
activityId
,
title
,
prizeId
,
userId
:
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prize
Type
:
type
,
prize
DataType
}
=
context
.
data
if
(
!
activityId
)
{
if
(
!
activityId
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少activityId`
)
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少activityId`
)
}
}
...
@@ -118,7 +118,7 @@ export default class BaseController {
...
@@ -118,7 +118,7 @@ export default class BaseController {
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
}
}
console
.
log
(
'prizeId====='
,
prizeId
)
console
.
log
(
'prizeId====='
,
prizeId
)
if
(
!
prizeId
&&
!
userNick
&&
!
timeStart
&&
!
timeEnd
&&
!
shipStatus
&&
!
prizeDataType
)
{
if
(
!
prizeId
&&
!
userNick
&&
!
timeStart
&&
!
timeEnd
&&
!
shipStatus
&&
!
prizeDataType
&&
!
type
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`未填写筛选信息`
)
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`未填写筛选信息`
)
}
}
console
.
log
(
console
.
log
(
...
@@ -142,17 +142,18 @@ export default class BaseController {
...
@@ -142,17 +142,18 @@ export default class BaseController {
timeStart
,
timeStart
,
timeEnd
,
timeEnd
,
shipStatus
,
shipStatus
,
type
,
prizeDataType
prizeDataType
)
)
let
awardslist
=
[]
let
awardslist
=
[]
//导出中奖名单的pagesize和pageNo
//导出中奖名单的pagesize和pageNo
let
pageSize0
=
500
let
pageSize0
=
500
;
let
pageNo
=
1
let
pageNo
=
1
;
if
(
total
>
pageSize0
)
{
let
totalPage
=
Math
.
ceil
(
total
/
pageSize0
);
let
totalPage
=
Math
.
ceil
(
total
/
pageSize0
)
let
result
=
[]
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
pageNo
=
i
pageNo
=
i
let
awardMore
=
await
awardsService
.
getUserPrizeByActivityId
(
result
.
push
(
awardsService
.
getUserPrizeByActivityId
(
activityId
,
activityId
,
pageNo
,
pageNo
,
pageSize0
,
pageSize0
,
...
@@ -162,22 +163,21 @@ export default class BaseController {
...
@@ -162,22 +163,21 @@ export default class BaseController {
timeEnd
,
timeEnd
,
shipStatus
,
shipStatus
,
prizeDataType
prizeDataType
)
))
awardslist
=
awardslist
.
concat
(
awardMore
)
}
}
}
else
{
awardslist
=
await
awardsService
.
getUserPrizeByActivityId
(
const
res
=
await
Promise
.
all
(
result
);
activityId
,
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
pageNo
,
awardslist
.
push
(
res
[
i
])
total
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeDataType
)
}
}
// await Promise.all(result).then(res=>{
// for (let i = 1; i <= totalPage; i++) {
// awardslist.push(res[i])
// }
// })
console
.
log
(
`awardslist:》》》
${
JSON
.
stringify
(
awardslist
)}
《《《`
)
console
.
log
(
`awardslist:》》》
${
JSON
.
stringify
(
awardslist
)}
《《《`
)
if
(
awardslist
.
length
>
0
)
{
if
(
awardslist
.
length
>
0
)
{
let
xlsxData
=
[
let
xlsxData
=
[
...
@@ -214,7 +214,7 @@ export default class BaseController {
...
@@ -214,7 +214,7 @@ export default class BaseController {
v
.
name
||
''
,
v
.
name
||
''
,
v
.
type
==
1
?
'/'
:
v
.
receiveName
||
''
,
v
.
type
==
1
?
'/'
:
v
.
receiveName
||
''
,
v
.
type
==
1
?
'/'
:
v
.
phone
||
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
phone
||
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
province
?
v
.
province
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
province
?
v
.
province
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
city
?
v
.
city
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
city
?
v
.
city
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
area
?
v
.
area
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
area
?
v
.
area
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
addressDetail
?
v
.
addressDetail
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
addressDetail
?
v
.
addressDetail
:
'未填'
,
...
@@ -263,6 +263,7 @@ export default class BaseController {
...
@@ -263,6 +263,7 @@ export default class BaseController {
timeStart
,
timeStart
,
timeEnd
,
timeEnd
,
shipStatus
,
shipStatus
,
prizeType
:
type
,
prizeDataType
prizeDataType
}
=
context
.
data
}
=
context
.
data
console
.
log
(
'data>>>>>'
,
context
.
data
)
console
.
log
(
'data>>>>>'
,
context
.
data
)
...
@@ -273,7 +274,7 @@ export default class BaseController {
...
@@ -273,7 +274,7 @@ export default class BaseController {
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
}
}
console
.
log
(
'prizeId====='
,
prizeId
)
console
.
log
(
'prizeId====='
,
prizeId
)
if
(
!
prizeId
&&
!
userNick
&&
!
timeStart
&&
!
timeEnd
&&
!
shipStatus
&&
!
prizeDataType
)
{
if
(
!
prizeId
&&
!
userNick
&&
!
timeStart
&&
!
timeEnd
&&
!
shipStatus
&&
!
prizeDataType
&&
!
type
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`未填写筛选信息`
)
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`未填写筛选信息`
)
}
}
console
.
log
(
console
.
log
(
...
@@ -297,6 +298,7 @@ export default class BaseController {
...
@@ -297,6 +298,7 @@ export default class BaseController {
timeStart
,
timeStart
,
timeEnd
,
timeEnd
,
shipStatus
,
shipStatus
,
type
,
prizeDataType
prizeDataType
)
)
console
.
log
(
'totle========='
,
total
)
console
.
log
(
'totle========='
,
total
)
...
...
server/duibats/src/service/awards.service.ts
View file @
9fef62dd
...
@@ -106,9 +106,11 @@ export default class AwardsService {
...
@@ -106,9 +106,11 @@ export default class AwardsService {
timeStart
:
number
,
timeStart
:
number
,
timeEnd
:
number
,
timeEnd
:
number
,
shipStatus
:
number
,
shipStatus
:
number
,
type
:
number
type
:
number
,
prizeDataType
:
number
)
{
)
{
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
''
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
''
let
pt
=
prizeDataType
?
{
prizeDataType
:
prizeDataType
}
:
''
let
u
=
userNick
?
{
userNick
:
{
$regex
:
'.*'
+
userNick
+
'.*'
}
}
:
''
let
u
=
userNick
?
{
userNick
:
{
$regex
:
'.*'
+
userNick
+
'.*'
}
}
:
''
let
c
=
timeStart
>
0
&&
timeEnd
>
0
?
{
createTime
:
{
$gt
:
timeStart
,
$lt
:
timeEnd
}
}
:
''
let
c
=
timeStart
>
0
&&
timeEnd
>
0
?
{
createTime
:
{
$gt
:
timeStart
,
$lt
:
timeEnd
}
}
:
''
let
s
=
shipStatus
let
s
=
shipStatus
...
@@ -119,7 +121,7 @@ export default class AwardsService {
...
@@ -119,7 +121,7 @@ export default class AwardsService {
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
:
''
:
''
let
t
=
type
?
{
type
:
+
type
}
:
''
let
t
=
type
?
{
type
:
+
type
}
:
''
let
arr
=
[
p
,
u
,
c
,
s
,
t
]
let
arr
=
[
p
,
u
,
c
,
s
,
t
,
pt
]
arr
=
arr
.
filter
(
i
=>
{
arr
=
arr
.
filter
(
i
=>
{
return
i
return
i
})
})
...
...
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