47 lines
2.2 KiB
JavaScript
47 lines
2.2 KiB
JavaScript
'use strict';
|
|
const dbName = require("../../../../dao/config");
|
|
module.exports = {
|
|
/**
|
|
* 企业用户列表
|
|
* @url client/user/pub/getCompany 前端调用的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, pageSize = 500, pageIndex = 1, showInYellow} = data;
|
|
let res = {code: 0, msg: ""};
|
|
const whereJson = {
|
|
accountType: 2
|
|
}
|
|
if (!vk.pubfn.isNull(data.keyword)) whereJson['company.companyName'] = new RegExp(data.keyword);
|
|
if (!vk.pubfn.isNull(data.isCoop)) whereJson.isCoop = data.isCoop;
|
|
if (!vk.pubfn.isNull(data.authStatus)) whereJson.authStatus = data.authStatus;
|
|
if (!vk.pubfn.isNull(data.showInYellow)) whereJson.showInYellow = data.showInYellow;
|
|
// if (!vk.pubfn.isNull(data.factoryFilter) && data.factoryFilter) whereJson.factoryStatus = 1;
|
|
if (!vk.pubfn.isNull(data.industryList) && data.industryList) whereJson['company.businessType'] = _.in(data.industryList);
|
|
if (!vk.pubfn.isNull(data.province) && data.province && data.province.length > 0) {
|
|
whereJson['company.addressRegion.province.code'] = _.in(data.province);
|
|
}
|
|
if (!vk.pubfn.isNull(data.city) && data.city && data.city.length > 0) {
|
|
whereJson['company.addressRegion.city.code'] = _.in(data.city);
|
|
}
|
|
if (!vk.pubfn.isNull(data.mainSpotCategoryIds) && data.mainSpotCategoryIds && data.mainSpotCategoryIds.length > 0) {
|
|
whereJson['company.mainSpotCategoryIds'] = _.in(data.mainSpotCategoryIds);
|
|
}
|
|
// 业务逻辑开始-----------------------------------------------------------
|
|
res = await vk.baseDao.select({
|
|
dbName: dbName.user,
|
|
whereJson,
|
|
pageSize,
|
|
pageIndex,
|
|
sortArr: [{"name": "register_date", "type": "desc"}],
|
|
|
|
});
|
|
// console.log('whereJson', whereJson)
|
|
// 业务逻辑结束-----------------------------------------------------------
|
|
return res;
|
|
}
|
|
}
|