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
Hide 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 {
async
exportAwardsInfoBySearch
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
/******VV */
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
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少activityId`
)
}
...
...
@@ -118,7 +118,7 @@ export default class BaseController {
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
}
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
,
`未填写筛选信息`
)
}
console
.
log
(
...
...
@@ -142,42 +142,42 @@ export default class BaseController {
timeStart
,
timeEnd
,
shipStatus
,
type
,
prizeDataType
)
let
awardslist
=
[]
//导出中奖名单的pagesize和pageNo
let
pageSize0
=
500
let
pageNo
=
1
if
(
total
>
pageSize0
)
{
let
totalPage
=
Math
.
ceil
(
total
/
pageSize0
)
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
pageNo
=
i
let
awardMore
=
await
awardsService
.
getUserPrizeByActivityId
(
activityId
,
pageNo
,
pageSize0
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeDataType
)
awardslist
=
awardslist
.
concat
(
awardMore
)
}
}
else
{
awardslist
=
await
awardsService
.
getUserPrizeByActivityId
(
let
pageSize0
=
500
;
let
pageNo
=
1
;
let
totalPage
=
Math
.
ceil
(
total
/
pageSize0
);
let
result
=
[]
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
pageNo
=
i
result
.
push
(
awardsService
.
getUserPrizeByActivityId
(
activityId
,
pageNo
,
total
,
pageSize0
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeDataType
)
)
)
}
const
res
=
await
Promise
.
all
(
result
);
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
awardslist
.
push
(
res
[
i
])
}
// await Promise.all(result).then(res=>{
// for (let i = 1; i <= totalPage; i++) {
// awardslist.push(res[i])
// }
// })
console
.
log
(
`awardslist:》》》
${
JSON
.
stringify
(
awardslist
)}
《《《`
)
if
(
awardslist
.
length
>
0
)
{
let
xlsxData
=
[
...
...
@@ -214,7 +214,7 @@ export default class BaseController {
v
.
name
||
''
,
v
.
type
==
1
?
'/'
:
v
.
receiveName
||
''
,
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
.
area
?
v
.
area
:
'未填'
,
v
.
type
==
1
?
'/'
:
v
.
addressDetail
?
v
.
addressDetail
:
'未填'
,
...
...
@@ -263,6 +263,7 @@ export default class BaseController {
timeStart
,
timeEnd
,
shipStatus
,
prizeType
:
type
,
prizeDataType
}
=
context
.
data
console
.
log
(
'data>>>>>'
,
context
.
data
)
...
...
@@ -273,7 +274,7 @@ export default class BaseController {
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
}
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
,
`未填写筛选信息`
)
}
console
.
log
(
...
...
@@ -297,6 +298,7 @@ export default class BaseController {
timeStart
,
timeEnd
,
shipStatus
,
type
,
prizeDataType
)
console
.
log
(
'totle========='
,
total
)
...
...
server/duibats/src/service/awards.service.ts
View file @
9fef62dd
...
...
@@ -106,9 +106,11 @@ export default class AwardsService {
timeStart
:
number
,
timeEnd
:
number
,
shipStatus
:
number
,
type
:
number
type
:
number
,
prizeDataType
:
number
)
{
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
''
let
pt
=
prizeDataType
?
{
prizeDataType
:
prizeDataType
}
:
''
let
u
=
userNick
?
{
userNick
:
{
$regex
:
'.*'
+
userNick
+
'.*'
}
}
:
''
let
c
=
timeStart
>
0
&&
timeEnd
>
0
?
{
createTime
:
{
$gt
:
timeStart
,
$lt
:
timeEnd
}
}
:
''
let
s
=
shipStatus
...
...
@@ -119,7 +121,7 @@ export default class AwardsService {
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
:
''
let
t
=
type
?
{
type
:
+
type
}
:
''
let
arr
=
[
p
,
u
,
c
,
s
,
t
]
let
arr
=
[
p
,
u
,
c
,
s
,
t
,
pt
]
arr
=
arr
.
filter
(
i
=>
{
return
i
})
...
...
@@ -160,4 +162,4 @@ export default class AwardsService {
return
0
}
}
}
}
\ No newline at end of file
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