Files
jjx-web-sign-only/uniCloud-aliyun/cloudfunctions/router/service/client/spot/goods/pub/getDetail.js
T
2023-11-17 13:50:18 +08:00

75 lines
1.4 KiB
JavaScript

'use strict';
const dbName = 'jjx-spot-goods'
module.exports = {
/**
* XXXnameXXX
* @url client/spot/goods/kh/getDetail 前端调用的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
} = data;
let res = {
code: 0,
msg: ""
};
// 业务逻辑开始-----------------------------------------------------------
const {
_id
} = data
res.data = await vk.baseDao.selects({
dbName,
getOne: true,
getMain: true,
// 主表where条件
whereJson: {
_id: _id
},
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,
},
},
{
dbName: "jjx-goods-cooperate",
localKey: "_id",
foreignKey: "goodsId",
as: "cooperateList",
limit: 500, // limit=1则以对象形式返回
}
]
});
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}