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
c5a8ab02
Commit
c5a8ab02
authored
Sep 01, 2020
by
李硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
按条件搜索中奖名单和导入物流信息
parent
ceb9aa69
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
775 additions
and
64 deletions
+775
-64
api.js
client/api.js
+4
-0
rank-dialog.acss
client/components/dialog/rank-dialog/rank-dialog.acss
+2
-1
rank-dialog.axml
client/components/dialog/rank-dialog/rank-dialog.axml
+38
-3
rank-dialog.js
client/components/dialog/rank-dialog/rank-dialog.js
+244
-28
rank-dialog.json
client/components/dialog/rank-dialog/rank-dialog.json
+2
-1
ship-dialog.acss
client/components/dialog/ship-dialog/ship-dialog.acss
+29
-0
ship-dialog.axml
client/components/dialog/ship-dialog/ship-dialog.axml
+15
-0
ship-dialog.js
client/components/dialog/ship-dialog/ship-dialog.js
+71
-0
ship-dialog.json
client/components/dialog/ship-dialog/ship-dialog.json
+7
-0
awards.controller.js
server/duiba/controller/awards.controller.js
+265
-25
index.js
server/duiba/index.js
+8
-0
rankopenprize.service.js
server/duiba/service/rankopenprize.service.js
+84
-6
constants.js
server/duiba/utils/constants.js
+6
-0
No files found.
client/api.js
View file @
c5a8ab02
...
...
@@ -32,6 +32,10 @@ const API = {
request
(
"queryBenefitByEname"
,
"POST"
,
params
),
// 复制创建新活动
createCopyActivity
:
(
params
)
=>
request
(
"copyNewActivity"
,
"POST"
,
params
),
//搜索条件查询中奖信息
exportAwardsInfoBySearch
:
(
params
)
=>
request
(
"exportAwardsInfoBySearch"
,
"POST"
,
params
),
findWinnerInfoListBySearch
:
(
params
)
=>
request
(
"findWinnerInfoListBySearch"
,
"POST"
,
params
),
downloadFile
:
(
params
)
=>
request
(
"downloadFile"
,
"POST"
,
params
),
};
export
default
API
;
client/components/dialog/rank-dialog/rank-dialog.acss
View file @
c5a8ab02
.rank-dialog-wrap {
max-height: 400px;
overflow: scroll
}
.other-winner-list {
display: flex;
...
...
client/components/dialog/rank-dialog/rank-dialog.axml
View file @
c5a8ab02
...
...
@@ -14,8 +14,41 @@
title="{{item.tab}}"
key="{{item.key}}"
> -->
<!-- 添加筛选条件导出中奖名单 start -->
<form class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large">
<form-item class="edit-content-formItem" label="奖品编号" labelTextAlign="right" asterisk="{{false}}">
<input data-type="prize" value="{{searchInfo.prizeId}}" onChange="onInputChange" hasLimitHint="true" name="奖品编号" />
</form-item>
<form-item class="edit-content-formItem" label="用户id" labelTextAlign="right" asterisk="{{false}}">
<input data-type="user" value="{{searchInfo.userNick}}" onChange="onInputChange" hasLimitHint="true" name="用户id" />
</form-item>
<form-item class="edit-content-formItem" label="发奖时间" labelTextAlign="right" asterisk="{{false}}">
<range-picker style="width: 300px" onChange="onChangeTime" hasClear="true" value="{{timeRange}}" data-time="{{timeRange}}" class="block" show-time="{{ format: 'HH:mm' }}" />
</form-item>
<form-item class="edit-content-formItem" label="发货状态" labelTextAlign="right">
<select onChange="onSelectShipStatus">
<option value="{{1}}">全部</option>
<option value="{{2}}">未发货</option>
<option value="{{3}}">已发货</option>
</select>
</form-item>
<form-item class="edit-content-formItem" label="奖品类型">
<select onChange="onSelectPrizeType">
<option value="{{1}}">优惠券</option>
<option value="{{3}}">实物</option>
</select>
</form-item>
</form>
<view style="textAlign:right">
<button onTap="onChangeSearch" style="height:32px;" type="primary" size="medium">搜索</button>
<button style="margin-left:20px;height:32px" type="primary" data-type="search" onTap="exportWinnerListBySearch" size="medium">导出</button>
<button style="margin-left:20px;height:32px" type="primary" onTap="onChangeUpLoad" size="medium">导入发货</button>
</view>
<!-- end -->
<view class="now-winner-list">
<button type="primary" onTap="exportWinnerList">导出中奖名单</button>
<button type="primary"
data-type="export"
onTap="exportWinnerList">导出中奖名单</button>
</view>
<table dataSource="{{list}}">
...
...
@@ -23,9 +56,11 @@
</table>
<view class="rank-pagination">
<text class="rank-pagination-text">共{{list.length}}条</text>
<pagination shape="arrow-only" hideOnlyOnePage="true" defaultCurrent="1" current="{{pageInfo.pageNo}}" pageSize="{{pageInfo.pageSize}}" onChange="changePagination" pageShowCount="100" total="{{pageInfo.total}}" />
<!-- <pagination shape="arrow-only" hideOnlyOnePage="true" defaultCurrent="1" current="{{pageInfo.pageNo}}" pageSize="{{pageInfo.pageSize}}" onChange="changePagination" pageShowCount="100" total="{{pageInfo.total}}" /> -->
<pagination showJump="{{false}}" defaultCurrent="{{1}}" data-type="all" pageSize="{{pageSize}}" onChange="onChangePageNo" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
</view>
<!-- </tab-item>
</tab> -->
</view>
</dialog-wrap>
<ship-dialog a:if="{{showShip}}" showShip="{{showShip}}" onClose="onCloseShip" activityId="{{winactivityId}}"></ship-dialog>
\ No newline at end of file
client/components/dialog/rank-dialog/rank-dialog.js
View file @
c5a8ab02
...
...
@@ -2,6 +2,9 @@
import
{
findWinnerInfoList
,
uploadDataCreateFile
,
//通过搜索条件筛选中奖名单
exportAwardsInfoBySearch
,
findWinnerInfoListBySearch
}
from
"/api"
;
import
{
appId
}
from
"/config"
;
import
{
setClipboard
}
from
"/utils"
;
...
...
@@ -12,69 +15,106 @@ Component({
tabs
:
[{
tab
:
'0608-0712'
,
key
:
111
},{
},
{
tab
:
'03308-0712'
,
key
:
43
},{
},
{
tab
:
'064548-0712'
,
key
:
435
},{
},
{
tab
:
'0608-0712'
,
key
:
436545
},{
},
{
tab
:
'0608-0712'
,
key
:
65
},{
},
{
tab
:
'0608-0712'
,
key
:
11561
},{
},
{
tab
:
'0608-0712'
,
key
:
13311
},{
},
{
tab
:
'0608-0712'
,
key
:
145611
},{
},
{
tab
:
'0608-0712'
,
key
:
1178761
}],
dataSource
:
[],
columns
:
[
{
title
:
'排名'
,
prop
:
'rank'
},
{
title
:
'奖品编号'
,
prop
:
'prizeId'
},
//prizeId为awards_info中的_id
{
title
:
'发奖时间'
,
prop
:
'createTime'
},
{
title
:
'填地址时间'
,
prop
:
'receiveTime'
},
{
title
:
'用户昵称'
,
prop
:
'userNick'
},
{
title
:
'奖品类型'
,
prop
:
'typeName'
},
{
title
:
'奖品名称'
,
prop
:
'prizeName'
},
{
title
:
'奖池类型'
,
prop
:
'awardsType'
},
{
title
:
'奖品类型'
,
prop
:
'type'
},
{
title
:
'奖品名'
,
prop
:
'name'
},
{
title
:
'收货人'
,
prop
:
'receiveName'
},
{
title
:
'联系方式'
,
prop
:
'phone'
},
{
title
:
'收货地址'
,
prop
:
'address'
,
width
:
240
}
/*注:需要在接口里将 省+市+区+详细 拼写起来*/
{
title
:
'收货地址'
,
prop
:
'address'
},
//{ title: '收货地址', prop: 'address', width: 240 }
{
title
:
'物流状态'
,
prop
:
'shipStatus'
},
{
title
:
'物流公司'
,
prop
:
'shipCompany'
},
{
title
:
'物流单号'
,
prop
:
'shipNum'
}
],
pageInfo
:
{
// pageInfo: {
// pageNo: 1,
// pageSize: 100,
// total: 0
// },
//《条件搜索》start显示中奖名单搜索条件
list
:
[],
prizeId
:
""
,
userId
:
""
,
startT
:
""
,
endT
:
""
,
shipStatus
:
""
,
timeRange
:
[],
prizeType
:
""
,
showShip
:
false
,
winactivityId
:
""
,
pageNo
:
1
,
pageSize
:
100
,
total
:
0
},
pageSize
:
1
,
total
:
0
,
type
:
""
//end
},
props
:
{
onClose
:
()
=>
{},
onClose
:
()
=>
{
},
list
:
[],
selectedItem
:
{},
},
didMount
()
{},
didUpdate
()
{},
didUnmount
()
{},
didMount
()
{
},
didUpdate
()
{
},
didUnmount
()
{
},
methods
:
{
//start《条件搜索》初始化数据更新
initData
()
{
this
.
setData
({
list
:
[],
prizeId
:
""
,
userId
:
""
,
startT
:
""
,
endT
:
""
,
timeRange
:
[],
shipStatus
:
""
,
prizeType
:
""
})
},
//end
onCloseDialog
()
{
this
.
props
.
onClose
&&
this
.
props
.
onClose
();
},
async
getWinnerList
()
{
const
{
avtivityId
}
=
this
.
props
;
const
{
data
}
=
await
findWinnerInfoList
({
avtivityId
})
});
this
.
setData
({
dataSource
:
data
})
},
onCloseDialog
()
{
this
.
props
.
onClose
&&
this
.
props
.
onClose
();
});
},
// 导出中奖名单
async
exportWinnerList
(
evt
)
{
...
...
@@ -97,7 +137,7 @@ Component({
this
.
setData
({
exportDialogVisible
:
true
,
exportUrl
:
data
.
url
.
replace
(
/amp;/g
,
""
)
})
})
;
}
else
{
my
.
showToast
({
type
:
"fail"
,
...
...
@@ -109,5 +149,181 @@ Component({
console
.
log
(
error
,
"exportList-error"
);
}
},
//《条件搜索》 导出中奖名单
timeExchange
(
time
)
{
console
.
log
(
"time=="
,
time
);
let
a
=
time
?
new
Date
(
time
)
:
""
;
let
times
=
a
?
a
.
getTime
()
:
""
;
return
times
;
},
async
exportWinnerListBySearch
(
evt
)
{
const
{
activityId
,
title
}
=
this
.
props
.
selectedItem
;
let
{
prizeId
,
userId
,
startT
,
endT
,
shipStatus
,
pageNo
,
pageSize
,
prizeType
}
=
this
.
data
;
let
timeStart
=
this
.
timeExchange
(
startT
);
let
timeEnd
=
this
.
timeExchange
(
endT
);
if
(
prizeId
||
userId
||
(
timeStart
&&
timeEnd
)
||
shipStatus
||
prizeType
)
{
try
{
console
.
log
(
"导出名单数据接口"
);
const
{
success
,
data
,
message
}
=
await
exportAwardsInfoBySearch
({
activityId
,
pageNo
,
pageSize
,
title
,
prizeId
,
userId
,
timeStart
,
timeEnd
,
shipStatus
,
prizeType
});
if
(
success
)
{
if
(
!
data
)
{
my
.
showToast
({
type
:
'fail'
,
content
:
'没有符合条件的订单!'
})
}
else
{
console
.
log
(
"导出中奖名单"
);
my
.
setClipboard
({
text
:
data
.
url
.
replace
(
/amp;/g
,
''
),
success
(
res
)
{
my
.
showToast
({
type
:
'success'
,
content
:
'下载链接复制成功,请在浏览器中打开下载'
})
}
});
}
}
else
{
my
.
showToast
({
type
:
'fail'
,
content
:
message
})
}
}
catch
(
error
)
{
my
.
hideLoading
();
console
.
log
(
'exportList-error'
,
error
);
}
}
else
{
my
.
showToast
({
type
:
"fail"
,
content
:
"请填写至少一个筛选信息"
})
}
},
//《条件搜索》导入发货信息
onChangeUpLoad
()
{
const
{
activityId
,
title
}
=
this
.
props
.
selectedItem
;
this
.
setData
({
showShip
:
true
,
winactivityId
:
activityId
})
},
//《条件搜索》关闭导入发货窗口
onCloseShip
()
{
this
.
setData
({
showShip
:
false
,
})
},
//《条件搜索》搜索
async
onChangeSearch
()
{
const
{
activityId
,
title
}
=
this
.
props
.
selectedItem
;
let
{
prizeId
,
userId
,
startT
,
endT
,
pageNo
,
pageSize
,
shipStatus
,
prizeType
}
=
this
.
data
;
let
timeStart
=
this
.
timeExchange
(
startT
);
let
timeEnd
=
this
.
timeExchange
(
endT
);
console
.
log
(
prizeId
,
userId
,
timeStart
,
timeEnd
,
pageNo
,
pageSize
,
shipStatus
,
prizeType
);
if
(
prizeId
||
userId
||
(
timeStart
&&
timeEnd
)
||
shipStatus
===
0
||
shipStatus
||
prizeType
>
0
)
{
let
rewardList
=
await
findWinnerInfoListBySearch
({
activityId
,
pageNo
,
pageSize
,
title
,
prizeId
,
userId
,
timeStart
,
timeEnd
,
shipStatus
,
prizeType
});
if
(
rewardList
.
data
.
list
.
length
==
0
)
{
this
.
setData
({
list
:
[],
total
:
0
});
0
my
.
showToast
({
type
:
"fail"
,
content
:
"没有符合条件的订单!"
})
}
else
{
console
.
log
(
"rewardList=="
,
rewardList
);
//时间戳的转换都去到服务端做
/*
rewardList.data.list.forEach((item) => {
item.createTime = moment(+item.createTime).format("YYYY-MM-DD HH:mm:ss");
item.receiveTime = !!item.receiveTime ? moment(+item.receiveTime).format("YYYY-MM-DD HH:mm:ss") : '/';
});
*/
this
.
setData
({
list
:
rewardList
.
data
.
list
,
total
:
rewardList
.
data
.
total
});
}
}
else
{
my
.
showToast
({
type
:
"fail"
,
content
:
"请填写至少一个筛选信息"
})
}
},
//《条件搜索》按照时间搜索
onChangeTime
(
e
)
{
console
.
log
(
"时间搜索e"
,
e
);
const
[
startTime
,
endTime
]
=
e
.
detail
.
value
;
this
.
setData
({
startT
:
startTime
||
""
,
endT
:
endTime
||
""
,
timeRange
:
[
startTime
,
endTime
],
pageNo
:
1
,
pageSize
:
10
,
total
:
0
,
});
console
.
log
(
"this.data.timeRange=="
,
this
.
data
.
timeRange
,
this
.
data
.
startT
,
this
.
data
.
endT
);
},
//《条件搜索》输入框查找信息
onInputChange
(
e
)
{
let
{
type
}
=
e
.
currentTarget
.
dataset
;
let
{
value
}
=
e
.
detail
;
this
.
setData
({
[
type
+
"Id"
]:
value
,
pageNo
:
1
,
pageSize
:
10
,
total
:
0
,
})
console
.
log
(
"this.data.prizeId==="
,
this
.
data
.
prizeId
,
"this.data.userId==="
,
this
.
data
.
userId
);
},
//《条件搜索》发货状态筛选
onSelectShipStatus
(
e
)
{
console
.
log
(
'筛选发货状态e>>>'
,
e
);
this
.
setData
({
shipStatus
:
e
.
detail
.
value
,
pageNo
:
1
,
pageSize
:
10
,
total
:
0
,
})
},
//《条件搜索》奖品类型筛选
onSelectPrizeType
(
e
)
{
console
.
log
(
'筛选奖品类型e>>>'
,
e
);
this
.
setData
({
prizeType
:
e
.
detail
.
value
,
pageNo
:
1
,
pageSize
:
10
,
total
:
0
,
});
console
.
log
(
"type"
,
this
.
data
.
prizeType
);
},
//《条件搜索》更换页码时调用接口
onChangePageNo
(
e
)
{
this
.
setData
({
pageNo
:
e
.
detail
.
value
})
this
.
onChangeSearch
();
}
},
});
client/components/dialog/rank-dialog/rank-dialog.json
View file @
c5a8ab02
{
"component"
:
true
,
"usingComponents"
:
{
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
,
"ship-dialog"
:
"../../dialog/ship-dialog/ship-dialog"
}
}
\ No newline at end of file
client/components/dialog/ship-dialog/ship-dialog.acss
0 → 100644
View file @
c5a8ab02
.edit-content-shipDialog1 {
background: white;
width: 100%;
height: 200px;
/* margin-left: 80px; */
margin-top: 100px;
}
.edit-content-titleLoad {
font-size: 25px;
font: bold;
text-align: center;
margin-top: 20px;
}
.edit-content-shipDialog {
width: 340px;
margin-left: 76px;
margin-top: 40px;
}
.edit-content-buttons {
width: 200px;
margin-left: 300px;
}
.edit-content-buttonShip {
margin-left: 5px
}
\ No newline at end of file
client/components/dialog/ship-dialog/ship-dialog.axml
0 → 100644
View file @
c5a8ab02
<dialog-wrap title="批量发货" visible="{{showShip}}" onClose="closeShip">
<view class="edit-content-shipDialog1">
<form-item class="edit-content-shipDialog" label="上传附件:" style="display:flex">
<input placeholder="Input" style="80px" value="{{fileName}}" onChange="onChangeInput"/>
</form-item>
<view class="edit-content-buttons">
<button class="edit-content-buttonShip" type="primary" onTap="closeShip">
取消
</button>
<button class="edit-content-buttonShip" type="primary" onTap="onChangeLoadFile">
确认发货
</button>
</view>
</view>
</dialog-wrap>
\ No newline at end of file
client/components/dialog/ship-dialog/ship-dialog.js
0 → 100644
View file @
c5a8ab02
import
{
downloadFile
}
from
"../../../api"
;
// import { upLoadFileApi } from "../../utils/my-api";
Component
({
data
:
{
fileName
:
""
},
props
:
{
activityId
:
""
,
onClose
:
()
=>
{
}
},
didMount
()
{
console
.
log
(
">>>>>>activityId"
,
this
.
props
.
activityId
);
},
didUpdate
()
{
},
didUnmount
()
{
},
methods
:
{
//LS20200716关闭弹窗
closeShip
()
{
this
.
props
.
onClose
();
this
.
setData
({
fileName
:
""
})
console
.
log
(
"ship-dialog====showShip"
);
},
closeDialog
()
{
this
.
setData
({})
},
//20200717确认发货
//20200717
async
onChangeLoadFile
()
{
let
{
fileName
}
=
this
.
data
;
let
{
activityId
}
=
this
.
props
;
console
.
log
(
"fileName=="
,
fileName
,
"activityId==="
,
activityId
);
let
result
=
await
downloadFile
({
activityId
,
fileName
});
console
.
log
(
"-----**"
,
result
);
if
(
result
.
success
)
{
if
(
result
.
data
.
total
==
0
)
{
my
.
showToast
({
type
:
"fail"
,
content
:
`无用户填写地址,导入信息错误`
,
});
}
else
{
my
.
showToast
({
type
:
"success"
,
content
:
`成功导入
${
JSON
.
stringify
(
result
.
data
.
total
)}
条发货信息!`
,
});
}
}
else
{
my
.
showToast
({
type
:
"fail"
,
content
:
result
.
message
});
}
},
//输入框变化
onChangeInput
(
e
)
{
console
.
log
(
"输入框变化"
,
e
);
let
{
fileName
}
=
this
.
data
;
this
.
setData
({
fileName
:
e
.
detail
.
value
})
console
.
log
(
"===="
,
fileName
);
}
}
})
client/components/dialog/ship-dialog/ship-dialog.json
0 → 100644
View file @
c5a8ab02
{
"component"
:
true
,
"usingComponents"
:
{
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
}
}
\ No newline at end of file
server/duiba/controller/awards.controller.js
View file @
c5a8ab02
This diff is collapsed.
Click to expand it.
server/duiba/index.js
View file @
c5a8ab02
...
...
@@ -3,6 +3,10 @@ const { endingNotify } = require("./controller/endingNodify.controller");
const
{
findWinnerInfoList
,
exportAwardsList
,
//搜索条件导出中奖名单
findWinnerInfoListBySearch
,
exportAwardsInfoBySearch
,
downloadFile
}
=
require
(
"./controller/awards.controller"
);
const
{
getActivityListByOpenId
,
...
...
@@ -18,6 +22,10 @@ const {
getBenefitByEname
,
}
=
require
(
"./controller/activitygettbitem.controller"
);
//搜索条件导出中奖名单
exports
.
findWinnerInfoListBySearch
=
findWinnerInfoListBySearch
;
exports
.
exportAwardsInfoBySearch
=
exportAwardsInfoBySearch
;
exports
.
downloadFile
=
downloadFile
;
// 定时开奖
exports
.
endingNotify
=
endingNotify
;
// 活动中奖名单
...
...
server/duiba/service/rankopenprize.service.js
View file @
c5a8ab02
// 排行榜开奖记录
const
BaseDao
=
require
(
"../dao/base.dao"
);
const
{
DRAW_STATUS
}
=
require
(
"../utils/constants"
);
const
{
DRAW_STATUS
,
SHIP_STATUS
}
=
require
(
"../utils/constants"
);
const
{
USER_PRIZE
}
=
require
(
"../config/db_config"
);
const
DBName
=
USER_PRIZE
;
class
RankopenprizeService
{
...
...
@@ -28,11 +27,11 @@ class RankopenprizeService {
}
// 根据活动id查找中奖名单
async
getAwardslistByActivityId
(
activityId
,
pageNo
,
pageSize
)
{
async
getAwardslistByActivityId
(
activityId
)
{
if
(
!
activityId
)
{
return
false
;
}
let
result
=
await
this
.
rankopenprizeDao
.
find
(
return
await
this
.
rankopenprizeDao
.
find
(
{
activityId
:
activityId
,
},
...
...
@@ -41,12 +40,91 @@ class RankopenprizeService {
score
:
-
1
,
rankTime
:
-
1
,
},
}
);
}
//《条件搜索》查询中奖信息
async
getUserPrizeByActivityId
(
activityId
,
pageNo
,
pageSize
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
type
)
{
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
''
;
let
u
=
userNick
?
{
userNick
:
{
$regex
:
".*"
+
userNick
+
".*"
}
}
:
''
;
let
c
=
(
timeStart
>
0
&&
timeEnd
>
0
)
?
{
createTime
:
{
$gt
:
timeStart
,
$lt
:
timeEnd
}
}
:
''
;
let
s
=
shipStatus
?
(
shipStatus
==
1
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
,
SHIP_STATUS
.
HAS_SHIP
]
}
}
:
(
shipStatus
==
2
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
]
}
}
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
)
)
:
''
;
let
t
=
type
?
{
type
:
+
type
}
:
''
;
let
arr
=
[
p
,
u
,
c
,
s
,
t
];
arr
=
arr
.
filter
((
i
)
=>
{
return
i
});
console
.
log
(
'arr--222---'
,
arr
);
return
await
this
.
rankopenprizeDao
.
find
(
{
activityId
,
$and
:
arr
},
{
limit
:
pageSize
,
skip
:
(
pageNo
-
1
)
*
pageSize
,
}
);
}
//《条件搜索》获取中奖名单长度
async
getTotalObjectCount
(
activityId
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
type
)
{
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
''
;
let
u
=
userNick
?
{
userNick
:
{
$regex
:
".*"
+
userNick
+
".*"
}
}
:
''
;
let
c
=
(
timeStart
>
0
&&
timeEnd
>
0
)
?
{
createTime
:
{
$gt
:
timeStart
,
$lt
:
timeEnd
}
}
:
''
;
let
s
=
shipStatus
?
(
shipStatus
==
1
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
,
SHIP_STATUS
.
HAS_SHIP
]
}
}
:
(
shipStatus
==
2
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
]
}
}
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
)
)
:
''
;
let
t
=
type
?
{
type
:
+
type
}
:
''
let
arr
=
[
p
,
u
,
c
,
s
,
t
];
arr
=
arr
.
filter
((
i
)
=>
{
return
i
});
console
.
log
(
'arr--111---'
,
arr
,
"s>>>"
,
s
);
return
await
this
.
rankopenprizeDao
.
count
({
activityId
,
$and
:
arr
});
}
return
result
//《条件搜索》导入发货状态
async
setUserShipStatus
(
activityId
,
prizeId
,
shipCompany
,
shipNum
)
{
prizeId
=
prizeId
?
prizeId
:
"/"
;
shipCompany
=
shipCompany
?
shipCompany
:
''
;
shipNum
=
shipNum
!==
null
?
shipNum
:
''
let
status
=
0
;
if
(
shipCompany
&&
shipNum
)
{
status
=
SHIP_STATUS
.
HAS_SHIP
;
}
else
{
status
=
SHIP_STATUS
.
NO_SHIP
;
}
if
(
status
==
SHIP_STATUS
.
HAS_SHIP
)
{
return
await
this
.
rankopenprizeDao
.
update
({
activityId
,
_id
:
prizeId
,
shipStatus
:
SHIP_STATUS
.
NO_SHIP
},
{
$set
:
{
shipCompany
,
shipNum
,
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
})
}
else
{
return
0
;
}
}
}
...
...
server/duiba/utils/constants.js
View file @
c5a8ab02
...
...
@@ -32,6 +32,12 @@ const LOGGER_TYPE = {
ERROR
:
1
,
INFO
:
2
,
};
//物流状态
const
SHIP_STATUS
=
{
NO_ADDRESS
:
1
,
NO_SHIP
:
2
,
HAS_SHIP
:
3
}
const
PRIZE_TYPE
=
{
EQUITY
:
1
,
...
...
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