This commit is contained in:
2026-10-08 18:14:56 +08:00
parent dec4ebc773
commit 9cc1ff546c
1081 changed files with 238349 additions and 52163 deletions
@@ -0,0 +1,83 @@
'use strict';
const dbName = require("../../../../dao/config");
module.exports = {
/**
* XXXnameXXX
* @url client/factory/kh/addUpdate 前端调用的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 {pageSize, pageIndex, area} = data;
let res = {code: 0, msg: ""};
// 业务逻辑开始-----------------------------------------------------------
let companyList = []
if (!vk.pubfn.isNull(data.keyword)) {
companyList = await vk.baseDao.select({
dbName: dbName.user,
pageSize: 9999,
pageIndex: 1,
getMain: true,
whereJson: {
// accountType: 2,
"company.companyName": new RegExp(data.keyword)
}
})
}
const whereJson = {
status: 1,
isShow: true
}
if (companyList && companyList.length > 0) {
whereJson['uid'] = _.in(companyList.map(v => v.uid))
}
if (vk.pubfn.isNotNull(data.mainSpotCategory)) {
whereJson['mainSpotCategory'] = _.in([data.mainSpotCategory])
}
if (vk.pubfn.isNotNull(area)) {
if (area.length === 3) whereJson['addressRegion.area.code'] = area[2]
if (area.length === 2) whereJson['addressRegion.city.code'] = area[1]
if (area.length === 1) whereJson['addressRegion.province.code'] = area[0]
} else if (vk.pubfn.isNotNull(data.province)) {
whereJson['addressRegion.province.code'] = data.province
}
console.log('factory whereJson', whereJson)
const resData = await vk.baseDao.selects({
dbName: "jjx-factory",
whereJson,
pageSize,
pageIndex,
getCount: true,
foreignDB: [
{
dbName: "uni-id-users",
localKey: "uid",
foreignKey: "_id",
as: "user",
limit: 1, // limit=1则以对象形式返回
fieldJson: {
_id: true,
company: {
companyName: true,
mobile: true,
},
person: {
personName: true,
mobile: true,
},
businessCard: true,
accountType: true,
},
}
]
});
res.data = resData
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}