Commit ca74ea39 authored by 李硕's avatar 李硕

无筛选信息展示中奖名单和筛选信息展示中奖名单

parent 89c9e65d
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
key="{{item.key}}" key="{{item.key}}"
> --> > -->
<!-- 添加筛选条件导出中奖名单 start --> <!-- 添加筛选条件导出中奖名单 start -->
<form class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large"> <form a:if="{{isSearch}}" class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large">
<form-item class="edit-content-formItem" label="奖品编号" labelTextAlign="right" asterisk="{{false}}"> <form-item class="edit-content-formItem" label="奖品编号" labelTextAlign="right" asterisk="{{false}}">
<input data-type="prize" value="{{searchInfo.prizeId}}" onChange="onInputChange" hasLimitHint="true" name="奖品编号" /> <input data-type="prize" value="{{searchInfo.prizeId}}" onChange="onInputChange" hasLimitHint="true" name="奖品编号" />
</form-item> </form-item>
...@@ -40,17 +40,15 @@ ...@@ -40,17 +40,15 @@
</form-item> </form-item>
</form> </form>
<view style="textAlign:right"> <view a:if="{{isSearch}}" style="textAlign:right">
<button onTap="onChangeSearch" style="height:32px;" type="primary" size="medium">搜索</button> <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" data-type="search" onTap="exportWinnerListBySearch" size="medium">导出</button>
<button style="margin-left:20px;height:32px" type="primary" onTap="onChangeUpLoad" size="medium">导入发货</button> <button style="margin-left:20px;height:32px" type="primary" onTap="onChangeUpLoad" size="medium">导入发货</button>
</view> </view>
<!-- end --> <!-- end -->
<view a:if="{{!isSearch}}" class="now-winner-list">
<view class="now-winner-list">
<button type="primary" data-type="export" onTap="exportWinnerList">导出中奖名单</button> <button type="primary" data-type="export" onTap="exportWinnerList">导出中奖名单</button>
</view> </view>
<table dataSource="{{list}}"> <table dataSource="{{list}}">
<table-column a:for="{{columns}}" a:key="*this" title="{{item.title}}" dataIndex="{{item.prop}}" width="{{item.width}}"/> <table-column a:for="{{columns}}" a:key="*this" title="{{item.title}}" dataIndex="{{item.prop}}" width="{{item.width}}"/>
</table> </table>
......
...@@ -2,16 +2,21 @@ ...@@ -2,16 +2,21 @@
import { import {
findWinnerInfoList, findWinnerInfoList,
uploadDataCreateFile, uploadDataCreateFile,
//通过搜索条件筛选中奖名单 // 通过搜索条件筛选中奖名单
exportAwardsInfoBySearch, exportAwardsInfoBySearch,
findWinnerInfoListBySearch findWinnerInfoListBySearch
} from "/api"; } from "/api";
import { appId } from "/config"; import { appId } from "/config";
import { setClipboard } from "/utils"; import { setClipboard } from "/utils";
//每页的展示数量
const PageInfo = {
PAGE_SIZE: 30,
PAGE_NO: 1
}
Component({ Component({
mixins: [], mixins: [],
data: { data: {
PageInfo,
tabs: [{ tabs: [{
tab: '0608-0712', tab: '0608-0712',
key: 111 key: 111
...@@ -43,7 +48,7 @@ Component({ ...@@ -43,7 +48,7 @@ Component({
dataSource: [], dataSource: [],
columns: [ columns: [
{ title: '排名', prop: 'rank' }, { title: '排名', prop: 'rank' },
{ title: '奖品编号', prop: 'prizeId' },//prizeId为awards_info中的_id { title: '奖品编号', prop: 'prizeId' },// prizeId为awards_info中的_id
{ title: '发奖时间', prop: 'createTime' }, { title: '发奖时间', prop: 'createTime' },
{ title: '填地址时间', prop: 'receiveTime' }, { title: '填地址时间', prop: 'receiveTime' },
{ title: '用户昵称', prop: 'userNick' }, { title: '用户昵称', prop: 'userNick' },
...@@ -52,13 +57,18 @@ Component({ ...@@ -52,13 +57,18 @@ Component({
{ title: '奖品名', prop: 'name' }, { title: '奖品名', prop: 'name' },
{ title: '收货人', prop: 'receiveName' }, { title: '收货人', prop: 'receiveName' },
{ title: '联系方式', prop: 'phone' }, { title: '联系方式', prop: 'phone' },
/*注:需要在接口里将 省+市+区+详细 拼写起来*/ /* 注:需要在接口里将 省+市+区+详细 拼写起来*/
{ title: '收货地址', prop: 'address' },//{ title: '收货地址', prop: 'address', width: 240 } { title: '收货地址', prop: 'address' },// { title: '收货地址', prop: 'address', width: 240 }
{ title: '物流状态', prop: 'shipStatus' }, { title: '物流状态', prop: 'shipStatus' },
{ title: '物流公司', prop: 'shipCompany' }, { title: '物流公司', prop: 'shipCompany' },
{ title: '物流单号', prop: 'shipNum' } { title: '物流单号', prop: 'shipNum' }
], ],
//《条件搜索》start显示中奖名单搜索条件 // pageInfo: {
// pageNo: 1,
// pageSize: 100,
// total: 0
// },
// 《条件搜索》start显示中奖名单搜索条件
list: [], list: [],
prizeId: "", prizeId: "",
userId: "", userId: "",
...@@ -69,21 +79,27 @@ Component({ ...@@ -69,21 +79,27 @@ Component({
prizeType: "", prizeType: "",
showShip: false, showShip: false,
winactivityId: "", winactivityId: "",
pageNo: 1, pageNo: PageInfo.PAGE_NO,
pageSize: 1, pageSize: PageInfo.PAGE_SIZE,
total: 0, total: 0,
//end // end
//需要筛选查询时改为true
isSearch: false
}, },
props: { props: {
onClose: () => { }, onClose: () => { },
selectedItem: {}, selectedItem: {},
}, },
didMount() { }, didMount() {
if (!this.data.isSearch) {
this.loadWinnerList();
}
},
didUpdate() { }, didUpdate() { },
didUnmount() { }, didUnmount() { },
methods: { methods: {
//start《条件搜索》初始化数据更新 // start《条件搜索》初始化数据更新
initData() { initData() {
this.setData({ this.setData({
list: [], list: [],
...@@ -94,12 +110,26 @@ Component({ ...@@ -94,12 +110,26 @@ Component({
timeRange: [], timeRange: [],
shipStatus: "", shipStatus: "",
prizeType: "", prizeType: "",
pageNo: 1, pageNo: PageInfo.PAGE_NO,
pageSize: 1, pageSize: PageInfo.PAGE_SIZE,
total: 0, total: 0,
}) });
}, },
//end //加载中奖名单
async loadWinnerList() {
let { pageNo, pageSize } = this.data;
let { activityId } = this.props.selectedItem;
const { data, success } = await findWinnerInfoList({ activityId, pageNo, pageSize });
console.log('data>>>>>', data);
if (success) {
this.setData({
list: data.list,
total: data.total
});
}
},
// end
onCloseDialog() { onCloseDialog() {
this.initData(); this.initData();
this.props.onClose && this.props.onClose(); this.props.onClose && this.props.onClose();
...@@ -147,7 +177,7 @@ Component({ ...@@ -147,7 +177,7 @@ Component({
} }
}, },
//《条件搜索》 导出中奖名单 // 《条件搜索》 导出中奖名单
timeExchange(time) { timeExchange(time) {
console.log("time==", time); console.log("time==", time);
...@@ -179,7 +209,7 @@ Component({ ...@@ -179,7 +209,7 @@ Component({
my.showToast({ my.showToast({
type: 'fail', type: 'fail',
content: '没有符合条件的订单!' content: '没有符合条件的订单!'
}) });
} }
else { else {
console.log("导出中奖名单"); console.log("导出中奖名单");
...@@ -189,7 +219,7 @@ Component({ ...@@ -189,7 +219,7 @@ Component({
my.showToast({ my.showToast({
type: 'success', type: 'success',
content: '下载链接复制成功,请在浏览器中打开下载' content: '下载链接复制成功,请在浏览器中打开下载'
}) });
} }
}); });
} }
...@@ -197,7 +227,7 @@ Component({ ...@@ -197,7 +227,7 @@ Component({
my.showToast({ my.showToast({
type: 'fail', type: 'fail',
content: message content: message
}) });
} }
} catch (error) { } catch (error) {
my.hideLoading(); my.hideLoading();
...@@ -208,26 +238,25 @@ Component({ ...@@ -208,26 +238,25 @@ Component({
my.showToast({ my.showToast({
type: "fail", type: "fail",
content: "请填写至少一个筛选信息" content: "请填写至少一个筛选信息"
}) });
} }
}, },
// 《条件搜索》导入发货信息
//《条件搜索》导入发货信息
onChangeUpLoad() { onChangeUpLoad() {
const { activityId, title } = this.props.selectedItem; const { activityId, title } = this.props.selectedItem;
this.setData({ this.setData({
showShip: true, showShip: true,
winactivityId: activityId winactivityId: activityId
}) });
}, },
//《条件搜索》关闭导入发货窗口 // 《条件搜索》关闭导入发货窗口
onCloseShip() { onCloseShip() {
this.setData({ this.setData({
showShip: false, showShip: false,
}) });
}, },
//《条件搜索》搜索 // 《条件搜索》搜索
async onChangeSearch() { async onChangeSearch() {
const { activityId, title } = this.props.selectedItem; const { activityId, title } = this.props.selectedItem;
let { prizeId, userId, startT, endT, pageNo, pageSize, shipStatus, prizeType } = this.data; let { prizeId, userId, startT, endT, pageNo, pageSize, shipStatus, prizeType } = this.data;
...@@ -240,20 +269,13 @@ Component({ ...@@ -240,20 +269,13 @@ Component({
this.setData({ this.setData({
list: [], list: [],
total: 0 total: 0
}); 0 }); 0;
my.showToast({ my.showToast({
type: "fail", type: "fail",
content: "没有符合条件的订单!" content: "没有符合条件的订单!"
}) });
} else { } else {
console.log("rewardList==", rewardList); 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({ this.setData({
list: rewardList.data.list, list: rewardList.data.list,
total: rewardList.data.total total: rewardList.data.total
...@@ -264,10 +286,10 @@ Component({ ...@@ -264,10 +286,10 @@ Component({
my.showToast({ my.showToast({
type: "fail", type: "fail",
content: "请填写至少一个筛选信息" content: "请填写至少一个筛选信息"
}) });
} }
}, },
//《条件搜索》按照时间搜索 // 《条件搜索》按照时间搜索
onChangeTime(e) { onChangeTime(e) {
console.log("时间搜索e", e); console.log("时间搜索e", e);
const [startTime, endTime] = e.detail.value; const [startTime, endTime] = e.detail.value;
...@@ -275,52 +297,55 @@ Component({ ...@@ -275,52 +297,55 @@ Component({
startT: startTime || "", startT: startTime || "",
endT: endTime || "", endT: endTime || "",
timeRange: [startTime, endTime], timeRange: [startTime, endTime],
pageNo: 1, pageNo: PageInfo.PAGE_NO,
pageSize: 10, pageSize: PageInfo.PAGE_SIZE,
total: 0, total: 0,
}); });
console.log("this.data.timeRange==", this.data.timeRange, this.data.startT, this.data.endT); console.log("this.data.timeRange==", this.data.timeRange, this.data.startT, this.data.endT);
}, },
//《条件搜索》输入框查找信息 // 《条件搜索》输入框查找信息
onInputChange(e) { onInputChange(e) {
let { type } = e.currentTarget.dataset; let { type } = e.currentTarget.dataset;
let { value } = e.detail; let { value } = e.detail;
this.setData({ this.setData({
[type + "Id"]: value, [type + "Id"]: value,
pageNo: 1, pageNo: PageInfo.PAGE_NO,
pageSize: 10, pageSize: PageInfo.PAGE_SIZE,
total: 0, total: 0,
}) });
console.log("this.data.prizeId===", this.data.prizeId, "this.data.userId===", this.data.userId); console.log("this.data.prizeId===", this.data.prizeId, "this.data.userId===", this.data.userId);
}, },
//《条件搜索》发货状态筛选 // 《条件搜索》发货状态筛选
onSelectShipStatus(e) { onSelectShipStatus(e) {
console.log('筛选发货状态e>>>', e); console.log('筛选发货状态e>>>', e);
this.setData({ this.setData({
shipStatus: e.detail.value, shipStatus: e.detail.value,
pageNo: 1, pageNo: PageInfo.PAGE_NO,
pageSize: 10, pageSize: PageInfo.PAGE_SIZE,
total: 0, total: 0,
}) });
}, },
//《条件搜索》奖品类型筛选 // 《条件搜索》奖品类型筛选
onSelectPrizeType(e) { onSelectPrizeType(e) {
console.log('筛选奖品类型e>>>', e); console.log('筛选奖品类型e>>>', e);
this.setData({ this.setData({
prizeType: e.detail.value, prizeType: e.detail.value,
pageNo: 1, pageNo: PageInfo.PAGE_NO,
pageSize: 10, pageSize: PageInfo.PAGE_SIZE,
total: 0, total: 0,
}); });
console.log("type", this.data.prizeType); console.log("type", this.data.prizeType);
}, },
//《条件搜索》更换页码时调用接口 // 《条件搜索》更换页码时调用接口
onChangePageNo(e) { onChangePageNo(e) {
this.setData({ this.setData({
pageNo: e.detail.value pageNo: e.detail.value
}) });
this.onChangeSearch(); if (this.data.isSearch) {
this.onChangeSearch();
} else {
this.loadWinnerList();
}
} }
}, },
}); });
...@@ -39,4 +39,4 @@ ...@@ -39,4 +39,4 @@
/> />
<rank-dialog visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" list="{{winnerList}}" selectedItem="{{selectedItem}}"/> <rank-dialog a:if="{{winnerListDialogVisible}}" visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" selectedItem="{{selectedItem}}"/>
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,6 @@ import { ...@@ -10,7 +10,6 @@ import {
import { appId } from "/config"; import { appId } from "/config";
import { setClipboard } from "/utils"; import { setClipboard } from "/utils";
Component({ Component({
data: { data: {
isLoadingList: false, isLoadingList: false,
...@@ -28,7 +27,6 @@ Component({ ...@@ -28,7 +27,6 @@ Component({
}, },
deleteId: "", deleteId: "",
winnerListDialogVisible: false, winnerListDialogVisible: false,
winnerList: [],
selectedItem: {} selectedItem: {}
}, },
props: { props: {
...@@ -38,7 +36,7 @@ Component({ ...@@ -38,7 +36,7 @@ Component({
this.getList(); this.getList();
}, },
methods: { methods: {
/** /**
*获取活动列表 *获取活动列表
* *
* @param {number} [currentPage=1] 页数 * @param {number} [currentPage=1] 页数
...@@ -90,33 +88,22 @@ Component({ ...@@ -90,33 +88,22 @@ Component({
} }
}, },
// 获取中奖名单 // 获取中奖名单
async handleOpenWinnerList(evt) { handleOpenWinnerList(evt) {
const { activityId } = evt.target.dataset.x.record; this.setData({
const { data,success } = await findWinnerInfoList({ activityId }); winnerListDialogVisible: true,
selectedItem: evt.target.dataset.x.record
if (success) { });
this.setData({
winnerListDialogVisible: true,
winnerList: data.map(v => {
return {
...v,
typeName: v.type == 1 ? '优惠券': '实物'
}
}),
selectedItem: evt.target.dataset.x.record
})
}
}, },
onCloseWinnerListDialog() { onCloseWinnerListDialog() {
this.setData({ this.setData({
winnerListDialogVisible: false winnerListDialogVisible: false
}) });
}, },
// 复制链接 // 复制链接
async onCopyLink(evt) { async onCopyLink(evt) {
const { activityId } = evt.target.dataset.x.record; const { activityId } = evt.target.dataset.x.record;
let text = `https://m.duanqu.com/?_ariver_appid=${appId}?query=activityId%3D${activityId}` let text = `https://m.duanqu.com/?_ariver_appid=${appId}?query=activityId%3D${activityId}`;
try { try {
await setClipboard({ await setClipboard({
text text
...@@ -132,9 +119,9 @@ Component({ ...@@ -132,9 +119,9 @@ Component({
onCloseExportDialog() { onCloseExportDialog() {
this.setData({ this.setData({
exportDialogVisible: false exportDialogVisible: false
}) });
}, },
//复制新活动 // 复制新活动
async onCreateNewActivity(evt) { async onCreateNewActivity(evt) {
const { activityId } = evt.target.dataset.x.record; const { activityId } = evt.target.dataset.x.record;
let res = await createCopyActivity({ activityId }); let res = await createCopyActivity({ activityId });
...@@ -151,10 +138,10 @@ Component({ ...@@ -151,10 +138,10 @@ Component({
const { activityId } = evt.target.dataset.x.record; const { activityId } = evt.target.dataset.x.record;
this.$page.$router.push(`/activity/data/${activityId}`); this.$page.$router.push(`/activity/data/${activityId}`);
}, },
// 点击列表删除 // 点击列表删除
handleTapDelete(evt) { handleTapDelete(evt) {
const { activityId } = evt.target.dataset.x.record; const { activityId } = evt.target.dataset.x.record;
console.log(1) console.log(1);
this.setData({ this.setData({
confirmDialog: Object.assign({}, this.data.confirmDialog, { confirmDialog: Object.assign({}, this.data.confirmDialog, {
visible: true, visible: true,
...@@ -216,7 +203,7 @@ Component({ ...@@ -216,7 +203,7 @@ Component({
this.setData({ this.setData({
exportDialogVisible: true, exportDialogVisible: true,
exportUrl: data.url.replace(/amp;/g, "") exportUrl: data.url.replace(/amp;/g, "")
}) });
} else { } else {
my.showToast({ my.showToast({
type: "fail", type: "fail",
......
...@@ -35,35 +35,51 @@ let resultsModel = new ResultsModel(); ...@@ -35,35 +35,51 @@ let resultsModel = new ResultsModel();
// 活动中奖名单 // 活动中奖名单
const findWinnerInfoList = async (context) => { const findWinnerInfoList = async (context) => {
let { let {
activityId activityId,
pageNo, pageSize
} = context.data; } = context.data;
if (!activityId) { if (!activityId) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, `缺少activityId`); return resultsModel.error(CODE_TYPES.PARAMS_ERROR, `缺少activityId`);
} }
if (!activityId) {
return resultsModel.error(CODE_TYPES.PARAMS_ERROR, `缺少activityId`);
}
let rankopenprizeService = new RankopenprizeService(context); let rankopenprizeService = new RankopenprizeService(context);
// 获取活动中奖列表 let total = await rankopenprizeService.getAwardslistCount(activityId);
let awardslist = await rankopenprizeService.getAwardslistByActivityId(activityId); console.log("totle=========", total);
console.log(`awardslist: ${JSON.stringify(awardslist)}`); let awardslist = [];
let winnersObj = {}; let awardMore = await rankopenprizeService.getAwardslistByActivityId(
awardslist.forEach((v, index, arr) => { activityId,
if (!winnersObj[v.rank]) { pageSize,
winnersObj[v.rank] = []; pageNo
} );
winnersObj[v.rank].push({ awardslist = awardslist.concat(awardMore);
userNick: v.userNick, // console.log('awardslist>>>>', awardslist)
id: v.openId // awardslist = await rankopenprizeService.getAwardslistByActivityId(
}); // activityId,
}); // );
// console.log(`awardslist:》》》 ${JSON.stringify(awardslist)}《《《`);
console.log(`winnersObj: ${JSON.stringify(winnersObj)}`); awardslist.map((item) => {
let results = []; let ad = item.province + item.city + item.area + item.addressdetail, type0 = item.type;
new Map(Object.entries(winnersObj)).forEach((v, index, arr) => { item.createTime = formatTime(new Date(item.createTime)) || "";
results.push({ item.receiveTime = item.receiveTime ? formatTime(new Date(item.receiveTime)) : '未填';
rank: index, item.awardsType = prizePoolType[item.awardsType];
winnerDetailList: v item.type = prizeKind[item.type];
}); item.receiveName = type0 == 3 ? (item.receiveName || "未填") : '/';
}); item.phone = type0 == 3 ? (item.phone || "未填") : '/';
return resultsModel.success(results); item.address = type0 == 3 ? (item.province ? ad : "未填") : '/';
item.shipStatus = type0 == 3 ? (shipMsg[item.shipStatus]) : '/';
item.shipCompany = type0 == 3 ? (item.shipCompany || '/') : '/';
item.shipNum = type0 == 3 ? (item.shipNum || '/') : '/';
})
// console.log(`xlsxData: ${JSON.stringify(xlsxData)}`);
try {
return resultsModel.success({ list: awardslist, total });
} catch (e) {
console.log("上传文件出错", e);
// 打印日志
return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, `查看结果错误`);
}
}; };
// 导出活动中奖名单 // 导出活动中奖名单
const exportAwardsList = async (context) => { const exportAwardsList = async (context) => {
...@@ -84,35 +100,68 @@ const exportAwardsList = async (context) => { ...@@ -84,35 +100,68 @@ const exportAwardsList = async (context) => {
// 获取活动中奖列表 // 获取活动中奖列表
let awardslist = await rankopenprizeService.getAwardslistByActivityId(activityId); let awardslist = await rankopenprizeService.getAwardslistByActivityId(activityId);
console.log(`awardslist: ${JSON.stringify(awardslist)}`); console.log(`awardslist: ${JSON.stringify(awardslist)}`);
if (awardslist.length > 0) {
let xlsxData = [ let xlsxData = [
['序列', '名次', '昵称', '中奖名称'] [
]; "序列",
awardslist.forEach((v, index, arr) => { "奖品编号",
xlsxData.push([index + 1, v.rank, v.userNick, v.prizeName]); "中奖时间",
}); "地址填写时间",
let buffer = xlsx.build([{ "用户昵称",
name: title + new Date().getTime(), "奖品种类",
data: xlsxData "奖品类型",
}]); "中奖名称",
console.log(`xlsxData: ${JSON.stringify(xlsxData)}`); "收货人",
try { "手机号",
let result = await cloud.file.uploadFile({ "收获地址",
fileContent: buffer, "发货状态",
fileName: title + new Date().getTime() + '.xlsx' "物流公司",
"物流单号"
],
];
awardslist.forEach((v, index, arr) => {
xlsxData.push([
index + 1,
v._id,
// 中奖时间-填写地址时间
v.createTime ? formatTime(new Date(v.createTime + EIGHT_HOURS)) : "",
v.type == 1 ? "/" : v.receiveTime ? formatTime(new Date(v.receiveTime + EIGHT_HOURS)) : "未填",
v.userNick || "/",
prizePoolType[v.awardsType],
prizeKind[v.type],
v.name || "",
v.type == 1 ? "/" : v.receiveName || "",
v.type == 1 ? "/" : v.phone || "未填",
v.type == 1 ? "/" : (v.province ? v.province + v.city + v.area + v.addressdetail : "未填"),
v.type == 1 ? "/" : shipMsg[v.shipStatus],
v.type == 1 ? "/" : v.shipCompany || "/",
v.type == 1 ? "/" : v.shipNum || "/",
]);
}); });
// result.url 需进行处理 let buffer = xlsx.build([{
if (result.url) { name: title + new Date().getTime(),
result.url = result.url.replace('http', 'https').replace('-internal', ''); data: xlsxData
}]);
console.log(`xlsxData: ${JSON.stringify(xlsxData)}`);
try {
let result = await cloud.file.uploadFile({
fileContent: buffer,
fileName: title + new Date().getTime() + '.xlsx'
});
// result.url 需进行处理
if (result.url) {
result.url = result.url.replace('http', 'https').replace('-internal', '');
}
return resultsModel.success(result);
} catch (e) {
console.log('上传文件出错', e);
// 打印日志
return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, `上传文件错误`);
} }
return resultsModel.success(result); } else {
} catch (e) { return resultsModel.success(false);
console.log('上传文件出错', e);
// 打印日志
return resultsModel.error(CODE_TYPES.SYSTEM_ERROR, `上传文件错误`);
} }
}; };
//-------------------start-------------------------------------------------- //-------------------start--------------------------------------------------
//《条件搜索》 导出活动中奖名单 //《条件搜索》 导出活动中奖名单
const exportAwardsInfoBySearch = async (context) => { const exportAwardsInfoBySearch = async (context) => {
...@@ -189,9 +238,6 @@ const exportAwardsInfoBySearch = async (context) => { ...@@ -189,9 +238,6 @@ const exportAwardsInfoBySearch = async (context) => {
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.type == 1 ? "/" : v.city || "未填",
// v.type == 1 ? "/" : v.city || "未填",
v.type == 1 ? "/" : (v.province ? v.province + v.city + v.area + v.addressdetail : "未填"), v.type == 1 ? "/" : (v.province ? v.province + v.city + v.area + v.addressdetail : "未填"),
v.type == 1 ? "/" : shipMsg[v.shipStatus], v.type == 1 ? "/" : shipMsg[v.shipStatus],
v.type == 1 ? "/" : v.shipCompany || "/", v.type == 1 ? "/" : v.shipCompany || "/",
...@@ -204,7 +250,6 @@ const exportAwardsInfoBySearch = async (context) => { ...@@ -204,7 +250,6 @@ const exportAwardsInfoBySearch = async (context) => {
data: xlsxData, data: xlsxData,
}, },
]); ]);
// console.log(`xlsxData: ${JSON.stringify(xlsxData)}`);
try { try {
let result = await cloud.file.uploadFile({ let result = await cloud.file.uploadFile({
fileContent: buffer, fileContent: buffer,
......
...@@ -25,9 +25,19 @@ class RankopenprizeService { ...@@ -25,9 +25,19 @@ class RankopenprizeService {
return false; return false;
} }
} }
//获取中奖名单长度
// 根据活动id查找中奖名单 async getAwardslistCount(activityId, pageSize, pageNo) {
async getAwardslistByActivityId(activityId) { if (!activityId) {
return false;
}
return await this.rankopenprizeDao.count(
{
activityId: activityId,
}
);
}
// 根据活动id分页查找中奖名单
async getAwardslistByActivityId(activityId, pageSize, pageNo) {
if (!activityId) { if (!activityId) {
return false; return false;
} }
...@@ -37,9 +47,10 @@ class RankopenprizeService { ...@@ -37,9 +47,10 @@ class RankopenprizeService {
}, },
{ {
sort: { sort: {
score: -1, rank: 1
rankTime: -1,
}, },
limit: pageSize,
skip: (pageNo - 1) * pageSize,
} }
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment