Commit 1cb502c3 by zhaoxiqing

gsb

parent 82001e25
......@@ -9,13 +9,18 @@ class merchantCtl extends CtlBase {
constructor() {
super();
this.merchantSve = system.getObject("service.merchant.merchantSve");
this.userSve = system.getObject("service.uc.userSve");
}
async merchantOfInfo(params, pobj2, req) {
try {
params.merchant_id = req.body.merchant_id;
return await this.merchantSve.merchantOfInfo(params);
params.id = req.body.merchant_id;
let res = await this.merchantSve.merchantOfInfo(params);
if (res.data) {
await this.userSve.setRowsUser([res.data], "bd_id", "bd");
}
return res;
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误 错误信息 ${error}`);
......
......@@ -21,7 +21,7 @@ class UserService extends ServiceBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async page(params) {
try {
return await this.callms("sve_uc", "userPage", params);
......@@ -53,6 +53,28 @@ class UserService extends ServiceBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async setRowsUser(rows, field, objectField) {
objectField = objectField || "user";
if (!rows || rows.length == 0 || !field) {
return;
}
let ids = [];
for (let item of rows) {
let id = Number(item[field] || 0);
if(!id) {
continue;
}
ids.push(id);
}
let map = await this.mapByIds({ids: ids});
for (let item of rows) {
item[objectField] = map[item[field]] || {};
}
}
}
module.exports = UserService;
\ No newline at end of file
module.exports = UserService;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment