1、新增旧货市场
2、新增用户等级
This commit is contained in:
@@ -9,7 +9,7 @@ module.exports = {
|
||||
main: async (event) => {
|
||||
let {data = {}, userInfo, util, filterResponse, originalParam} = event;
|
||||
let {customUtil, uniID, config, pubFun, vk, db, _} = util;
|
||||
let {uid, pageIndex, pageSize, keyword, categoryIds, provinceCodes, formData} = data;
|
||||
let {uid, pageIndex, pageSize, keyword, categoryIds, provinceCodes, formData, status} = data;
|
||||
let res = {code: 0, msg: ""};
|
||||
// 业务逻辑开始-----------------------------------------------------------
|
||||
let dbName = "jjx-enquiry-sheet";
|
||||
@@ -23,14 +23,14 @@ module.exports = {
|
||||
|
||||
if (data.userId && vk.pubfn.isNotNull(data.userId)) {
|
||||
whereJson.userId = data.userId
|
||||
}else {
|
||||
} else {
|
||||
whereJson.status = 0
|
||||
}
|
||||
|
||||
if (formData && formData.hasOwnProperty('userId') && vk.pubfn.isNotNull(formData.userId)) {
|
||||
whereJson.userId = formData.userId
|
||||
}else {
|
||||
whereJson.status = 0
|
||||
if (vk.pubfn.isNotNull(status) && status !== 'all') {
|
||||
if (status === 'noQuote') whereJson.quoteNum = 0
|
||||
else if (status === 'notPick') whereJson.status = 0
|
||||
else if (status === 'picked') whereJson.status = 1
|
||||
}
|
||||
|
||||
if (formData && formData.hasOwnProperty('companyList') && vk.pubfn.isNotNull(formData.companyList)) {
|
||||
@@ -70,7 +70,13 @@ module.exports = {
|
||||
accountType: true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
dbName: "jjx-enquiry-quote",
|
||||
localKey: "_id",
|
||||
foreignKey: "sheetId",
|
||||
as: "quoteList",
|
||||
limit: 500, // limit=1则以对象形式返回
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -85,15 +91,38 @@ module.exports = {
|
||||
});
|
||||
})
|
||||
})
|
||||
for (const item of res.rows) {
|
||||
const index = res.rows.indexOf(item);
|
||||
res.rows[index].quoteNum = await vk.baseDao.count({
|
||||
dbName: 'jjx-enquiry-quote',
|
||||
whereJson: {
|
||||
sheetId: item._id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
res.notPickNum = await vk.baseDao.count({
|
||||
dbName,
|
||||
whereJson: {
|
||||
userId: uid,
|
||||
status: 0
|
||||
},
|
||||
});
|
||||
|
||||
res.pickedNum = await vk.baseDao.count({
|
||||
dbName,
|
||||
whereJson: {
|
||||
userId: uid,
|
||||
status: 1
|
||||
},
|
||||
});
|
||||
|
||||
res.noQuoteNum = await vk.baseDao.count({
|
||||
dbName,
|
||||
whereJson: {
|
||||
userId: uid,
|
||||
quoteNum: 0
|
||||
},
|
||||
});
|
||||
|
||||
res.all = await vk.baseDao.count({
|
||||
dbName,
|
||||
whereJson: {
|
||||
userId: uid,
|
||||
},
|
||||
});
|
||||
|
||||
res.rows = rows
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user