1、新增黄页
2、新增学堂 3、其他调整、修改
This commit is contained in:
@@ -1,60 +1,78 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
/**
|
||||
* 获取用户发布的询价单
|
||||
* @url client/enquiry/sheet/pub/getList 前端调用的url参数地址
|
||||
* data 请求参数
|
||||
* @param {String} params1 参数1
|
||||
*/
|
||||
main: async (event) => {
|
||||
let { data = {}, userInfo, util, filterResponse, originalParam } = event;
|
||||
let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
|
||||
let { uid, userId,pageIndex,pageSize,keyword,categoryIds,provinceCodes } = data;
|
||||
let res = { code: 0, msg: "" };
|
||||
// 业务逻辑开始-----------------------------------------------------------
|
||||
let dbName = "jjx-enquiry-sheet";
|
||||
|
||||
|
||||
let whereJson = {};
|
||||
|
||||
if(vk.pubfn.isNotNull(keyword)) {
|
||||
whereJson.name = new RegExp(keyword)
|
||||
}
|
||||
if(vk.pubfn.isNotNull(categoryIds)) {
|
||||
whereJson.categoryIds = _.in(categoryIds)
|
||||
}
|
||||
|
||||
if(vk.pubfn.isNotNull(provinceCodes)) {
|
||||
whereJson['address.province.code'] = _.in(provinceCodes)
|
||||
}
|
||||
|
||||
res = await vk.baseDao.selects({
|
||||
dbName,
|
||||
pageIndex,
|
||||
pageSize,
|
||||
whereJson,
|
||||
foreignDB: [
|
||||
{
|
||||
dbName:"uni-id-users",
|
||||
localKey:"userId",
|
||||
foreignKey:"_id",
|
||||
as:"user",
|
||||
limit:1, // limit=1则以对象形式返回
|
||||
fieldJson:{
|
||||
_id: true,
|
||||
company: {
|
||||
companyName: true
|
||||
},
|
||||
person: {
|
||||
personName: true
|
||||
},
|
||||
businessCard: true,
|
||||
accountType: true,
|
||||
},
|
||||
},
|
||||
/**
|
||||
* 获取用户发布的询价单
|
||||
* @url client/enquiry/sheet/pub/getList 前端调用的url参数地址
|
||||
* data 请求参数
|
||||
* @param {String} params1 参数1
|
||||
*/
|
||||
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 res = {code: 0, msg: ""};
|
||||
// 业务逻辑开始-----------------------------------------------------------
|
||||
let dbName = "jjx-enquiry-sheet";
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
let whereJson = {};
|
||||
|
||||
if (vk.pubfn.isNotNull(keyword)) {
|
||||
whereJson.name = new RegExp(keyword)
|
||||
}
|
||||
|
||||
if (data.userId && vk.pubfn.isNotNull(data.userId)) {
|
||||
whereJson.userId = data.userId
|
||||
}else {
|
||||
whereJson.status = 0
|
||||
}
|
||||
|
||||
if (formData && formData.hasOwnProperty('userId') && vk.pubfn.isNotNull(formData.userId)) {
|
||||
whereJson.userId = formData.userId
|
||||
}else {
|
||||
whereJson.status = 0
|
||||
}
|
||||
|
||||
if (formData && formData.hasOwnProperty('companyList') && vk.pubfn.isNotNull(formData.companyList)) {
|
||||
whereJson.userId = _.in(formData.companyList)
|
||||
}
|
||||
|
||||
if (formData && formData.hasOwnProperty('categoryIds') && vk.pubfn.isNotNull(formData.categoryIds)) {
|
||||
whereJson.categoryIds = _.in(formData.categoryIds)
|
||||
}
|
||||
|
||||
if (vk.pubfn.isNotNull(provinceCodes)) {
|
||||
whereJson['address.province.code'] = _.in(provinceCodes)
|
||||
}
|
||||
|
||||
res = await vk.baseDao.selects({
|
||||
dbName,
|
||||
pageIndex,
|
||||
pageSize,
|
||||
whereJson,
|
||||
sortArr: [{name: "_add_time", type: "desc"}],
|
||||
foreignDB: [
|
||||
{
|
||||
dbName: "uni-id-users",
|
||||
localKey: "userId",
|
||||
foreignKey: "_id",
|
||||
as: "user",
|
||||
limit: 1, // limit=1则以对象形式返回
|
||||
fieldJson: {
|
||||
_id: true,
|
||||
company: {
|
||||
companyName: true
|
||||
},
|
||||
person: {
|
||||
personName: true
|
||||
},
|
||||
businessCard: true,
|
||||
accountType: true,
|
||||
},
|
||||
},
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
const rows = res.rows
|
||||
rows.forEach((row, rowIndex) => {
|
||||
@@ -71,13 +89,13 @@ module.exports = {
|
||||
const index = res.rows.indexOf(item);
|
||||
res.rows[index].quoteNum = await vk.baseDao.count({
|
||||
dbName: 'jjx-enquiry-quote',
|
||||
whereJson:{
|
||||
whereJson: {
|
||||
sheetId: item._id
|
||||
}
|
||||
})
|
||||
}
|
||||
res.rows = rows
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user